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

merge VMmetainfo with cloudstormVM

parent 9a0cdb1a
......@@ -196,6 +196,12 @@ node_types:
type: string
required: true
default: "vm"
root_key_pair:
type: tosca.datatypes.ARTICONF.Credential
required: false
user_key_pair:
type: tosca.datatypes.ARTICONF.Credential
required: false
interfaces:
Standard:
create: dumy.yaml
......
......@@ -4,17 +4,20 @@ import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
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.*;
/**
* CloudsStormSubTopology
*/
@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 {
......@@ -67,14 +70,16 @@ public class CloudsStormSubTopology {
@Valid
private Map<String, Object> logsInfo = null;
@JsonProperty("subTopologyClass")
private String subTopologyClass = null;
@JsonProperty("sshKeyPairId")
private String sshKeyPairId = null;
@JsonProperty("scaledFrom")
@Valid
private Map<String, Object> scaledFrom = null;
@JsonProperty("connections")
@Valid
private Map<String, Object> connections = null;
public CloudsStormSubTopology topology(String topology) {
this.topology = topology;
return this;
......@@ -188,62 +193,75 @@ public class CloudsStormSubTopology {
this.logsInfo = logsInfo;
}
public CloudsStormSubTopology scaledFrom(Map<String, Object> scaledFrom) {
this.scaledFrom = scaledFrom;
public CloudsStormSubTopology subTopologyClass(String subTopologyClass) {
this.subTopologyClass = subTopologyClass;
return this;
}
public CloudsStormSubTopology putScaledFromItem(String key, Object scaledFromItem) {
if (this.scaledFrom == null) {
this.scaledFrom = new HashMap<String, Object>();
/**
* Get subTopologyClass
*
* @return subTopologyClass
*
*/
@ApiModelProperty(value = "")
public String getSubTopologyClass() {
return subTopologyClass;
}
this.scaledFrom.put(key, scaledFromItem);
public void setSubTopologyClass(String subTopologyClass) {
this.subTopologyClass = subTopologyClass;
}
public CloudsStormSubTopology sshKeyPairId(String sshKeyPairId) {
this.sshKeyPairId = sshKeyPairId;
return this;
}
/**
* Get scaledFrom
* Get sshKeyPairId
*
* @return scaledFrom
* @return sshKeyPairId
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getScaledFrom() {
return scaledFrom;
public String getSshKeyPairId() {
return sshKeyPairId;
}
public void setScaledFrom(Map<String, Object> scaledFrom) {
this.scaledFrom = scaledFrom;
public void setSshKeyPairId(String sshKeyPairId) {
this.sshKeyPairId = sshKeyPairId;
}
public CloudsStormSubTopology connections(Map<String, Object> connections) {
this.connections = connections;
public CloudsStormSubTopology scaledFrom(Map<String, Object> scaledFrom) {
this.scaledFrom = scaledFrom;
return this;
}
public CloudsStormSubTopology putConnectionsItem(String key, Object connectionsItem) {
if (this.connections == null) {
this.connections = new HashMap<String, Object>();
public CloudsStormSubTopology putScaledFromItem(String key, Object scaledFromItem) {
if (this.scaledFrom == null) {
this.scaledFrom = new HashMap<String, Object>();
}
this.connections.put(key, connectionsItem);
this.scaledFrom.put(key, scaledFromItem);
return this;
}
/**
* Get connections
* Get scaledFrom
*
* @return connections
* @return scaledFrom
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getConnections() {
return connections;
public Map<String, Object> getScaledFrom() {
return scaledFrom;
}
public void setConnections(Map<String, Object> connections) {
this.connections = connections;
public void setScaledFrom(Map<String, Object> scaledFrom) {
this.scaledFrom = scaledFrom;
}
@Override
......@@ -260,13 +278,14 @@ public class CloudsStormSubTopology {
&& Objects.equals(this.domain, cloudsStormSubTopology.domain)
&& Objects.equals(this.status, cloudsStormSubTopology.status)
&& Objects.equals(this.logsInfo, cloudsStormSubTopology.logsInfo)
&& Objects.equals(this.scaledFrom, cloudsStormSubTopology.scaledFrom)
&& Objects.equals(this.connections, cloudsStormSubTopology.connections);
&& Objects.equals(this.subTopologyClass, cloudsStormSubTopology.subTopologyClass)
&& Objects.equals(this.sshKeyPairId, cloudsStormSubTopology.sshKeyPairId)
&& Objects.equals(this.scaledFrom, cloudsStormSubTopology.scaledFrom);
}
@Override
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
......@@ -279,8 +298,9 @@ public class CloudsStormSubTopology {
sb.append(" domain: ").append(toIndentedString(domain)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).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(" connections: ").append(toIndentedString(connections)).append("\n");
sb.append("}");
return sb.toString();
}
......
......@@ -10,6 +10,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubnets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
......@@ -21,6 +22,20 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-11T15:13:55.016Z")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CloudsStormTopTopology {
/**
* @return the connections
*/
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;
......@@ -35,6 +50,10 @@ public class CloudsStormTopTopology {
@Valid
private List<CloudsStormSubnets> subnets = null;
@JsonProperty("connections")
@Valid
private Map<String, Object> connections = null;
public CloudsStormTopTopology userName(String userName) {
this.userName = userName;
return this;
......@@ -42,11 +61,12 @@ public class CloudsStormTopTopology {
/**
* Get userName
*
* @return userName
**/
*
*/
@ApiModelProperty(value = "")
public String getUserName() {
return userName;
}
......@@ -62,11 +82,12 @@ public class CloudsStormTopTopology {
/**
* Get publicKeyPath
*
* @return publicKeyPath
**/
*
*/
@ApiModelProperty(value = "")
public String getPublicKeyPath() {
return publicKeyPath;
}
......@@ -90,8 +111,10 @@ public class CloudsStormTopTopology {
/**
* Get topologies
*
* @return topologies
**/
*
*/
@ApiModelProperty(value = "")
@Valid
......@@ -119,8 +142,10 @@ public class CloudsStormTopTopology {
/**
* Get subnets
*
* @return subnets
**/
*
*/
@ApiModelProperty(value = "")
@Valid
......@@ -133,7 +158,6 @@ public class CloudsStormTopTopology {
this.subnets = subnets;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
......@@ -143,10 +167,10 @@ public class CloudsStormTopTopology {
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);
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
......@@ -178,4 +202,3 @@ public class CloudsStormTopTopology {
return o.toString().replace("\n", "\n ");
}
}
......@@ -3,6 +3,8 @@ package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated;
/**
......@@ -13,6 +15,20 @@ import org.springframework.validation.annotation.Validated;
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")
private String name = null;
......@@ -28,6 +44,28 @@ public class CloudsStormVM {
@JsonProperty("publicAddress")
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) {
this.name = name;
return this;
......@@ -178,4 +216,20 @@ public class CloudsStormVM {
}
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.
}
}
......@@ -16,6 +16,11 @@ import javax.validation.Valid;
public class CloudsStormVMs {
@JsonProperty("SEngineClass")
private String sEngineClass;
@JsonProperty("VMs")
@Valid
private List<CloudsStormVM> vms = null;
......
......@@ -36,7 +36,7 @@ public class DCMetaInfo {
private String availability = null;
@JsonProperty("VMMetaInfo")
private List<VMMetaInfo> vmMetaInfo = null;
private List<CloudsStormVM> vmMetaInfo = null;
@JsonProperty("extraInfo")
@Valid
......@@ -168,7 +168,7 @@ public class DCMetaInfo {
this.availability = availability;
}
public DCMetaInfo vmMetaInfo(List<VMMetaInfo> vmMetaInfo) {
public DCMetaInfo vmMetaInfo(List<CloudsStormVM> vmMetaInfo) {
this.vmMetaInfo = vmMetaInfo;
return this;
}
......@@ -183,11 +183,11 @@ public class DCMetaInfo {
@Valid
public List<VMMetaInfo> getVmMetaInfo() {
public List<CloudsStormVM> getVmMetaInfo() {
return vmMetaInfo;
}
public void setVmMetaInfo(List<VMMetaInfo> vmMetaInfo) {
public void setVmMetaInfo(List<CloudsStormVM> vmMetaInfo) {
this.vmMetaInfo = vmMetaInfo;
}
......
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;
import java.io.IOException;
import java.util.ArrayList;
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.CloudsStormVM;
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.DCMetaInfo;
import nl.uva.sne.drip.model.cloud.storm.VMMetaInfo;
/**
*
......@@ -38,7 +35,7 @@ class CloudStormDAO {
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);
List<CloudDB> cloudDBs = db.getCloudDBs();
......@@ -52,10 +49,10 @@ class CloudStormDAO {
}
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);
List<DCMetaInfo> metaInfos = dbInfo.getDcMetaInfo();
for (DCMetaInfo metaInfo : metaInfos) {
List<CloudsStormVM> metaInfos = dbInfo.getDcMetaInfo();
for (CloudsStormVM metaInfo : metaInfos) {
vMMetaInfos.addAll(metaInfo.getVmMetaInfo());
}
return vMMetaInfos;
......
......@@ -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.InfrasCode;
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.ToscaTemplate;
import nl.uva.sne.drip.sure.tosca.client.ApiException;
......@@ -68,6 +67,9 @@ class CloudStormService {
private final String APP_FOLDER_NAME = "App";
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 {
// this.toscaTemplate = toscaTemplate;
cloudStormDBPath = properties.getProperty("cloud.storm.db.path");
......@@ -87,7 +89,7 @@ class CloudStormService {
if (!(tempInputDir.mkdirs())) {
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);
if (!(topologyTempInputDir.mkdirs())) {
......@@ -194,11 +196,12 @@ class CloudStormService {
Double memSize = helper.getVMNMemSize(vmMap);
String os = helper.getVMNOS(vmMap);
List<VMMetaInfo> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider));
for (VMMetaInfo vmInfo : vmInfos) {
List<CloudsStormVM> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider));
for (CloudsStormVM vmInfo : vmInfos) {
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});
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();
}
}
......@@ -284,12 +287,55 @@ class CloudStormService {
// standalone.MainAsTool.main(args);
tempInputDirPath = "/tmp/Input-87672007429577";
CloudsStormTopTopology _top = objectMapper.readValue(new File(tempInputDirPath
+ File.separator + INFS_FOLDER_NAME + File.separator
+ TOPOLOGY_FOLDER_NAME + File.separator + TOP_TOPOLOGY_FILE_NAME),
CloudsStormTopTopology _top = objectMapper.readValue(new File(tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ TOP_TOPOLOGY_FILE_NAME),
CloudsStormTopTopology.class);
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;
}
......
......@@ -24,7 +24,3 @@
type: object
additionalProperties:
type: object
connections:
type: object
additionalProperties:
type: object
......@@ -5,6 +5,10 @@
type: "string"
publicKeyPath:
type: "string"
connections:
type: object
additionalProperties:
type: object
topologies:
type: array
items:
......
......@@ -11,3 +11,25 @@
type: "string"
publicAddress:
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 @@
VMMetaInfo:
type: "array"
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:
type: object
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