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

added subnets

parent 01605b7e
......@@ -161,7 +161,7 @@
<goal>generate</goal>
</goals>
<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>
<output>${project.build.directory}/generated-sources</output>
<apiPackage>${default.package}.handler</apiPackage>
......
......@@ -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.Configuration;
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 org.apache.commons.io.FileUtils;
......@@ -72,11 +73,16 @@ public class ToscaHelper {
for (String type : toscaInterfaceTypes) {
String derivedFrom = null;
List<Map<String, Object>> interfaces = api.getTypes(String.valueOf(id), "interface_types", null, type, null, null, null, null, null, derivedFrom);
interfaceDefinitions.addAll(interfaces);
}
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,88 +16,145 @@
package nl.uva.sne.drip.model;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author S. Koulouzis
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-12-09T16:00:08.961312+01:00[Europe/Amsterdam]")
public class CloudsStormSubTopology {
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-12-09T15:55:39.959Z[GMT]")
public class CloudsStormSubTopology {
@JsonProperty("topology")
private String topology = null;
public static final String SERIALIZED_NAME_VMS = "VMs";
@SerializedName(SERIALIZED_NAME_VMS)
private List<CloudsStormVM> vms = null;
@JsonProperty("cloudProvider")
private String cloudProvider = null;
public CloudsStormSubTopology vms(List<CloudsStormVM> vms) {
@JsonProperty("domain")
private String domain = null;
this.vms = vms;
return this;
}
@JsonProperty("status")
private String status = null;
public CloudsStormSubTopology addVmsItem(CloudsStormVM vmsItem) {
if (this.vms == null) {
this.vms = new ArrayList<CloudsStormVM>();
}
this.vms.add(vmsItem);
return this;
}
public CloudsStormSubTopology topology(String topology) {
this.topology = topology;
return this;
}
/**
* Get vms
*
* @return vms
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public List<CloudsStormVM> getVms() {
return vms;
}
/**
* Get topology
* @return topology
**/
@ApiModelProperty(value = "")
public String getTopology() {
return topology;
}
public void setVms(List<CloudsStormVM> vms) {
this.vms = vms;
}
public void setTopology(String topology) {
this.topology = topology;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CloudsStormSubTopology cloudsStormSubTopology = (CloudsStormSubTopology) o;
return Objects.equals(this.vms, cloudsStormSubTopology.vms);
}
public CloudsStormSubTopology cloudProvider(String cloudProvider) {
this.cloudProvider = cloudProvider;
return this;
}
@Override
public int hashCode() {
return Objects.hash(vms);
}
/**
* Get cloudProvider
* @return cloudProvider
**/
@ApiModelProperty(value = "")
public String getCloudProvider() {
return cloudProvider;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormSubTopology {\n");
sb.append(" vms: ").append(toIndentedString(vms)).append("\n");
sb.append("}");
return sb.toString();
}
public void setCloudProvider(String cloudProvider) {
this.cloudProvider = cloudProvider;
}
public CloudsStormSubTopology domain(String domain) {
this.domain = domain;
return this;
}
/**
* Get domain
* @return domain
**/
@ApiModelProperty(value = "")
public String getDomain() {
return domain;
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
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
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CloudsStormSubTopology cloudsStormSubTopology = (CloudsStormSubTopology) o;
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
public int hashCode() {
return Objects.hash(topology, cloudProvider, domain, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormSubTopology {\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("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
......@@ -25,137 +25,138 @@ import java.util.List;
*
* @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 static final String SERIALIZED_NAME_USER_NAME = "userName";
@SerializedName(SERIALIZED_NAME_USER_NAME)
private String userName;
public static final String SERIALIZED_NAME_USER_NAME = "userName";
@SerializedName(SERIALIZED_NAME_USER_NAME)
private String userName;
public static final String SERIALIZED_NAME_PUBLIC_KEY_PATH = "publicKeyPath";
@SerializedName(SERIALIZED_NAME_PUBLIC_KEY_PATH)
private String publicKeyPath;
public static final String SERIALIZED_NAME_PUBLIC_KEY_PATH = "publicKeyPath";
@SerializedName(SERIALIZED_NAME_PUBLIC_KEY_PATH)
private String publicKeyPath;
public static final String SERIALIZED_NAME_TOPOLOGIES = "topologies";
@SerializedName(SERIALIZED_NAME_TOPOLOGIES)
private List<CloudsStormSubTopology> topologies = null;
public static final String SERIALIZED_NAME_TOPOLOGIES = "topologies";
@SerializedName(SERIALIZED_NAME_TOPOLOGIES)
private List<CloudsStormSubTopology> topologies = null;
public CloudsStormTopTopology userName(String userName) {
public CloudsStormTopTopology userName(String userName) {
this.userName = userName;
return this;
}
this.userName = userName;
return this;
}
/**
* Get userName
* @return userName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
/**
* Get userName
*
* @return userName
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getUserName() {
return userName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public CloudsStormTopTopology publicKeyPath(String publicKeyPath) {
public void setUserName(String userName) {
this.userName = userName;
}
this.publicKeyPath = publicKeyPath;
return this;
}
/**
* Get publicKeyPath
*
* @return publicKeyPath
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPublicKeyPath() {
return publicKeyPath;
}
public CloudsStormTopTopology publicKeyPath(String publicKeyPath) {
this.publicKeyPath = publicKeyPath;
return this;
}
public void setPublicKeyPath(String publicKeyPath) {
this.publicKeyPath = publicKeyPath;
}
/**
* Get publicKeyPath
* @return publicKeyPath
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public CloudsStormTopTopology topologies(List<CloudsStormSubTopology> topologies) {
public String getPublicKeyPath() {
return publicKeyPath;
}
this.topologies = topologies;
return this;
}
public CloudsStormTopTopology addTopologiesItem(CloudsStormSubTopology topologiesItem) {
if (this.topologies == null) {
this.topologies = new ArrayList<CloudsStormSubTopology>();
}
this.topologies.add(topologiesItem);
return this;
}
public void setPublicKeyPath(String publicKeyPath) {
this.publicKeyPath = publicKeyPath;
}
/**
* Get topologies
*
* @return topologies
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public List<CloudsStormSubTopology> getTopologies() {
return topologies;
}
public void setTopologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies;
}
public CloudsStormTopTopology topologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CloudsStormTopTopology cloudsStormTopTopology = (CloudsStormTopTopology) o;
return Objects.equals(this.userName, cloudsStormTopTopology.userName)
&& Objects.equals(this.publicKeyPath, cloudsStormTopTopology.publicKeyPath)
&& Objects.equals(this.topologies, cloudsStormTopTopology.topologies);
public CloudsStormTopTopology addTopologiesItem(CloudsStormSubTopology topologiesItem) {
if (this.topologies == null) {
this.topologies = new ArrayList<CloudsStormSubTopology>();
}
this.topologies.add(topologiesItem);
return this;
}
@Override
public int hashCode() {
return Objects.hash(userName, publicKeyPath, topologies);
}
/**
* Get topologies
* @return topologies
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public List<CloudsStormSubTopology> getTopologies() {
return topologies;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormTopTopology {\n");
sb.append(" userName: ").append(toIndentedString(userName)).append("\n");
sb.append(" publicKeyPath: ").append(toIndentedString(publicKeyPath)).append("\n");
sb.append(" topologies: ").append(toIndentedString(topologies)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
public void setTopologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CloudsStormTopTopology cloudsStormTopTopology = (CloudsStormTopTopology) o;
return Objects.equals(this.userName, cloudsStormTopTopology.userName) &&
Objects.equals(this.publicKeyPath, cloudsStormTopTopology.publicKeyPath) &&
Objects.equals(this.topologies, cloudsStormTopTopology.topologies);
}
@Override
public int hashCode() {
return Objects.hash(userName, publicKeyPath, topologies);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormTopTopology {\n");
sb.append(" userName: ").append(toIndentedString(userName)).append("\n");
sb.append(" publicKeyPath: ").append(toIndentedString(publicKeyPath)).append("\n");
sb.append(" topologies: ").append(toIndentedString(topologies)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
}
\ No newline at end of file
......@@ -23,187 +23,189 @@ import io.swagger.annotations.ApiModelProperty;
*
* @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 static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_NODE_TYPE = "nodeType";
@SerializedName(SERIALIZED_NAME_NODE_TYPE)
private String nodeType;
public static final String SERIALIZED_NAME_NODE_TYPE = "nodeType";
@SerializedName(SERIALIZED_NAME_NODE_TYPE)
private String nodeType;
public static final String SERIALIZED_NAME_OS_TYPE = "OSType";
@SerializedName(SERIALIZED_NAME_OS_TYPE)
private String osType;
public static final String SERIALIZED_NAME_OS_TYPE = "OSType";
@SerializedName(SERIALIZED_NAME_OS_TYPE)
private String osType;
public static final String SERIALIZED_NAME_SCRIPT = "script";
@SerializedName(SERIALIZED_NAME_SCRIPT)
private String script;
public static final String SERIALIZED_NAME_SCRIPT = "script";
@SerializedName(SERIALIZED_NAME_SCRIPT)
private String script;
public static final String SERIALIZED_NAME_PUBLIC_ADDRESS = "publicAddress";
@SerializedName(SERIALIZED_NAME_PUBLIC_ADDRESS)
private String publicAddress;
public static final String SERIALIZED_NAME_PUBLIC_ADDRESS = "publicAddress";
@SerializedName(SERIALIZED_NAME_PUBLIC_ADDRESS)
private String publicAddress;
public CloudsStormVM name(String name) {
public CloudsStormVM name(String name) {
this.name = name;
return this;
}
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
/**
* Get name
*
* @return name
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CloudsStormVM nodeType(String nodeType) {
public void setName(String name) {
this.name = name;
}
this.nodeType = nodeType;
return this;
}
/**
* Get nodeType
*
* @return nodeType
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getNodeType() {
return nodeType;
}
public void setNodeType(String nodeType) {
this.nodeType = nodeType;
}
public CloudsStormVM nodeType(String nodeType) {
this.nodeType = nodeType;
return this;
}
public CloudsStormVM osType(String osType) {
/**
* Get nodeType
* @return nodeType
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
this.osType = osType;
return this;
}
public String getNodeType() {
return nodeType;
}
/**
* Get osType
*
* @return osType
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getOsType() {
return osType;
}
public void setOsType(String osType) {
this.osType = osType;
}
public void setNodeType(String nodeType) {
this.nodeType = nodeType;
}
public CloudsStormVM script(String script) {
this.script = script;
return this;
}
public CloudsStormVM osType(String osType) {
this.osType = osType;
return this;
}
/**
* Get osType
* @return osType
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getOsType() {
return osType;
}
public void setOsType(String osType) {
this.osType = osType;
}
public CloudsStormVM script(String script) {
this.script = script;
return this;
}
/**
* Get script
* @return script
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getScript() {
return script;
}
/**
* Get script
*
* @return script
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getScript() {
return script;
}
public void setScript(String script) {
this.script = script;
}
public CloudsStormVM publicAddress(String publicAddress) {
this.publicAddress = publicAddress;
return this;
}
/**
* Get publicAddress
* @return publicAddress
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPublicAddress() {
return publicAddress;
}
public void setPublicAddress(String publicAddress) {
this.publicAddress = publicAddress;
}
public void setScript(String script) {
this.script = script;
}
public CloudsStormVM publicAddress(String publicAddress) {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CloudsStormVM cloudsStormVM = (CloudsStormVM) o;
return Objects.equals(this.name, cloudsStormVM.name) &&
Objects.equals(this.nodeType, cloudsStormVM.nodeType) &&
Objects.equals(this.osType, cloudsStormVM.osType) &&
Objects.equals(this.script, cloudsStormVM.script) &&
Objects.equals(this.publicAddress, cloudsStormVM.publicAddress);
}
@Override
public int hashCode() {
return Objects.hash(name, nodeType, osType, script, publicAddress);
}
this.publicAddress = publicAddress;
return this;
}
/**
* Get publicAddress
*
* @return publicAddress
*
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPublicAddress() {
return publicAddress;
}
public void setPublicAddress(String publicAddress) {
this.publicAddress = publicAddress;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CloudsStormVM cloudsStormVM = (CloudsStormVM) o;
return Objects.equals(this.name, cloudsStormVM.name)
&& Objects.equals(this.nodeType, cloudsStormVM.nodeType)
&& Objects.equals(this.osType, cloudsStormVM.osType)
&& Objects.equals(this.script, cloudsStormVM.script)
&& Objects.equals(this.publicAddress, cloudsStormVM.publicAddress);
}
@Override
public int hashCode() {
return Objects.hash(name, nodeType, osType, script, publicAddress);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormVM {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" nodeType: ").append(toIndentedString(nodeType)).append("\n");
sb.append(" osType: ").append(toIndentedString(osType)).append("\n");
sb.append(" script: ").append(toIndentedString(script)).append("\n");
sb.append(" publicAddress: ").append(toIndentedString(publicAddress)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CloudsStormVM {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" nodeType: ").append(toIndentedString(nodeType)).append("\n");
sb.append(" osType: ").append(toIndentedString(osType)).append("\n");
sb.append(" script: ").append(toIndentedString(script)).append("\n");
sb.append(" publicAddress: ").append(toIndentedString(publicAddress)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
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 @@
<project version="4">
<component name="ChangeListManager">
<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$/../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>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -29,7 +36,7 @@
</component>
<component name="PropertiesComponent">
<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" />
</component>
<component name="RecentsManager">
......@@ -242,10 +249,10 @@
<screen x="67" y="34" width="2493" height="1406" />
</state>
<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" />
</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">
<screen x="67" y="34" width="2493" height="1406" />
</state>
......@@ -282,10 +289,10 @@
<screen x="67" y="34" width="2493" height="1406" />
</state>
<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" />
</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 name="XDebuggerManager">
<breakpoint-manager>
......
......@@ -5,6 +5,7 @@
*/
package nl.uva.sne.drip.provisioner;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.KeyPair;
......@@ -15,9 +16,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
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.CloudsStormTopTopology;
import nl.uva.sne.drip.model.CloudsStormVM;
import nl.uva.sne.drip.model.NodeTemplate;
import nl.uva.sne.drip.model.ToscaTemplate;
import org.apache.commons.io.FilenameUtils;
......@@ -26,33 +30,41 @@ import org.apache.commons.io.FilenameUtils;
* @author S. Koulouzis
*/
class CloudStormService {
private List<Map.Entry> vmTopologies;
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;
File tempInputDir = new File(tempInputDirPath);
if (!(tempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
}
buildCloudStormTopTopology(toscaTemplate);
return toscaTemplate;
}
private CloudsStormTopTopology buildCloudStormTopTopology(ToscaTemplate toscaTemplate) throws JSchException, IOException {
CloudsStormTopTopology topTopology = new CloudsStormTopTopology();
String publicKeyPath = buildSSHKeyPair();
topTopology.setPublicKeyPath(publicKeyPath);
topTopology.setUserName(getUserName());
List<CloudsStormSubTopology> topologies = getCloudsStormSubTopologies(toscaTemplate);
topTopology.setTopologies(topologies);
return topTopology;
}
private String buildSSHKeyPair() throws JSchException, IOException {
String userPublicKeyName = "id_rsa.pub";
String publicKeyPath = "name@" + userPublicKeyName;
......@@ -64,24 +76,35 @@ class CloudStormService {
kpair.dispose();
return publicKeyPath;
}
private String getUserName() {
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<>();
CloudsStormSubTopology cloudsStormSubTopology = new CloudsStormSubTopology();
List<CloudsStormVM> vms = new ArrayList<>();
CloudsStormVM cloudsStormVM = new CloudsStormVM();
cloudsStormVM.setName("Node1");
for(NodeTemplate nodeTemplate: vmTopologyTemplates){
CloudsStormSubTopology cloudsStormSubTopology = new CloudsStormSubTopology();
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");
}
vms.add(cloudsStormVM);
cloudsStormSubTopology.setVms(vms);
cloudsStormSubTopology.
// List<CloudsStormVM> vms = new ArrayList<>();
// CloudsStormVM cloudsStormVM = new CloudsStormVM();
// cloudsStormVM.setName("Node1");
//
// vms.add(cloudsStormVM);
return cloudsStormSubTopologies;
}
}
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.provisioner;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.jcraft.jsch.JSchException;
......@@ -28,6 +29,7 @@ import java.io.IOException;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
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.ToscaTemplate;
......@@ -43,9 +45,11 @@ public class Consumer extends DefaultConsumer {
private final Channel channel;
private final Logger logger;
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);
this.sureToscaBasePath = sureToscaBasePath;
this.channel = channel;
logger = Logger.getLogger(Consumer.class.getName());
this.objectMapper = new ObjectMapper();
......@@ -53,7 +57,7 @@ public class Consumer extends DefaultConsumer {
}
@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 {
//Create the reply properties which tells us where to reply, and which id to use.
//No need to change anything here
......@@ -69,8 +73,8 @@ public class Consumer extends DefaultConsumer {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
}
CloudStormService service = new CloudStormService();
ToscaTemplate toscaTemplate = service.execute(message.getToscaTemplate());
CloudStormService service = new CloudStormService(sureToscaBasePath,message.getToscaTemplate());
ToscaTemplate toscaTemplate = service.execute();
Message responceMessage = new Message();
responceMessage.setCreationDate(System.currentTimeMillis());
......@@ -83,7 +87,7 @@ public class Consumer extends DefaultConsumer {
//We send the response back. No need to change anything here
channel.basicPublish("", properties.getReplyTo(), replyProps, response.getBytes("UTF-8"));
channel.basicAck(envelope.getDeliveryTag(), false);
} catch (JSchException ex) {
} catch (JSchException | ApiException ex) {
Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex);
}
......
......@@ -70,11 +70,11 @@ public class RPCServer {
//We define the queue name
channel.queueDeclare(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, false, false, null);
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
channel.basicConsume(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, c);
//Block so we don't close the channel
while (true) {
......
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 @@
type: array
items:
$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