Commit 70b0ad9e authored by Spiros Koulouzis's avatar Spiros Koulouzis

added cloud storm types

parent ae45ad97
......@@ -41,6 +41,7 @@ public class ToscaHelper {
private final DefaultApi api;
private final ObjectMapper objectMapper;
public static final String VM_CAPABILITY = "tosca.capabilities.ARTICONF.VM";
/**
* @return the id
......@@ -84,4 +85,24 @@ public class ToscaHelper {
return vmTopologyTemplates;
}
public List<NodeTemplate> getTopologyTemplateVMs(NodeTemplate nodeTemplate) throws ApiException {
List<Map<String, Object>> requirements = nodeTemplate.getRequirements();
List<NodeTemplate> vms = new ArrayList<>();
for (Map<String, Object> req : requirements) {
String nodeName = req.keySet().iterator().next();
Map<String, Object> node = (Map<String, Object>) req.get(nodeName);
if (node.get("capability").equals(VM_CAPABILITY)) {
String vmName = (String) node.get("node");
List<NodeTemplate> vmNodeTemplates = api.getNodeTemplates(String.valueOf(id), null, vmName, null, null, null, null, null, null);
vms.addAll(vmNodeTemplates);
}
}
return vms;
}
public String getVMType(NodeTemplate vm, String provider) {
}
}
......@@ -2,15 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/../drip-commons/src/main/resources/application.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormSubTopology.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormSubTopology.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormTopTopology.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormTopTopology.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormVM.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/model/CloudsStormVM.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -36,7 +28,7 @@
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../sure_tosca-flask-server" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
......@@ -253,22 +245,22 @@
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575907769017" />
<state width="2465" height="410" key="GridCell.Tab.0.bottom" timestamp="1575891807013">
<state width="2465" height="410" key="GridCell.Tab.0.bottom" timestamp="1576064606672">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="410" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1575891807013" />
<state width="2465" height="410" key="GridCell.Tab.0.center" timestamp="1575891807013">
<state width="2465" height="410" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1576064606672" />
<state width="2465" height="410" key="GridCell.Tab.0.center" timestamp="1576064606669">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="410" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1575891807013" />
<state width="2465" height="410" key="GridCell.Tab.0.left" timestamp="1575891807013">
<state width="2465" height="410" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1576064606669" />
<state width="2465" height="410" key="GridCell.Tab.0.left" timestamp="1576064606668">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="410" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1575891807013" />
<state width="2465" height="410" key="GridCell.Tab.0.right" timestamp="1575891807013">
<state width="2465" height="410" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1576064606668" />
<state width="2465" height="410" key="GridCell.Tab.0.right" timestamp="1576064606671">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="410" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1575891807013" />
<state width="2465" height="410" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1576064606671" />
<state width="2465" height="471" key="GridCell.Tab.1.bottom" timestamp="1575891470098">
<screen x="67" y="34" width="2493" height="1406" />
</state>
......
......@@ -18,6 +18,7 @@ import java.util.Map;
import nl.uva.sne.drip.commons.utils.ToscaHelper;
import nl.uva.sne.drip.model.CloudsStormSubTopology;
import nl.uva.sne.drip.model.CloudsStormTopTopology;
import nl.uva.sne.drip.model.CloudsStormVM;
import nl.uva.sne.drip.model.NodeTemplate;
import nl.uva.sne.drip.model.ToscaTemplate;
import nl.uva.sne.drip.sure_tosca.client.ApiException;
......@@ -87,24 +88,24 @@ class CloudStormService {
CloudsStormSubTopology cloudsStormSubTopology = new CloudsStormSubTopology();
Map<String, Object> properties = nodeTemplate.getProperties();
String domain = (String) properties.get("domain");
String provider = (String) properties.get("provider");
cloudsStormSubTopology.setCloudProvider(domain);
cloudsStormSubTopology.setDomain(domain);
cloudsStormSubTopology.setCloudProvider(provider);
cloudsStormSubTopology.setTopology("vm_topology" + i);
cloudsStormSubTopology.setStatus("fresh");
List<NodeTemplate> vmTemplates = helper.getTopologyTemplateVMs(nodeTemplate);
List<CloudsStormVM> vms = new ArrayList<>();
for (NodeTemplate vm : vmTemplates) {
CloudsStormVM cloudsStormVM = new CloudsStormVM();
// List<NodeTemplate> vmTopologyTemplates = helper.getVMTemplatesForTopology();
// CloudsStormVM cloudsStormVM = new CloudsStormVM();
// cloudsStormVM.setName("node"+i);
// cloudsStormVM.setNodeType(domain);
String vmType = helper.getVMType(vm,provider);
cloudsStormVM.setNodeType(vmType);
}
i++;
}
// List<CloudsStormVM> vms = new ArrayList<>();
// CloudsStormVM cloudsStormVM = new CloudsStormVM();
// cloudsStormVM.setName("Node1");
//
// vms.add(cloudsStormVM);
return cloudsStormSubTopologies;
}
......
CloudDB:
type: "object"
properties:
cloudProvider:
type: "string"
dbInfoFile:
type: "string"
......@@ -13,6 +13,6 @@
#VMs:
#type: array
#items:
#$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormVM.yml#/CloudsStormVM'
#$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStorm/CloudsStormVM.yml#/CloudsStormVM'
......@@ -10,5 +10,5 @@
members:
type: array
items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubMembers.yml#/CloudsStormSubMembers'
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStorm/CloudsStormSubMembers.yml#/CloudsStormSubMembers'
......@@ -8,9 +8,9 @@
topologies:
type: array
items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubTopology.yml#/CloudsStormSubTopology'
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStorm/CloudsStormSubTopology.yml#/CloudsStormSubTopology'
subnets:
type: array
items:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormSubnets.yml#/CloudsStormSubnets'
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStorm/CloudsStormSubnets.yml#/CloudsStormSubnets'
DB:
type: "object"
properties:
cloudDBs:
type: "array"
items: $ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/CloudDB.yml#/CloudDB"
DBInfo:
type: "object"
properties:
GlobalEntry:
type: "string"
DCMetaInfo:
$ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/DCMetaInfo.yml#/DCMetaInfo"
DCMetaInfo:
type: "object"
properties:
domain:
type: "string"
endpoint:
type: "string"
country:
type: "string"
longitude:
type: "string"
latitude:
type: "string"
availability:
type: "string"
VMMetaInfo:
$ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStorm/VMMetaInfo.yml#/VMMetaInfo"
extraInfo:
type: object
additionalProperties:
type: object
VMMetaInfo:
type: "object"
properties:
OS:
type: "string"
CPU:
type: "string"
MEM:
type: "string"
Price:
type: "string"
DefaultSSHAccount:
type: "string"
availability:
type: "string"
extraInfo:
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