Commit 4cf842b3 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added subnets

parent 01605b7e
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
<goal>generate</goal> <goal>generate</goal>
</goals> </goals>
<configuration> <configuration>
<inputSpec>${basedir}/../openAPI/API/CONF-3.0.0-swagger.yaml</inputSpec> <inputSpec>${basedir}/../openAPI/API/CloudStorm-1.0.0-openapi.yaml</inputSpec>
<generatorName>java</generatorName> <generatorName>java</generatorName>
<output>${project.build.directory}/generated-sources</output> <output>${project.build.directory}/generated-sources</output>
<apiPackage>${default.package}.handler</apiPackage> <apiPackage>${default.package}.handler</apiPackage>
......
...@@ -28,6 +28,7 @@ import java.util.Map; ...@@ -28,6 +28,7 @@ import java.util.Map;
import nl.uva.sne.drip.commons.sure_tosca.client.ApiException; import nl.uva.sne.drip.commons.sure_tosca.client.ApiException;
import nl.uva.sne.drip.commons.sure_tosca.client.Configuration; import nl.uva.sne.drip.commons.sure_tosca.client.Configuration;
import nl.uva.sne.drip.commons.sure_tosca.client.DefaultApi; import nl.uva.sne.drip.commons.sure_tosca.client.DefaultApi;
import nl.uva.sne.drip.model.NodeTemplate;
import nl.uva.sne.drip.model.ToscaTemplate; import nl.uva.sne.drip.model.ToscaTemplate;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -79,4 +80,9 @@ public class ToscaHelper { ...@@ -79,4 +80,9 @@ public class ToscaHelper {
return interfaceDefinitions; return interfaceDefinitions;
} }
public List<NodeTemplate> getVMTopologyTemplates(ToscaTemplate toscaTemplate) throws ApiException {
List<NodeTemplate> vmTopologyTemplates = api.getNodeTemplates(String.valueOf(id), "tosca.nodes.ARTICONF.VM.topology", null, null, null, null, null, null, null, null);
return vmTopologyTemplates;
}
} }
...@@ -16,53 +16,104 @@ ...@@ -16,53 +16,104 @@
package nl.uva.sne.drip.model; package nl.uva.sne.drip.model;
import java.util.Objects; import java.util.Objects;
import com.google.gson.annotations.SerializedName; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/** /**
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-12-09T16:00:08.961312+01:00[Europe/Amsterdam]") @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-12-09T15:55:39.959Z[GMT]")
public class CloudsStormSubTopology { public class CloudsStormSubTopology {
@JsonProperty("topology")
private String topology = null;
public static final String SERIALIZED_NAME_VMS = "VMs"; @JsonProperty("cloudProvider")
@SerializedName(SERIALIZED_NAME_VMS) private String cloudProvider = null;
private List<CloudsStormVM> vms = null;
public CloudsStormSubTopology vms(List<CloudsStormVM> vms) { @JsonProperty("domain")
private String domain = null;
this.vms = vms; @JsonProperty("status")
private String status = null;
public CloudsStormSubTopology topology(String topology) {
this.topology = topology;
return this; return this;
} }
public CloudsStormSubTopology addVmsItem(CloudsStormVM vmsItem) { /**
if (this.vms == null) { * Get topology
this.vms = new ArrayList<CloudsStormVM>(); * @return topology
**/
@ApiModelProperty(value = "")
public String getTopology() {
return topology;
} }
this.vms.add(vmsItem);
public void setTopology(String topology) {
this.topology = topology;
}
public CloudsStormSubTopology cloudProvider(String cloudProvider) {
this.cloudProvider = cloudProvider;
return this; return this;
} }
/** /**
* Get vms * Get cloudProvider
* * @return cloudProvider
* @return vms **/
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public List<CloudsStormVM> getVms() { public String getCloudProvider() {
return vms; return cloudProvider;
}
public void setCloudProvider(String cloudProvider) {
this.cloudProvider = cloudProvider;
} }
public void setVms(List<CloudsStormVM> vms) { public CloudsStormSubTopology domain(String domain) {
this.vms = vms; this.domain = domain;
return this;
} }
/**
* Get domain
* @return domain
**/
@ApiModelProperty(value = "")
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public CloudsStormSubTopology status(String status) {
this.status = status;
return this;
}
/**
* Get status
* @return status
**/
@ApiModelProperty(value = "")
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Override @Override
public boolean equals(java.lang.Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
...@@ -72,19 +123,26 @@ public class CloudsStormSubTopology { ...@@ -72,19 +123,26 @@ public class CloudsStormSubTopology {
return false; return false;
} }
CloudsStormSubTopology cloudsStormSubTopology = (CloudsStormSubTopology) o; CloudsStormSubTopology cloudsStormSubTopology = (CloudsStormSubTopology) o;
return Objects.equals(this.vms, cloudsStormSubTopology.vms); return Objects.equals(this.topology, cloudsStormSubTopology.topology) &&
Objects.equals(this.cloudProvider, cloudsStormSubTopology.cloudProvider) &&
Objects.equals(this.domain, cloudsStormSubTopology.domain) &&
Objects.equals(this.status, cloudsStormSubTopology.status);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(vms); return Objects.hash(topology, cloudProvider, domain, status);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormSubTopology {\n"); sb.append("class CloudsStormSubTopology {\n");
sb.append(" vms: ").append(toIndentedString(vms)).append("\n");
sb.append(" topology: ").append(toIndentedString(topology)).append("\n");
sb.append(" cloudProvider: ").append(toIndentedString(cloudProvider)).append("\n");
sb.append(" domain: ").append(toIndentedString(domain)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}"); sb.append("}");
return sb.toString(); return sb.toString();
} }
...@@ -99,5 +157,4 @@ public class CloudsStormSubTopology { ...@@ -99,5 +157,4 @@ public class CloudsStormSubTopology {
} }
return o.toString().replace("\n", "\n "); return o.toString().replace("\n", "\n ");
} }
} }
...@@ -25,9 +25,8 @@ import java.util.List; ...@@ -25,9 +25,8 @@ import java.util.List;
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-12-09T16:00:08.961312+01:00[Europe/Amsterdam]") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-12-09T16:51:48.830052+01:00[Europe/Amsterdam]")
public class CloudsStormTopTopology { public class CloudsStormTopTopology {
public static final String SERIALIZED_NAME_USER_NAME = "userName"; public static final String SERIALIZED_NAME_USER_NAME = "userName";
@SerializedName(SERIALIZED_NAME_USER_NAME) @SerializedName(SERIALIZED_NAME_USER_NAME)
private String userName; private String userName;
...@@ -40,6 +39,7 @@ public class CloudsStormTopTopology { ...@@ -40,6 +39,7 @@ public class CloudsStormTopTopology {
@SerializedName(SERIALIZED_NAME_TOPOLOGIES) @SerializedName(SERIALIZED_NAME_TOPOLOGIES)
private List<CloudsStormSubTopology> topologies = null; private List<CloudsStormSubTopology> topologies = null;
public CloudsStormTopTopology userName(String userName) { public CloudsStormTopTopology userName(String userName) {
this.userName = userName; this.userName = userName;
...@@ -48,10 +48,8 @@ public class CloudsStormTopTopology { ...@@ -48,10 +48,8 @@ public class CloudsStormTopTopology {
/** /**
* Get userName * Get userName
*
* @return userName * @return userName
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -59,10 +57,12 @@ public class CloudsStormTopTopology { ...@@ -59,10 +57,12 @@ public class CloudsStormTopTopology {
return userName; return userName;
} }
public void setUserName(String userName) { public void setUserName(String userName) {
this.userName = userName; this.userName = userName;
} }
public CloudsStormTopTopology publicKeyPath(String publicKeyPath) { public CloudsStormTopTopology publicKeyPath(String publicKeyPath) {
this.publicKeyPath = publicKeyPath; this.publicKeyPath = publicKeyPath;
...@@ -71,10 +71,8 @@ public class CloudsStormTopTopology { ...@@ -71,10 +71,8 @@ public class CloudsStormTopTopology {
/** /**
* Get publicKeyPath * Get publicKeyPath
*
* @return publicKeyPath * @return publicKeyPath
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -82,10 +80,12 @@ public class CloudsStormTopTopology { ...@@ -82,10 +80,12 @@ public class CloudsStormTopTopology {
return publicKeyPath; return publicKeyPath;
} }
public void setPublicKeyPath(String publicKeyPath) { public void setPublicKeyPath(String publicKeyPath) {
this.publicKeyPath = publicKeyPath; this.publicKeyPath = publicKeyPath;
} }
public CloudsStormTopTopology topologies(List<CloudsStormSubTopology> topologies) { public CloudsStormTopTopology topologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies; this.topologies = topologies;
...@@ -102,10 +102,8 @@ public class CloudsStormTopTopology { ...@@ -102,10 +102,8 @@ public class CloudsStormTopTopology {
/** /**
* Get topologies * Get topologies
*
* @return topologies * @return topologies
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -113,10 +111,12 @@ public class CloudsStormTopTopology { ...@@ -113,10 +111,12 @@ public class CloudsStormTopTopology {
return topologies; return topologies;
} }
public void setTopologies(List<CloudsStormSubTopology> topologies) { public void setTopologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies; this.topologies = topologies;
} }
@Override @Override
public boolean equals(java.lang.Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
...@@ -126,9 +126,9 @@ public class CloudsStormTopTopology { ...@@ -126,9 +126,9 @@ public class CloudsStormTopTopology {
return false; return false;
} }
CloudsStormTopTopology cloudsStormTopTopology = (CloudsStormTopTopology) o; CloudsStormTopTopology cloudsStormTopTopology = (CloudsStormTopTopology) o;
return Objects.equals(this.userName, cloudsStormTopTopology.userName) return Objects.equals(this.userName, cloudsStormTopTopology.userName) &&
&& Objects.equals(this.publicKeyPath, cloudsStormTopTopology.publicKeyPath) Objects.equals(this.publicKeyPath, cloudsStormTopTopology.publicKeyPath) &&
&& Objects.equals(this.topologies, cloudsStormTopTopology.topologies); Objects.equals(this.topologies, cloudsStormTopTopology.topologies);
} }
@Override @Override
...@@ -136,6 +136,7 @@ public class CloudsStormTopTopology { ...@@ -136,6 +136,7 @@ public class CloudsStormTopTopology {
return Objects.hash(userName, publicKeyPath, topologies); return Objects.hash(userName, publicKeyPath, topologies);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
......
...@@ -23,9 +23,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -23,9 +23,8 @@ import io.swagger.annotations.ApiModelProperty;
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-12-09T16:00:08.961312+01:00[Europe/Amsterdam]") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-12-09T16:51:48.830052+01:00[Europe/Amsterdam]")
public class CloudsStormVM { public class CloudsStormVM {
public static final String SERIALIZED_NAME_NAME = "name"; public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME) @SerializedName(SERIALIZED_NAME_NAME)
private String name; private String name;
...@@ -46,6 +45,7 @@ public class CloudsStormVM { ...@@ -46,6 +45,7 @@ public class CloudsStormVM {
@SerializedName(SERIALIZED_NAME_PUBLIC_ADDRESS) @SerializedName(SERIALIZED_NAME_PUBLIC_ADDRESS)
private String publicAddress; private String publicAddress;
public CloudsStormVM name(String name) { public CloudsStormVM name(String name) {
this.name = name; this.name = name;
...@@ -54,10 +54,8 @@ public class CloudsStormVM { ...@@ -54,10 +54,8 @@ public class CloudsStormVM {
/** /**
* Get name * Get name
*
* @return name * @return name
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -65,10 +63,12 @@ public class CloudsStormVM { ...@@ -65,10 +63,12 @@ public class CloudsStormVM {
return name; return name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public CloudsStormVM nodeType(String nodeType) { public CloudsStormVM nodeType(String nodeType) {
this.nodeType = nodeType; this.nodeType = nodeType;
...@@ -77,10 +77,8 @@ public class CloudsStormVM { ...@@ -77,10 +77,8 @@ public class CloudsStormVM {
/** /**
* Get nodeType * Get nodeType
*
* @return nodeType * @return nodeType
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -88,10 +86,12 @@ public class CloudsStormVM { ...@@ -88,10 +86,12 @@ public class CloudsStormVM {
return nodeType; return nodeType;
} }
public void setNodeType(String nodeType) { public void setNodeType(String nodeType) {
this.nodeType = nodeType; this.nodeType = nodeType;
} }
public CloudsStormVM osType(String osType) { public CloudsStormVM osType(String osType) {
this.osType = osType; this.osType = osType;
...@@ -100,10 +100,8 @@ public class CloudsStormVM { ...@@ -100,10 +100,8 @@ public class CloudsStormVM {
/** /**
* Get osType * Get osType
*
* @return osType * @return osType
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -111,10 +109,12 @@ public class CloudsStormVM { ...@@ -111,10 +109,12 @@ public class CloudsStormVM {
return osType; return osType;
} }
public void setOsType(String osType) { public void setOsType(String osType) {
this.osType = osType; this.osType = osType;
} }
public CloudsStormVM script(String script) { public CloudsStormVM script(String script) {
this.script = script; this.script = script;
...@@ -123,10 +123,8 @@ public class CloudsStormVM { ...@@ -123,10 +123,8 @@ public class CloudsStormVM {
/** /**
* Get script * Get script
*
* @return script * @return script
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -134,10 +132,12 @@ public class CloudsStormVM { ...@@ -134,10 +132,12 @@ public class CloudsStormVM {
return script; return script;
} }
public void setScript(String script) { public void setScript(String script) {
this.script = script; this.script = script;
} }
public CloudsStormVM publicAddress(String publicAddress) { public CloudsStormVM publicAddress(String publicAddress) {
this.publicAddress = publicAddress; this.publicAddress = publicAddress;
...@@ -146,10 +146,8 @@ public class CloudsStormVM { ...@@ -146,10 +146,8 @@ public class CloudsStormVM {
/** /**
* Get publicAddress * Get publicAddress
*
* @return publicAddress * @return publicAddress
* **/
*/
@javax.annotation.Nullable @javax.annotation.Nullable
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -157,10 +155,12 @@ public class CloudsStormVM { ...@@ -157,10 +155,12 @@ public class CloudsStormVM {
return publicAddress; return publicAddress;
} }
public void setPublicAddress(String publicAddress) { public void setPublicAddress(String publicAddress) {
this.publicAddress = publicAddress; this.publicAddress = publicAddress;
} }
@Override @Override
public boolean equals(java.lang.Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
...@@ -170,11 +170,11 @@ public class CloudsStormVM { ...@@ -170,11 +170,11 @@ public class CloudsStormVM {
return false; return false;
} }
CloudsStormVM cloudsStormVM = (CloudsStormVM) o; CloudsStormVM cloudsStormVM = (CloudsStormVM) o;
return Objects.equals(this.name, cloudsStormVM.name) return Objects.equals(this.name, cloudsStormVM.name) &&
&& Objects.equals(this.nodeType, cloudsStormVM.nodeType) Objects.equals(this.nodeType, cloudsStormVM.nodeType) &&
&& Objects.equals(this.osType, cloudsStormVM.osType) Objects.equals(this.osType, cloudsStormVM.osType) &&
&& Objects.equals(this.script, cloudsStormVM.script) Objects.equals(this.script, cloudsStormVM.script) &&
&& Objects.equals(this.publicAddress, cloudsStormVM.publicAddress); Objects.equals(this.publicAddress, cloudsStormVM.publicAddress);
} }
@Override @Override
...@@ -182,6 +182,7 @@ public class CloudsStormVM { ...@@ -182,6 +182,7 @@ public class CloudsStormVM {
return Objects.hash(name, nodeType, osType, script, publicAddress); return Objects.hash(name, nodeType, osType, script, publicAddress);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -207,3 +208,4 @@ public class CloudsStormVM { ...@@ -207,3 +208,4 @@ public class CloudsStormVM {
} }
} }
message.broker.host=127.0.0.1
message.broker.username=guest
message.broker.password=guest
message.broker.queue.provisioner=provisioner
message.broker.queue.planner=planner
message.broker.queue.deployer=deployer
sure-tosca.base.path=http://localhost:8081/tosca-sure/1.0.0
...@@ -2,8 +2,15 @@ ...@@ -2,8 +2,15 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment=""> <list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../drip-manager/src/main/java/nl/uva/sne/drip/api/ProvisionerApiController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-manager/src/main/java/nl/uva/sne/drip/api/ProvisionerApiController.java" afterDir="false" /> <change afterPath="$PROJECT_DIR$/../drip-commons/src/main/resources/application.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormSubTopology.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormSubTopology.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormTopTopology.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormTopTopology.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormVM.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormVM.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -29,7 +36,7 @@ ...@@ -29,7 +36,7 @@
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/../sure_tosca-flask-server" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" /> <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
...@@ -242,10 +249,10 @@ ...@@ -242,10 +249,10 @@
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state x="925" y="283" width="767" height="906" key="#__main__/67.34.2493.1406@67.34.2493.1406" timestamp="1575885420596" /> <state x="925" y="283" width="767" height="906" key="#__main__/67.34.2493.1406@67.34.2493.1406" timestamp="1575885420596" />
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl" timestamp="1575885341909"> <state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl" timestamp="1575907769017">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575885341909" /> <state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575907769017" />
<state width="2465" height="410" key="GridCell.Tab.0.bottom" timestamp="1575891807013"> <state width="2465" height="410" key="GridCell.Tab.0.bottom" timestamp="1575891807013">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
...@@ -282,10 +289,10 @@ ...@@ -282,10 +289,10 @@
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state x="679" y="283" key="SettingsEditor/67.34.2493.1406@67.34.2493.1406" timestamp="1575885393075" /> <state x="679" y="283" key="SettingsEditor/67.34.2493.1406@67.34.2493.1406" timestamp="1575885393075" />
<state x="893" y="526" key="com.intellij.ide.util.TipDialog" timestamp="1575891786241"> <state x="893" y="526" key="com.intellij.ide.util.TipDialog" timestamp="1575907758846">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state x="893" y="526" key="com.intellij.ide.util.TipDialog/67.34.2493.1406@67.34.2493.1406" timestamp="1575891786241" /> <state x="893" y="526" key="com.intellij.ide.util.TipDialog/67.34.2493.1406@67.34.2493.1406" timestamp="1575907758846" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
package nl.uva.sne.drip.provisioner; package nl.uva.sne.drip.provisioner;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException; import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.KeyPair; import com.jcraft.jsch.KeyPair;
...@@ -15,9 +16,12 @@ import java.util.ArrayList; ...@@ -15,9 +16,12 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import nl.uva.sne.drip.commons.sure_tosca.client.ApiException;
import nl.uva.sne.drip.commons.utils.ToscaHelper;
import nl.uva.sne.drip.model.CloudsStormSubTopology; import nl.uva.sne.drip.model.CloudsStormSubTopology;
import nl.uva.sne.drip.model.CloudsStormTopTopology; import nl.uva.sne.drip.model.CloudsStormTopTopology;
import nl.uva.sne.drip.model.CloudsStormVM; import nl.uva.sne.drip.model.CloudsStormVM;
import nl.uva.sne.drip.model.NodeTemplate;
import nl.uva.sne.drip.model.ToscaTemplate; import nl.uva.sne.drip.model.ToscaTemplate;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
...@@ -29,8 +33,15 @@ class CloudStormService { ...@@ -29,8 +33,15 @@ class CloudStormService {
private List<Map.Entry> vmTopologies; private List<Map.Entry> vmTopologies;
private String tempInputDirPath; private String tempInputDirPath;
private final ToscaTemplate toscaTemplate;
private final ToscaHelper helper;
ToscaTemplate execute(ToscaTemplate toscaTemplate) throws FileNotFoundException, JSchException, IOException { CloudStormService(String sureToscaBasePath,ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException {
this.toscaTemplate = toscaTemplate;
this.helper = new ToscaHelper(toscaTemplate, sureToscaBasePath);
}
ToscaTemplate execute() throws FileNotFoundException, JSchException, IOException {
tempInputDirPath = System.getProperty("java.io.tmpdir") + File.separator + "Input-" + Long.toString(System.nanoTime()) + File.separator; tempInputDirPath = System.getProperty("java.io.tmpdir") + File.separator + "Input-" + Long.toString(System.nanoTime()) + File.separator;
File tempInputDir = new File(tempInputDirPath); File tempInputDir = new File(tempInputDirPath);
if (!(tempInputDir.mkdirs())) { if (!(tempInputDir.mkdirs())) {
...@@ -47,6 +58,7 @@ class CloudStormService { ...@@ -47,6 +58,7 @@ class CloudStormService {
String publicKeyPath = buildSSHKeyPair(); String publicKeyPath = buildSSHKeyPair();
topTopology.setPublicKeyPath(publicKeyPath); topTopology.setPublicKeyPath(publicKeyPath);
topTopology.setUserName(getUserName()); topTopology.setUserName(getUserName());
List<CloudsStormSubTopology> topologies = getCloudsStormSubTopologies(toscaTemplate); List<CloudsStormSubTopology> topologies = getCloudsStormSubTopologies(toscaTemplate);
topTopology.setTopologies(topologies); topTopology.setTopologies(topologies);
...@@ -69,18 +81,29 @@ class CloudStormService { ...@@ -69,18 +81,29 @@ class CloudStormService {
return "vm_user"; return "vm_user";
} }
private List<CloudsStormSubTopology> getCloudsStormSubTopologies(ToscaTemplate toscaTemplate) { private List<CloudsStormSubTopology> getCloudsStormSubTopologies(ToscaTemplate toscaTemplate) throws ApiException {
List<NodeTemplate> vmTopologyTemplates = helper.getVMTopologyTemplates(toscaTemplate);
List<CloudsStormSubTopology> cloudsStormSubTopologies = new ArrayList<>(); List<CloudsStormSubTopology> cloudsStormSubTopologies = new ArrayList<>();
for(NodeTemplate nodeTemplate: vmTopologyTemplates){
CloudsStormSubTopology cloudsStormSubTopology = new CloudsStormSubTopology(); CloudsStormSubTopology cloudsStormSubTopology = new CloudsStormSubTopology();
List<CloudsStormVM> vms = new ArrayList<>();
CloudsStormVM cloudsStormVM = new CloudsStormVM();
cloudsStormVM.setName("Node1");
vms.add(cloudsStormVM); Map<String, Object> properties = nodeTemplate.getProperties();
String domain = (String) properties.get("domain");
String provider = (String) properties.get("provider");
cloudsStormSubTopology.setCloudProvider(domain);
cloudsStormSubTopology.setCloudProvider(provider);
cloudsStormSubTopology.setTopology("vm");
}
cloudsStormSubTopology.setVms(vms); // List<CloudsStormVM> vms = new ArrayList<>();
cloudsStormSubTopology. // CloudsStormVM cloudsStormVM = new CloudsStormVM();
// cloudsStormVM.setName("Node1");
//
// vms.add(cloudsStormVM);
return cloudsStormSubTopologies; return cloudsStormSubTopologies;
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package nl.uva.sne.drip.provisioner; package nl.uva.sne.drip.provisioner;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import com.jcraft.jsch.JSchException; import com.jcraft.jsch.JSchException;
...@@ -28,6 +29,7 @@ import java.io.IOException; ...@@ -28,6 +29,7 @@ import java.io.IOException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import nl.uva.sne.drip.commons.sure_tosca.client.ApiException;
import nl.uva.sne.drip.model.Message; import nl.uva.sne.drip.model.Message;
import nl.uva.sne.drip.model.ToscaTemplate; import nl.uva.sne.drip.model.ToscaTemplate;
...@@ -43,9 +45,11 @@ public class Consumer extends DefaultConsumer { ...@@ -43,9 +45,11 @@ public class Consumer extends DefaultConsumer {
private final Channel channel; private final Channel channel;
private final Logger logger; private final Logger logger;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final String sureToscaBasePath;
public Consumer(Channel channel) throws IOException, TimeoutException { public Consumer(Channel channel,String sureToscaBasePath) throws IOException, TimeoutException {
super(channel); super(channel);
this.sureToscaBasePath = sureToscaBasePath;
this.channel = channel; this.channel = channel;
logger = Logger.getLogger(Consumer.class.getName()); logger = Logger.getLogger(Consumer.class.getName());
this.objectMapper = new ObjectMapper(); this.objectMapper = new ObjectMapper();
...@@ -53,7 +57,7 @@ public class Consumer extends DefaultConsumer { ...@@ -53,7 +57,7 @@ public class Consumer extends DefaultConsumer {
} }
@Override @Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException, FileNotFoundException { public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException, FileNotFoundException, JsonProcessingException {
try { try {
//Create the reply properties which tells us where to reply, and which id to use. //Create the reply properties which tells us where to reply, and which id to use.
//No need to change anything here //No need to change anything here
...@@ -69,8 +73,8 @@ public class Consumer extends DefaultConsumer { ...@@ -69,8 +73,8 @@ public class Consumer extends DefaultConsumer {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
} }
CloudStormService service = new CloudStormService(); CloudStormService service = new CloudStormService(sureToscaBasePath,message.getToscaTemplate());
ToscaTemplate toscaTemplate = service.execute(message.getToscaTemplate()); ToscaTemplate toscaTemplate = service.execute();
Message responceMessage = new Message(); Message responceMessage = new Message();
responceMessage.setCreationDate(System.currentTimeMillis()); responceMessage.setCreationDate(System.currentTimeMillis());
...@@ -83,7 +87,7 @@ public class Consumer extends DefaultConsumer { ...@@ -83,7 +87,7 @@ public class Consumer extends DefaultConsumer {
//We send the response back. No need to change anything here //We send the response back. No need to change anything here
channel.basicPublish("", properties.getReplyTo(), replyProps, response.getBytes("UTF-8")); channel.basicPublish("", properties.getReplyTo(), replyProps, response.getBytes("UTF-8"));
channel.basicAck(envelope.getDeliveryTag(), false); channel.basicAck(envelope.getDeliveryTag(), false);
} catch (JSchException ex) { } catch (JSchException | ApiException ex) {
Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex);
} }
......
...@@ -70,7 +70,7 @@ public class RPCServer { ...@@ -70,7 +70,7 @@ public class RPCServer {
//We define the queue name //We define the queue name
channel.queueDeclare(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, false, false, null); channel.queueDeclare(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, false, false, null);
DefaultConsumer c; DefaultConsumer c;
c = new nl.uva.sne.drip.provisioner.Consumer(channel); c = new nl.uva.sne.drip.provisioner.Consumer(channel,prop.getProperty("sure-tosca.base.path"));
//Start listening for messages //Start listening for messages
channel.basicConsume(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, c); channel.basicConsume(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, c);
......
CloudsStormSubMembers:
type: "object"
properties:
vmName:
type: "string"
address:
type: "string"
CloudsStormSubnets:
type: "object"
properties:
name:
type: "string"
subnet:
type: "string"
netmask:
type: "string"
members:
type: array
items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubMembers.yml#/CloudsStormSubMembers'
...@@ -9,3 +9,8 @@ ...@@ -9,3 +9,8 @@
type: array type: array
items: items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubTopology.yml#/CloudsStormSubTopology' $ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubTopology.yml#/CloudsStormSubTopology'
subnets:
type: array
items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubnets.yml#/CloudsStormSubnets'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment