Commit 8da728d5 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added alias

parent 321fbae0
package nl.uva.sne.drip.model.cloud.storm;
import com.fasterxml.jackson.annotation.JsonAlias;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
......@@ -37,6 +38,7 @@ public class CloudsStormVM {
private String nodeType = null;
@JsonProperty("OStype")
@JsonAlias({"os", "OS"})
private String ostype = null;
@JsonProperty("script")
......@@ -44,17 +46,17 @@ public class CloudsStormVM {
@JsonProperty("publicAddress")
private String publicAddress = null;
@JsonProperty("type")
private String type = null;
//
// @JsonProperty("type")
// private String type = null;
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
@JsonProperty("OS")
private String OS = null;
// @JsonProperty("OS")
// @JsonAlias({"os", "mybkcat"})
// private String OS = null;
@JsonProperty("CPU")
private String CPU = null;
......@@ -62,6 +64,7 @@ public class CloudsStormVM {
private String MEM = null;
@JsonProperty("VMType")
@JsonAlias({"type"})
private String vmType = null;
@JsonProperty("Price")
......@@ -181,27 +184,26 @@ public class CloudsStormVM {
this.publicAddress = publicAddress;
}
public CloudsStormVM type(String type) {
this.type = type;
return this;
}
/**
* Get type
*
* @return type
*
*/
@ApiModelProperty(value = "")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
// public CloudsStormVM type(String type) {
// this.type = type;
// return this;
// }
//
// /**
// * Get type
// *
// * @return type
// *
// */
// @ApiModelProperty(value = "")
//
// public String getType() {
// return type;
// }
//
// public void setType(String type) {
// this.type = type;
// }
public CloudsStormVM extraInfo(Map<String, Object> extraInfo) {
this.extraInfo = extraInfo;
return this;
......@@ -231,27 +233,26 @@ public class CloudsStormVM {
this.extraInfo = extraInfo;
}
public CloudsStormVM 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 CloudsStormVM 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 CloudsStormVM CPU(String CPU) {
this.CPU = CPU;
return this;
......@@ -392,9 +393,9 @@ public class CloudsStormVM {
&& Objects.equals(this.ostype, cloudsStormVM.ostype)
&& Objects.equals(this.script, cloudsStormVM.script)
&& Objects.equals(this.publicAddress, cloudsStormVM.publicAddress)
&& Objects.equals(this.type, cloudsStormVM.type)
// && Objects.equals(this.type, cloudsStormVM.type)
&& Objects.equals(this.extraInfo, cloudsStormVM.extraInfo)
&& Objects.equals(this.OS, cloudsStormVM.OS)
// && Objects.equals(this.OS, cloudsStormVM.OS)
&& Objects.equals(this.CPU, cloudsStormVM.CPU)
&& Objects.equals(this.MEM, cloudsStormVM.MEM)
&& Objects.equals(this.vmType, cloudsStormVM.vmType)
......@@ -405,7 +406,7 @@ public class CloudsStormVM {
@Override
public int hashCode() {
return Objects.hash(name, nodeType, ostype, script, publicAddress, type, extraInfo, OS, CPU, MEM, vmType, price, defaultSSHAccount, availability);
return Objects.hash(name, nodeType, ostype, script, publicAddress, extraInfo, CPU, MEM, vmType, price, defaultSSHAccount, availability);
}
@Override
......@@ -418,9 +419,9 @@ public class CloudsStormVM {
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(" type: ").append(toIndentedString(type)).append("\n");
// sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" extraInfo: ").append(toIndentedString(extraInfo)).append("\n");
sb.append(" OS: ").append(toIndentedString(OS)).append("\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(" vmType: ").append(toIndentedString(vmType)).append("\n");
......
......@@ -175,7 +175,7 @@ class CloudStormService {
cloudsStormVM.setNodeType(vmType);
cloudsStormVM.setName("vm" + j);
String os = helper.getVMNOS(vmMap);
cloudsStormVM.setOS(os);
// cloudsStormVM.setOS(os);
cloudsStormVM.setOstype(os);
vms.add(cloudsStormVM);
j++;
......@@ -201,7 +201,7 @@ class CloudStormService {
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())) {
&& Objects.equals(memSize, Double.valueOf(vmInfo.getMEM())) && os.toLowerCase().equals(vmInfo.getOstype().toLowerCase())) {
return vmInfo.getVmType();
}
}
......@@ -283,9 +283,9 @@ class CloudStormService {
}
private ToscaTemplate runCloudStorm(String tempInputDirPath) throws IOException, ApiException {
// String[] args = new String[]{"run", tempInputDirPath};
// standalone.MainAsTool.main(args);
tempInputDirPath = "/tmp/Input-87672007429577";
String[] args = new String[]{"run", tempInputDirPath};
standalone.MainAsTool.main(args);
// tempInputDirPath = "/tmp/Input-87672007429577";
CloudsStormTopTopology _top = objectMapper.readValue(new File(tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ TOP_TOPOLOGY_FILE_NAME),
......
......@@ -17,7 +17,7 @@
type: object
additionalProperties:
type: object
OS:
os:
type: "string"
CPU:
type: "string"
......
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