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:
credential:
type: tosca.datatypes.ARTICONF.Credential
required: false
status:
type: string
required: false
constraints:
- valid_values: [ "fresh" , "running" , "deleted", "failed" , "stopped" ]
interfaces:
CloudsStorm:
type: tosca.interfaces.ARTICONF.CloudsStorm
......
......@@ -237,10 +237,12 @@ public class ToscaHelper {
for (NodeTemplateMap nodeTemplateMap : vmTopologyTemplatesMap) {
List<NodeTemplateMap> vmTemplatesMap = getTemplateVMsForVMTopology(nodeTemplateMap);
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";
}
}
......@@ -15,6 +15,48 @@ import org.springframework.validation.annotation.Validated;
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")
private String topology = null;
......@@ -24,6 +66,17 @@ public class CloudsStormSubTopology {
@JsonProperty("domain")
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
*/
......@@ -69,7 +122,7 @@ public class CloudsStormSubTopology {
* Get topology
*
* @return topology
*
*
*/
@ApiModelProperty(value = "")
......@@ -90,7 +143,7 @@ public class CloudsStormSubTopology {
* Get cloudProvider
*
* @return cloudProvider
*
*
*/
@ApiModelProperty(value = "")
......@@ -111,7 +164,7 @@ public class CloudsStormSubTopology {
* Get domain
*
* @return domain
*
*
*/
@ApiModelProperty(value = "")
......@@ -132,7 +185,7 @@ public class CloudsStormSubTopology {
* Get status
*
* @return status
*
*
*/
@ApiModelProperty(value = "")
......
......@@ -2,9 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<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$/../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>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......
......@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.commons.utils.Converter;
......@@ -60,6 +61,12 @@ class CloudStormService {
private final ObjectMapper objectMapper;
private final String cloudStormDBPath;
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 {
// this.toscaTemplate = toscaTemplate;
......@@ -80,28 +87,29 @@ class CloudStormService {
if (!(tempInputDir.mkdirs())) {
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);
if (!(topologyTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
}
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);
if (!(credentialsTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + credentialsTempInputDir.getAbsolutePath());
}
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);
if (!(providersDBTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + providersDBTempInputDir.getAbsolutePath());
}
writeCloudStormProvidersDBFiles(providersDBTempInputDirPath);
String infrasCodeTempInputDirPath = tempInputDirPath + File.separator + "App";
String infrasCodeTempInputDirPath = tempInputDirPath + File.separator + APP_FOLDER_NAME;
File infrasCodeTempInputDir = new File(infrasCodeTempInputDirPath);
if (!(infrasCodeTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
......@@ -124,7 +132,7 @@ class CloudStormService {
List<CloudsStormSubTopology> cloudsStormSubTopology = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
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;
}
......@@ -271,9 +279,17 @@ class CloudStormService {
FileUtils.copyDirectory(srcDir, destDir);
}
private ToscaTemplate runCloudStorm(String tempInputDirPath) {
String[] args = new String[]{"run", tempInputDirPath};
standalone.MainAsTool.main(args);
private ToscaTemplate runCloudStorm(String tempInputDirPath) throws IOException, ApiException {
// String[] args = new String[]{"run", tempInputDirPath};
// 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;
}
......
......@@ -10,4 +10,15 @@
status:
type: "string"
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