Commit 883de1b9 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added more properties missing from cloudstorm topology

parent e3ff8cf2
...@@ -120,6 +120,11 @@ node_types: ...@@ -120,6 +120,11 @@ node_types:
credential: credential:
type: tosca.datatypes.ARTICONF.Credential type: tosca.datatypes.ARTICONF.Credential
required: false required: false
status:
type: string
required: false
constraints:
- valid_values: [ "fresh" , "running" , "deleted", "failed" , "stopped" ]
interfaces: interfaces:
CloudsStorm: CloudsStorm:
type: tosca.interfaces.ARTICONF.CloudsStorm type: tosca.interfaces.ARTICONF.CloudsStorm
......
...@@ -237,10 +237,12 @@ public class ToscaHelper { ...@@ -237,10 +237,12 @@ public class ToscaHelper {
for (NodeTemplateMap nodeTemplateMap : vmTopologyTemplatesMap) { for (NodeTemplateMap nodeTemplateMap : vmTopologyTemplatesMap) {
List<NodeTemplateMap> vmTemplatesMap = getTemplateVMsForVMTopology(nodeTemplateMap); List<NodeTemplateMap> vmTemplatesMap = getTemplateVMsForVMTopology(nodeTemplateMap);
for (NodeTemplateMap vmMap : vmTemplatesMap) { for (NodeTemplateMap vmMap : vmTemplatesMap) {
Map<String, Object> att = vmMap.getNodeTemplate().getAttributes(); Map<String, Object> prop = vmMap.getNodeTemplate().getProperties();
if (prop != null && prop.containsKey("user_name")) {
return (String) prop.get("user_name");
}
} }
} }
return "vm_user"; return "vm_user";
} }
} }
...@@ -15,6 +15,48 @@ import org.springframework.validation.annotation.Validated; ...@@ -15,6 +15,48 @@ import org.springframework.validation.annotation.Validated;
public class CloudsStormSubTopology { public class CloudsStormSubTopology {
/**
* @return the scaledFrom
*/
public Object getScaledFrom() {
return scaledFrom;
}
/**
* @param scaledFrom the scaledFrom to set
*/
public void setScaledFrom(Object scaledFrom) {
this.scaledFrom = scaledFrom;
}
/**
* @return the sshKeyPairId
*/
public String getSshKeyPairId() {
return sshKeyPairId;
}
/**
* @param sshKeyPairId the sshKeyPairId to set
*/
public void setSshKeyPairId(String sshKeyPairId) {
this.sshKeyPairId = sshKeyPairId;
}
/**
* @return the subTopologyClass
*/
public String getSubTopologyClass() {
return subTopologyClass;
}
/**
* @param subTopologyClass the subTopologyClass to set
*/
public void setSubTopologyClass(String subTopologyClass) {
this.subTopologyClass = subTopologyClass;
}
@JsonProperty("topology") @JsonProperty("topology")
private String topology = null; private String topology = null;
...@@ -24,6 +66,17 @@ public class CloudsStormSubTopology { ...@@ -24,6 +66,17 @@ public class CloudsStormSubTopology {
@JsonProperty("domain") @JsonProperty("domain")
private String domain = null; private String domain = null;
@JsonProperty("subTopologyClass")
private String subTopologyClass = null;
@JsonProperty("logsInfo")
private Object logsInfo;
@JsonProperty("sshKeyPairId")
private String sshKeyPairId;
@JsonProperty("scaledFrom")
private Object scaledFrom;
/** /**
* Gets or Sets status * Gets or Sets status
*/ */
...@@ -69,7 +122,7 @@ public class CloudsStormSubTopology { ...@@ -69,7 +122,7 @@ public class CloudsStormSubTopology {
* Get topology * Get topology
* *
* @return topology * @return topology
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -90,7 +143,7 @@ public class CloudsStormSubTopology { ...@@ -90,7 +143,7 @@ public class CloudsStormSubTopology {
* Get cloudProvider * Get cloudProvider
* *
* @return cloudProvider * @return cloudProvider
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -111,7 +164,7 @@ public class CloudsStormSubTopology { ...@@ -111,7 +164,7 @@ public class CloudsStormSubTopology {
* Get domain * Get domain
* *
* @return domain * @return domain
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
...@@ -132,7 +185,7 @@ public class CloudsStormSubTopology { ...@@ -132,7 +185,7 @@ public class CloudsStormSubTopology {
* Get status * Get status
* *
* @return status * @return status
* *
*/ */
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment=""> <list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/../.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
......
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Properties; import java.util.Properties;
import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import nl.uva.sne.drip.commons.utils.Converter; import nl.uva.sne.drip.commons.utils.Converter;
...@@ -60,6 +61,12 @@ class CloudStormService { ...@@ -60,6 +61,12 @@ class CloudStormService {
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final String cloudStormDBPath; private final String cloudStormDBPath;
private final String SUB_TOPOLOGY_NAME = "subTopology"; private final String SUB_TOPOLOGY_NAME = "subTopology";
private final String TOPOLOGY_FOLDER_NAME = "Topology";
private final String INFS_FOLDER_NAME = "Infs";
private final String UC_FOLDER_NAME = "UC";
private final String UD_FOLDER_NAME = "UD";
private final String APP_FOLDER_NAME = "App";
private final String TOP_TOPOLOGY_FILE_NAME = "_top.yml";
CloudStormService(Properties properties, ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException { CloudStormService(Properties properties, ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException {
// this.toscaTemplate = toscaTemplate; // this.toscaTemplate = toscaTemplate;
...@@ -80,28 +87,29 @@ class CloudStormService { ...@@ -80,28 +87,29 @@ 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" + File.separator + "Topology"; String topologyTempInputDirPath = tempInputDirPath + File.separator + INFS_FOLDER_NAME + File.separator + TOPOLOGY_FOLDER_NAME;
File topologyTempInputDir = new File(topologyTempInputDirPath); File topologyTempInputDir = new File(topologyTempInputDirPath);
if (!(topologyTempInputDir.mkdirs())) { if (!(topologyTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
} }
Map<String, Object> subTopologiesAndVMs = writeCloudStormTopologyFiles(topologyTempInputDirPath); Map<String, Object> subTopologiesAndVMs = writeCloudStormTopologyFiles(topologyTempInputDirPath);
String credentialsTempInputDirPath = tempInputDirPath + File.separator + "Infs" + File.separator + "UC"; String credentialsTempInputDirPath = tempInputDirPath + File.separator + INFS_FOLDER_NAME + File.separator + UC_FOLDER_NAME;
File credentialsTempInputDir = new File(credentialsTempInputDirPath); File credentialsTempInputDir = new File(credentialsTempInputDirPath);
if (!(credentialsTempInputDir.mkdirs())) { if (!(credentialsTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + credentialsTempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + credentialsTempInputDir.getAbsolutePath());
} }
writeCloudStormCredentialsFiles(credentialsTempInputDirPath); writeCloudStormCredentialsFiles(credentialsTempInputDirPath);
String providersDBTempInputDirPath = tempInputDirPath + File.separator + "Infs" + File.separator + "UD"; String providersDBTempInputDirPath = tempInputDirPath + File.separator + INFS_FOLDER_NAME + File.separator + UD_FOLDER_NAME;
File providersDBTempInputDir = new File(providersDBTempInputDirPath); File providersDBTempInputDir = new File(providersDBTempInputDirPath);
if (!(providersDBTempInputDir.mkdirs())) { if (!(providersDBTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + providersDBTempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + providersDBTempInputDir.getAbsolutePath());
} }
writeCloudStormProvidersDBFiles(providersDBTempInputDirPath); writeCloudStormProvidersDBFiles(providersDBTempInputDirPath);
String infrasCodeTempInputDirPath = tempInputDirPath + File.separator + "App"; String infrasCodeTempInputDirPath = tempInputDirPath + File.separator + APP_FOLDER_NAME;
File infrasCodeTempInputDir = new File(infrasCodeTempInputDirPath); File infrasCodeTempInputDir = new File(infrasCodeTempInputDirPath);
if (!(infrasCodeTempInputDir.mkdirs())) { if (!(infrasCodeTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
...@@ -124,7 +132,7 @@ class CloudStormService { ...@@ -124,7 +132,7 @@ class CloudStormService {
List<CloudsStormSubTopology> cloudsStormSubTopology = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies"); List<CloudsStormSubTopology> cloudsStormSubTopology = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
topTopology.setTopologies(cloudsStormSubTopology); topTopology.setTopologies(cloudsStormSubTopology);
objectMapper.writeValue(new File(tempInputDirPath + File.separator + "_top.yml"), topTopology); objectMapper.writeValue(new File(tempInputDirPath + File.separator + TOP_TOPOLOGY_FILE_NAME), topTopology);
return subTopologiesAndVMs; return subTopologiesAndVMs;
} }
...@@ -271,9 +279,17 @@ class CloudStormService { ...@@ -271,9 +279,17 @@ class CloudStormService {
FileUtils.copyDirectory(srcDir, destDir); FileUtils.copyDirectory(srcDir, destDir);
} }
private ToscaTemplate runCloudStorm(String tempInputDirPath) { 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";
CloudsStormTopTopology _top = objectMapper.readValue(new File(tempInputDirPath
+ File.separator + INFS_FOLDER_NAME + File.separator
+ TOPOLOGY_FOLDER_NAME + File.separator + TOP_TOPOLOGY_FILE_NAME),
CloudsStormTopTopology.class);
List<CloudsStormSubTopology> subTopologies = _top.getTopologies();
return null; return null;
} }
......
...@@ -10,4 +10,15 @@ ...@@ -10,4 +10,15 @@
status: status:
type: "string" type: "string"
enum: [fresh , running , deleted , failed , stopped] enum: [fresh , running , deleted , failed , stopped]
subTopologyClass:
type: "string"
logsInfo:
type: object
additionalProperties:
type: object
subTopologyClass:
type: "sshKeyPairId"
scaledFrom:
type: object
additionalProperties:
type: object
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