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

added alias

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