Commit 2a9b1fb1 authored by Spiros Koulouzis's avatar Spiros Koulouzis

merge VMmetainfo with cloudstormVM

parent 9a0cdb1a
...@@ -196,6 +196,12 @@ node_types: ...@@ -196,6 +196,12 @@ node_types:
type: string type: string
required: true required: true
default: "vm" default: "vm"
root_key_pair:
type: tosca.datatypes.ARTICONF.Credential
required: false
user_key_pair:
type: tosca.datatypes.ARTICONF.Credential
required: false
interfaces: interfaces:
Standard: Standard:
create: dumy.yaml create: dumy.yaml
......
...@@ -4,17 +4,20 @@ import java.util.Objects; ...@@ -4,17 +4,20 @@ import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*;
/** /**
* CloudsStormSubTopology * CloudsStormSubTopology
*/ */
@Validated @Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-01-12T17:15:38.998Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-01-12T17:21:29.940Z")
public class CloudsStormSubTopology { public class CloudsStormSubTopology {
...@@ -67,14 +70,16 @@ public class CloudsStormSubTopology { ...@@ -67,14 +70,16 @@ public class CloudsStormSubTopology {
@Valid @Valid
private Map<String, Object> logsInfo = null; private Map<String, Object> logsInfo = null;
@JsonProperty("subTopologyClass")
private String subTopologyClass = null;
@JsonProperty("sshKeyPairId")
private String sshKeyPairId = null;
@JsonProperty("scaledFrom") @JsonProperty("scaledFrom")
@Valid @Valid
private Map<String, Object> scaledFrom = null; private Map<String, Object> scaledFrom = null;
@JsonProperty("connections")
@Valid
private Map<String, Object> connections = null;
public CloudsStormSubTopology topology(String topology) { public CloudsStormSubTopology topology(String topology) {
this.topology = topology; this.topology = topology;
return this; return this;
...@@ -84,7 +89,7 @@ public class CloudsStormSubTopology { ...@@ -84,7 +89,7 @@ public class CloudsStormSubTopology {
* Get topology * Get topology
* *
* @return topology * @return topology
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -105,7 +110,7 @@ public class CloudsStormSubTopology { ...@@ -105,7 +110,7 @@ public class CloudsStormSubTopology {
* Get cloudProvider * Get cloudProvider
* *
* @return cloudProvider * @return cloudProvider
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -126,7 +131,7 @@ public class CloudsStormSubTopology { ...@@ -126,7 +131,7 @@ public class CloudsStormSubTopology {
* Get domain * Get domain
* *
* @return domain * @return domain
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -147,7 +152,7 @@ public class CloudsStormSubTopology { ...@@ -147,7 +152,7 @@ public class CloudsStormSubTopology {
* Get status * Get status
* *
* @return status * @return status
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -176,7 +181,7 @@ public class CloudsStormSubTopology { ...@@ -176,7 +181,7 @@ public class CloudsStormSubTopology {
* Get logsInfo * Get logsInfo
* *
* @return logsInfo * @return logsInfo
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -188,62 +193,75 @@ public class CloudsStormSubTopology { ...@@ -188,62 +193,75 @@ public class CloudsStormSubTopology {
this.logsInfo = logsInfo; this.logsInfo = logsInfo;
} }
public CloudsStormSubTopology scaledFrom(Map<String, Object> scaledFrom) { public CloudsStormSubTopology subTopologyClass(String subTopologyClass) {
this.scaledFrom = scaledFrom; this.subTopologyClass = subTopologyClass;
return this; return this;
} }
public CloudsStormSubTopology putScaledFromItem(String key, Object scaledFromItem) { /**
if (this.scaledFrom == null) { * Get subTopologyClass
this.scaledFrom = new HashMap<String, Object>(); *
} * @return subTopologyClass
this.scaledFrom.put(key, scaledFromItem); *
*/
@ApiModelProperty(value = "")
public String getSubTopologyClass() {
return subTopologyClass;
}
public void setSubTopologyClass(String subTopologyClass) {
this.subTopologyClass = subTopologyClass;
}
public CloudsStormSubTopology sshKeyPairId(String sshKeyPairId) {
this.sshKeyPairId = sshKeyPairId;
return this; return this;
} }
/** /**
* Get scaledFrom * Get sshKeyPairId
*
* @return sshKeyPairId
* *
* @return scaledFrom
*
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getScaledFrom() { public String getSshKeyPairId() {
return scaledFrom; return sshKeyPairId;
} }
public void setScaledFrom(Map<String, Object> scaledFrom) { public void setSshKeyPairId(String sshKeyPairId) {
this.scaledFrom = scaledFrom; this.sshKeyPairId = sshKeyPairId;
} }
public CloudsStormSubTopology connections(Map<String, Object> connections) { public CloudsStormSubTopology scaledFrom(Map<String, Object> scaledFrom) {
this.connections = connections; this.scaledFrom = scaledFrom;
return this; return this;
} }
public CloudsStormSubTopology putConnectionsItem(String key, Object connectionsItem) { public CloudsStormSubTopology putScaledFromItem(String key, Object scaledFromItem) {
if (this.connections == null) { if (this.scaledFrom == null) {
this.connections = new HashMap<String, Object>(); this.scaledFrom = new HashMap<String, Object>();
} }
this.connections.put(key, connectionsItem); this.scaledFrom.put(key, scaledFromItem);
return this; return this;
} }
/** /**
* Get connections * Get scaledFrom
*
* @return scaledFrom
* *
* @return connections
*
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getConnections() { public Map<String, Object> getScaledFrom() {
return connections; return scaledFrom;
} }
public void setConnections(Map<String, Object> connections) { public void setScaledFrom(Map<String, Object> scaledFrom) {
this.connections = connections; this.scaledFrom = scaledFrom;
} }
@Override @Override
...@@ -260,13 +278,14 @@ public class CloudsStormSubTopology { ...@@ -260,13 +278,14 @@ public class CloudsStormSubTopology {
&& Objects.equals(this.domain, cloudsStormSubTopology.domain) && Objects.equals(this.domain, cloudsStormSubTopology.domain)
&& Objects.equals(this.status, cloudsStormSubTopology.status) && Objects.equals(this.status, cloudsStormSubTopology.status)
&& Objects.equals(this.logsInfo, cloudsStormSubTopology.logsInfo) && Objects.equals(this.logsInfo, cloudsStormSubTopology.logsInfo)
&& Objects.equals(this.scaledFrom, cloudsStormSubTopology.scaledFrom) && Objects.equals(this.subTopologyClass, cloudsStormSubTopology.subTopologyClass)
&& Objects.equals(this.connections, cloudsStormSubTopology.connections); && Objects.equals(this.sshKeyPairId, cloudsStormSubTopology.sshKeyPairId)
&& Objects.equals(this.scaledFrom, cloudsStormSubTopology.scaledFrom);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(topology, cloudProvider, domain, status, logsInfo, scaledFrom, connections); return Objects.hash(topology, cloudProvider, domain, status, logsInfo, subTopologyClass, sshKeyPairId, scaledFrom);
} }
@Override @Override
...@@ -279,8 +298,9 @@ public class CloudsStormSubTopology { ...@@ -279,8 +298,9 @@ public class CloudsStormSubTopology {
sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); sb.append(" domain: ").append(toIndentedString(domain)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" logsInfo: ").append(toIndentedString(logsInfo)).append("\n"); sb.append(" logsInfo: ").append(toIndentedString(logsInfo)).append("\n");
sb.append(" subTopologyClass: ").append(toIndentedString(subTopologyClass)).append("\n");
sb.append(" sshKeyPairId: ").append(toIndentedString(sshKeyPairId)).append("\n");
sb.append(" scaledFrom: ").append(toIndentedString(scaledFrom)).append("\n"); sb.append(" scaledFrom: ").append(toIndentedString(scaledFrom)).append("\n");
sb.append(" connections: ").append(toIndentedString(connections)).append("\n");
sb.append("}"); sb.append("}");
return sb.toString(); return sb.toString();
} }
......
...@@ -10,6 +10,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology; ...@@ -10,6 +10,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubnets; import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubnets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
...@@ -20,162 +21,184 @@ import javax.validation.constraints.*; ...@@ -20,162 +21,184 @@ import javax.validation.constraints.*;
@Validated @Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-11T15:13:55.016Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-11T15:13:55.016Z")
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class CloudsStormTopTopology { public class CloudsStormTopTopology {
@JsonProperty("userName")
private String userName = null;
@JsonProperty("publicKeyPath")
private String publicKeyPath = null;
@JsonProperty("topologies") /**
@Valid * @return the connections
private List<CloudsStormSubTopology> topologies = null; */
public Map<String, Object> getConnections() {
return connections;
}
/**
* @param connections the connections to set
*/
public void setConnections(Map<String, Object> connections) {
this.connections = connections;
}
@JsonProperty("userName")
private String userName = null;
@JsonProperty("subnets") @JsonProperty("publicKeyPath")
@Valid private String publicKeyPath = null;
private List<CloudsStormSubnets> subnets = null;
public CloudsStormTopTopology userName(String userName) { @JsonProperty("topologies")
this.userName = userName; @Valid
return this; private List<CloudsStormSubTopology> topologies = null;
}
/** @JsonProperty("subnets")
* Get userName @Valid
* @return userName private List<CloudsStormSubnets> subnets = null;
**/
@ApiModelProperty(value = "")
@JsonProperty("connections")
@Valid
private Map<String, Object> connections = null;
public String getUserName() { public CloudsStormTopTopology userName(String userName) {
return userName; this.userName = userName;
} return this;
}
public void setUserName(String userName) { /**
this.userName = userName; * Get userName
} *
* @return userName
*
*/
@ApiModelProperty(value = "")
public CloudsStormTopTopology publicKeyPath(String publicKeyPath) { public String getUserName() {
this.publicKeyPath = publicKeyPath; return userName;
return this; }
}
public void setUserName(String userName) {
/** this.userName = userName;
* Get publicKeyPath }
* @return publicKeyPath
**/ public CloudsStormTopTopology publicKeyPath(String publicKeyPath) {
@ApiModelProperty(value = "") this.publicKeyPath = publicKeyPath;
return this;
}
public String getPublicKeyPath() {
return publicKeyPath; /**
} * Get publicKeyPath
*
public void setPublicKeyPath(String publicKeyPath) { * @return publicKeyPath
this.publicKeyPath = publicKeyPath; *
} */
@ApiModelProperty(value = "")
public CloudsStormTopTopology topologies(List<CloudsStormSubTopology> topologies) {
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;
}
/**
* Get topologies
* @return topologies
**/
@ApiModelProperty(value = "")
@Valid
public List<CloudsStormSubTopology> getTopologies() {
return topologies;
}
public void setTopologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies;
}
public CloudsStormTopTopology subnets(List<CloudsStormSubnets> subnets) {
this.subnets = subnets;
return this;
}
public CloudsStormTopTopology addSubnetsItem(CloudsStormSubnets subnetsItem) {
if (this.subnets == null) {
this.subnets = new ArrayList<CloudsStormSubnets>();
}
this.subnets.add(subnetsItem);
return this;
}
/**
* Get subnets
* @return subnets
**/
@ApiModelProperty(value = "")
@Valid
public List<CloudsStormSubnets> getSubnets() {
return subnets;
}
public void setSubnets(List<CloudsStormSubnets> subnets) {
this.subnets = subnets;
}
@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) &&
Objects.equals(this.subnets, cloudsStormTopTopology.subnets);
}
@Override
public int hashCode() {
return Objects.hash(userName, publicKeyPath, topologies, subnets);
}
@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(" subnets: ").append(toIndentedString(subnets)).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 String getPublicKeyPath() {
return publicKeyPath;
}
public void setPublicKeyPath(String publicKeyPath) {
this.publicKeyPath = publicKeyPath;
}
public CloudsStormTopTopology topologies(List<CloudsStormSubTopology> topologies) {
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;
}
/**
* Get topologies
*
* @return topologies
*
*/
@ApiModelProperty(value = "")
@Valid
public List<CloudsStormSubTopology> getTopologies() {
return topologies;
}
public void setTopologies(List<CloudsStormSubTopology> topologies) {
this.topologies = topologies;
}
public CloudsStormTopTopology subnets(List<CloudsStormSubnets> subnets) {
this.subnets = subnets;
return this;
}
public CloudsStormTopTopology addSubnetsItem(CloudsStormSubnets subnetsItem) {
if (this.subnets == null) {
this.subnets = new ArrayList<CloudsStormSubnets>();
}
this.subnets.add(subnetsItem);
return this;
}
/**
* Get subnets
*
* @return subnets
*
*/
@ApiModelProperty(value = "")
@Valid
public List<CloudsStormSubnets> getSubnets() {
return subnets;
}
public void setSubnets(List<CloudsStormSubnets> subnets) {
this.subnets = subnets;
}
@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)
&& Objects.equals(this.subnets, cloudsStormTopTopology.subnets);
}
@Override
public int hashCode() {
return Objects.hash(userName, publicKeyPath, topologies, subnets);
}
@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(" subnets: ").append(toIndentedString(subnets)).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 ");
}
}
...@@ -3,6 +3,8 @@ package nl.uva.sne.drip.model.cloud.storm; ...@@ -3,6 +3,8 @@ package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
/** /**
...@@ -13,6 +15,20 @@ import org.springframework.validation.annotation.Validated; ...@@ -13,6 +15,20 @@ import org.springframework.validation.annotation.Validated;
public class CloudsStormVM { public class CloudsStormVM {
/**
* @return the extraInfo
*/
public Map<String, Object> getExtraInfo() {
return extraInfo;
}
/**
* @param extraInfo the extraInfo to set
*/
public void setExtraInfo(Map<String, Object> extraInfo) {
this.extraInfo = extraInfo;
}
@JsonProperty("name") @JsonProperty("name")
private String name = null; private String name = null;
...@@ -28,6 +44,28 @@ public class CloudsStormVM { ...@@ -28,6 +44,28 @@ public class CloudsStormVM {
@JsonProperty("publicAddress") @JsonProperty("publicAddress")
private String publicAddress = null; private String publicAddress = null;
@JsonProperty("type")
private String type = null;
@JsonProperty("OS")
private String OS = null;
@JsonProperty("CPU")
private String CPU = null;
@JsonProperty("MEM")
private String MEM = null;
@JsonProperty("VMType")
private String VMType = null;
@JsonProperty("Price")
private String Price = null;
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
public CloudsStormVM name(String name) { public CloudsStormVM name(String name) {
this.name = name; this.name = name;
return this; return this;
...@@ -178,4 +216,20 @@ public class CloudsStormVM { ...@@ -178,4 +216,20 @@ public class CloudsStormVM {
} }
return o.toString().replace("\n", "\n "); return o.toString().replace("\n", "\n ");
} }
public String getCPU() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public String getMEM() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public String getVmType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public String getOS() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} }
...@@ -15,6 +15,11 @@ import javax.validation.Valid; ...@@ -15,6 +15,11 @@ import javax.validation.Valid;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-30T16:13:55.433Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-30T16:13:55.433Z")
public class CloudsStormVMs { public class CloudsStormVMs {
@JsonProperty("SEngineClass")
private String sEngineClass;
@JsonProperty("VMs") @JsonProperty("VMs")
@Valid @Valid
......
...@@ -36,7 +36,7 @@ public class DCMetaInfo { ...@@ -36,7 +36,7 @@ public class DCMetaInfo {
private String availability = null; private String availability = null;
@JsonProperty("VMMetaInfo") @JsonProperty("VMMetaInfo")
private List<VMMetaInfo> vmMetaInfo = null; private List<CloudsStormVM> vmMetaInfo = null;
@JsonProperty("extraInfo") @JsonProperty("extraInfo")
@Valid @Valid
...@@ -51,7 +51,7 @@ public class DCMetaInfo { ...@@ -51,7 +51,7 @@ public class DCMetaInfo {
* Get domain * Get domain
* *
* @return domain * @return domain
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -72,7 +72,7 @@ public class DCMetaInfo { ...@@ -72,7 +72,7 @@ public class DCMetaInfo {
* Get endpoint * Get endpoint
* *
* @return endpoint * @return endpoint
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -93,7 +93,7 @@ public class DCMetaInfo { ...@@ -93,7 +93,7 @@ public class DCMetaInfo {
* Get country * Get country
* *
* @return country * @return country
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -114,7 +114,7 @@ public class DCMetaInfo { ...@@ -114,7 +114,7 @@ public class DCMetaInfo {
* Get longitude * Get longitude
* *
* @return longitude * @return longitude
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -135,7 +135,7 @@ public class DCMetaInfo { ...@@ -135,7 +135,7 @@ public class DCMetaInfo {
* Get latitude * Get latitude
* *
* @return latitude * @return latitude
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -156,7 +156,7 @@ public class DCMetaInfo { ...@@ -156,7 +156,7 @@ public class DCMetaInfo {
* Get availability * Get availability
* *
* @return availability * @return availability
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -168,7 +168,7 @@ public class DCMetaInfo { ...@@ -168,7 +168,7 @@ public class DCMetaInfo {
this.availability = availability; this.availability = availability;
} }
public DCMetaInfo vmMetaInfo(List<VMMetaInfo> vmMetaInfo) { public DCMetaInfo vmMetaInfo(List<CloudsStormVM> vmMetaInfo) {
this.vmMetaInfo = vmMetaInfo; this.vmMetaInfo = vmMetaInfo;
return this; return this;
} }
...@@ -177,17 +177,17 @@ public class DCMetaInfo { ...@@ -177,17 +177,17 @@ public class DCMetaInfo {
* Get vmMetaInfo * Get vmMetaInfo
* *
* @return vmMetaInfo * @return vmMetaInfo
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Valid @Valid
public List<VMMetaInfo> getVmMetaInfo() { public List<CloudsStormVM> getVmMetaInfo() {
return vmMetaInfo; return vmMetaInfo;
} }
public void setVmMetaInfo(List<VMMetaInfo> vmMetaInfo) { public void setVmMetaInfo(List<CloudsStormVM> vmMetaInfo) {
this.vmMetaInfo = vmMetaInfo; this.vmMetaInfo = vmMetaInfo;
} }
...@@ -208,7 +208,7 @@ public class DCMetaInfo { ...@@ -208,7 +208,7 @@ public class DCMetaInfo {
* Get extraInfo * Get extraInfo
* *
* @return extraInfo * @return extraInfo
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
/**
* VMMetaInfo
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-11T15:13:55.016Z")
public class VMMetaInfo {
/**
* @return the vmType
*/
public String getVmType() {
return vmType;
}
/**
* @param vmType the vmType to set
*/
public void setVmType(String vmType) {
this.vmType = vmType;
}
@JsonProperty("OS")
private String OS = null;
@JsonProperty("VMType")
private String vmType = null;
@JsonProperty("CPU")
private String CPU = null;
@JsonProperty("MEM")
private String MEM = null;
@JsonProperty("Price")
private String price = null;
@JsonProperty("DefaultSSHAccount")
private String defaultSSHAccount = null;
@JsonProperty("availability")
private String availability = null;
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
public VMMetaInfo OS(String OS) {
this.OS = OS;
return this;
}
/**
* Get OS
*
* @return OS
*
*/
@ApiModelProperty(value = "")
public String getOS() {
return OS;
}
public void setOS(String OS) {
this.OS = OS;
}
public VMMetaInfo CPU(String CPU) {
this.CPU = CPU;
return this;
}
/**
* Get CPU
*
* @return CPU
*
*/
@ApiModelProperty(value = "")
public String getCPU() {
return CPU;
}
public void setCPU(String CPU) {
this.CPU = CPU;
}
public VMMetaInfo MEM(String MEM) {
this.MEM = MEM;
return this;
}
/**
* Get MEM
*
* @return MEM
*
*/
@ApiModelProperty(value = "")
public String getMEM() {
return MEM;
}
public void setMEM(String MEM) {
this.MEM = MEM;
}
public VMMetaInfo price(String price) {
this.price = price;
return this;
}
/**
* Get price
*
* @return price
*
*/
@ApiModelProperty(value = "")
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public VMMetaInfo defaultSSHAccount(String defaultSSHAccount) {
this.defaultSSHAccount = defaultSSHAccount;
return this;
}
/**
* Get defaultSSHAccount
*
* @return defaultSSHAccount
*
*/
@ApiModelProperty(value = "")
public String getDefaultSSHAccount() {
return defaultSSHAccount;
}
public void setDefaultSSHAccount(String defaultSSHAccount) {
this.defaultSSHAccount = defaultSSHAccount;
}
public VMMetaInfo availability(String availability) {
this.availability = availability;
return this;
}
/**
* Get availability
*
* @return availability
*
*/
@ApiModelProperty(value = "")
public String getAvailability() {
return availability;
}
public void setAvailability(String availability) {
this.availability = availability;
}
public VMMetaInfo extraInfo(Map<String, Object> extraInfo) {
this.extraInfo = extraInfo;
return this;
}
public VMMetaInfo putExtraInfoItem(String key, Object extraInfoItem) {
if (this.extraInfo == null) {
this.extraInfo = new HashMap<String, Object>();
}
this.extraInfo.put(key, extraInfoItem);
return this;
}
/**
* Get extraInfo
*
* @return extraInfo
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getExtraInfo() {
return extraInfo;
}
public void setExtraInfo(Map<String, Object> extraInfo) {
this.extraInfo = extraInfo;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
VMMetaInfo vmMetaInfo = (VMMetaInfo) o;
return Objects.equals(this.OS, vmMetaInfo.OS)
&& Objects.equals(this.CPU, vmMetaInfo.CPU)
&& Objects.equals(this.MEM, vmMetaInfo.MEM)
&& Objects.equals(this.price, vmMetaInfo.price)
&& Objects.equals(this.defaultSSHAccount, vmMetaInfo.defaultSSHAccount)
&& Objects.equals(this.availability, vmMetaInfo.availability)
&& Objects.equals(this.extraInfo, vmMetaInfo.extraInfo);
}
@Override
public int hashCode() {
return Objects.hash(OS, CPU, MEM, price, defaultSSHAccount, availability, extraInfo);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class VMMetaInfo {\n");
sb.append(" OS: ").append(toIndentedString(OS)).append("\n");
sb.append(" CPU: ").append(toIndentedString(CPU)).append("\n");
sb.append(" MEM: ").append(toIndentedString(MEM)).append("\n");
sb.append(" price: ").append(toIndentedString(price)).append("\n");
sb.append(" defaultSSHAccount: ").append(toIndentedString(defaultSSHAccount)).append("\n");
sb.append(" availability: ").append(toIndentedString(availability)).append("\n");
sb.append(" extraInfo: ").append(toIndentedString(extraInfo)).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 ");
}
}
...@@ -14,13 +14,10 @@ import java.io.File; ...@@ -14,13 +14,10 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.model.cloud.storm.CloudDB; import nl.uva.sne.drip.model.cloud.storm.CloudDB;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormVM;
import nl.uva.sne.drip.model.cloud.storm.DB; import nl.uva.sne.drip.model.cloud.storm.DB;
import nl.uva.sne.drip.model.cloud.storm.DBInfo; import nl.uva.sne.drip.model.cloud.storm.DBInfo;
import nl.uva.sne.drip.model.cloud.storm.DCMetaInfo;
import nl.uva.sne.drip.model.cloud.storm.VMMetaInfo;
/** /**
* *
...@@ -38,7 +35,7 @@ class CloudStormDAO { ...@@ -38,7 +35,7 @@ class CloudStormDAO {
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
} }
List<VMMetaInfo> findVmMetaInfoByProvider(CloudDB.CloudProviderEnum provider) throws IOException { List<CloudsStormVM> findVmMetaInfoByProvider(CloudDB.CloudProviderEnum provider) throws IOException {
DB db = objectMapper.readValue(new File(cloudStormDBPath + File.separator + "db.yml"), DB.class); DB db = objectMapper.readValue(new File(cloudStormDBPath + File.separator + "db.yml"), DB.class);
List<CloudDB> cloudDBs = db.getCloudDBs(); List<CloudDB> cloudDBs = db.getCloudDBs();
...@@ -52,10 +49,10 @@ class CloudStormDAO { ...@@ -52,10 +49,10 @@ class CloudStormDAO {
} }
if (targetCloudDB != null) { if (targetCloudDB != null) {
List<VMMetaInfo> vMMetaInfos = new ArrayList<>(); List<CloudsStormVM> vMMetaInfos = new ArrayList<>();
DBInfo dbInfo = objectMapper.readValue(new File(cloudStormDBPath + File.separator + targetCloudDB.getDbInfoFile()), DBInfo.class); DBInfo dbInfo = objectMapper.readValue(new File(cloudStormDBPath + File.separator + targetCloudDB.getDbInfoFile()), DBInfo.class);
List<DCMetaInfo> metaInfos = dbInfo.getDcMetaInfo(); List<CloudsStormVM> metaInfos = dbInfo.getDcMetaInfo();
for (DCMetaInfo metaInfo : metaInfos) { for (CloudsStormVM metaInfo : metaInfos) {
vMMetaInfos.addAll(metaInfo.getVmMetaInfo()); vMMetaInfos.addAll(metaInfo.getVmMetaInfo());
} }
return vMMetaInfos; return vMMetaInfos;
......
...@@ -40,7 +40,6 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormVMs; ...@@ -40,7 +40,6 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormVMs;
import nl.uva.sne.drip.model.cloud.storm.CredentialInfo; import nl.uva.sne.drip.model.cloud.storm.CredentialInfo;
import nl.uva.sne.drip.model.cloud.storm.InfrasCode; import nl.uva.sne.drip.model.cloud.storm.InfrasCode;
import nl.uva.sne.drip.model.cloud.storm.OpCode; import nl.uva.sne.drip.model.cloud.storm.OpCode;
import nl.uva.sne.drip.model.cloud.storm.VMMetaInfo;
import nl.uva.sne.drip.model.tosca.Credential; import nl.uva.sne.drip.model.tosca.Credential;
import nl.uva.sne.drip.model.tosca.ToscaTemplate; import nl.uva.sne.drip.model.tosca.ToscaTemplate;
import nl.uva.sne.drip.sure.tosca.client.ApiException; import nl.uva.sne.drip.sure.tosca.client.ApiException;
...@@ -68,6 +67,9 @@ class CloudStormService { ...@@ -68,6 +67,9 @@ class CloudStormService {
private final String APP_FOLDER_NAME = "App"; private final String APP_FOLDER_NAME = "App";
private final String TOP_TOPOLOGY_FILE_NAME = "_top.yml"; private final String TOP_TOPOLOGY_FILE_NAME = "_top.yml";
private final String TOPOLOGY_RELATIVE_PATH = File.separator
+ INFS_FOLDER_NAME + File.separator + TOPOLOGY_FOLDER_NAME + File.separator;
CloudStormService(Properties properties, ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException { CloudStormService(Properties properties, ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException {
// this.toscaTemplate = toscaTemplate; // this.toscaTemplate = toscaTemplate;
cloudStormDBPath = properties.getProperty("cloud.storm.db.path"); cloudStormDBPath = properties.getProperty("cloud.storm.db.path");
...@@ -87,7 +89,7 @@ class CloudStormService { ...@@ -87,7 +89,7 @@ class CloudStormService {
if (!(tempInputDir.mkdirs())) { if (!(tempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
} }
String topologyTempInputDirPath = tempInputDirPath + File.separator + INFS_FOLDER_NAME + File.separator + TOPOLOGY_FOLDER_NAME; String topologyTempInputDirPath = tempInputDirPath + TOPOLOGY_RELATIVE_PATH;
File topologyTempInputDir = new File(topologyTempInputDirPath); File topologyTempInputDir = new File(topologyTempInputDirPath);
if (!(topologyTempInputDir.mkdirs())) { if (!(topologyTempInputDir.mkdirs())) {
...@@ -194,11 +196,12 @@ class CloudStormService { ...@@ -194,11 +196,12 @@ class CloudStormService {
Double memSize = helper.getVMNMemSize(vmMap); Double memSize = helper.getVMNMemSize(vmMap);
String os = helper.getVMNOS(vmMap); String os = helper.getVMNOS(vmMap);
List<VMMetaInfo> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider)); List<CloudsStormVM> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider));
for (VMMetaInfo vmInfo : vmInfos) { for (CloudsStormVM vmInfo : vmInfos) {
Logger.getLogger(CloudStormService.class.getName()).log(Level.FINE, "vmInfo: {0}", vmInfo); Logger.getLogger(CloudStormService.class.getName()).log(Level.FINE, "vmInfo: {0}", vmInfo);
Logger.getLogger(CloudStormService.class.getName()).log(Level.FINE, "numOfCores:{0} memSize: {1} os: {2}", new Object[]{numOfCores, memSize, os}); Logger.getLogger(CloudStormService.class.getName()).log(Level.FINE, "numOfCores:{0} memSize: {1} os: {2}", new Object[]{numOfCores, memSize, os});
if (Objects.equals(numOfCores, Double.valueOf(vmInfo.getCPU())) && Objects.equals(memSize, Double.valueOf(vmInfo.getMEM())) && os.toLowerCase().equals(vmInfo.getOS().toLowerCase())) { if (Objects.equals(numOfCores, Double.valueOf(vmInfo.getCPU())) &&
Objects.equals(memSize, Double.valueOf(vmInfo.getMEM())) && os.toLowerCase().equals(vmInfo.getOS().toLowerCase())) {
return vmInfo.getVmType(); return vmInfo.getVmType();
} }
} }
...@@ -284,12 +287,55 @@ class CloudStormService { ...@@ -284,12 +287,55 @@ class CloudStormService {
// standalone.MainAsTool.main(args); // standalone.MainAsTool.main(args);
tempInputDirPath = "/tmp/Input-87672007429577"; tempInputDirPath = "/tmp/Input-87672007429577";
CloudsStormTopTopology _top = objectMapper.readValue(new File(tempInputDirPath CloudsStormTopTopology _top = objectMapper.readValue(new File(tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ File.separator + INFS_FOLDER_NAME + File.separator + TOP_TOPOLOGY_FILE_NAME),
+ TOPOLOGY_FOLDER_NAME + File.separator + TOP_TOPOLOGY_FILE_NAME),
CloudsStormTopTopology.class); CloudsStormTopTopology.class);
List<CloudsStormSubTopology> subTopologies = _top.getTopologies(); List<CloudsStormSubTopology> subTopologies = _top.getTopologies();
List<NodeTemplateMap> vmTopologiesMaps = helper.getVMTopologyTemplates();
int i = 0;
for (CloudsStormSubTopology subTopology : subTopologies) {
NodeTemplateMap nodeTemplateMap = vmTopologiesMaps.get(i);
Map<String, Object> att = nodeTemplateMap.getNodeTemplate().getAttributes();
if (att == null) {
att = new HashMap<>();
}
att.put("status", subTopology.getStatus().toString());
CloudsStormVMs cloudsStormVMs = objectMapper.readValue(new File(tempInputDirPath + TOPOLOGY_RELATIVE_PATH + File.separator + subTopology.getTopology()),
CloudsStormVMs.class);
List<CloudsStormVM> vms = cloudsStormVMs.getVms();
List<NodeTemplateMap> vmTemplatesMap = helper.getTemplateVMsForVMTopology(nodeTemplateMap);
int j = 0;
for (CloudsStormVM vm : vms) {
NodeTemplateMap vmTemplateMap = vmTemplatesMap.get(j);
Map<String, Object> vmAttributes = vmTemplateMap.getNodeTemplate().getAttributes();
if (vmAttributes==null){
vmAttributes = new HashMap<>();
}
vmAttributes.put("private_ip", vm.get);
}
String rootKeyPairFolder = tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ TOP_TOPOLOGY_FILE_NAME + File.separator + subTopology.getSshKeyPairId();
Credential rootKeyPairCredential = new Credential();
rootKeyPairCredential.setProtocol("ssh");
Map<String, String> keys = new HashMap<>();
keys.put("private_key", Converter.encodeFileToBase64Binary(rootKeyPairFolder + File.separator + "id_rsa"));
keys.put("public_key", Converter.encodeFileToBase64Binary(rootKeyPairFolder + File.separator + "id_rsa.pub"));
rootKeyPairCredential.setKeys(keys);
String userKyePairFolder = tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ TOP_TOPOLOGY_FILE_NAME;
Credential userKeyPairCredential = new Credential();
rootKeyPairCredential.setProtocol("ssh");
keys = new HashMap<>();
keys.put("private_key", Converter.encodeFileToBase64Binary(userKyePairFolder + File.separator + "id_rsa"));
keys.put("public_key", Converter.encodeFileToBase64Binary(userKyePairFolder + File.separator + "id_rsa.pub"));
userKeyPairCredential.setKeys(keys);
}
return null; return null;
} }
......
...@@ -23,8 +23,4 @@ ...@@ -23,8 +23,4 @@
scaledFrom: scaledFrom:
type: object type: object
additionalProperties: additionalProperties:
type: object type: object
connections:
type: object
additionalProperties:
type: object
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
type: "string" type: "string"
publicKeyPath: publicKeyPath:
type: "string" type: "string"
connections:
type: object
additionalProperties:
type: object
topologies: topologies:
type: array type: array
items: items:
......
...@@ -11,3 +11,25 @@ ...@@ -11,3 +11,25 @@
type: "string" type: "string"
publicAddress: publicAddress:
type: "string" type: "string"
type:
type: "string"
extraInfo:
type: object
additionalProperties:
type: object
OS:
type: "string"
CPU:
type: "string"
MEM:
type: "string"
VMType:
type: "string"
Price:
type: "string"
DefaultSSHAccount:
type: "string"
availability:
type: "string"
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
VMMetaInfo: VMMetaInfo:
type: "array" type: "array"
items: items:
$ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/VMMetaInfo.yml#/VMMetaInfo" $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/CloudsStormVM.yml#/CloudsStormVM"
extraInfo: extraInfo:
type: object type: object
additionalProperties: additionalProperties:
......
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