Commit 92af4962 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added deploy params to TOSCA

parent 21c571a1
...@@ -423,10 +423,8 @@ public class ProvisionService { ...@@ -423,10 +423,8 @@ public class ProvisionService {
// Map<String, Object> kvMap = null; // Map<String, Object> kvMap = null;
// KeyPair userKey = new KeyPair(); // KeyPair userKey = new KeyPair();
// KeyPair deployerKey = new KeyPair(); // KeyPair deployerKey = new KeyPair();
// Map<String, Key> privateCloudKeys = new HashMap<>(); // Map<String, Key> privateCloudKeys = new HashMap<>();
// Map<String, Key> publicCloudKeys = new HashMap<>(); // Map<String, Key> publicCloudKeys = new HashMap<>();
PlanResponse plan = addCloudCredentialsOnTOSCAPlan(provisionRequest); PlanResponse plan = addCloudCredentialsOnTOSCAPlan(provisionRequest);
Map<String, Object> toscaPlan = plan.getKeyValue(); Map<String, Object> toscaPlan = plan.getKeyValue();
Map<String, Object> topologyTemplate = (Map<String, Object>) ((Map<String, Object>) toscaPlan.get("topology_template")); Map<String, Object> topologyTemplate = (Map<String, Object>) ((Map<String, Object>) toscaPlan.get("topology_template"));
...@@ -469,11 +467,11 @@ public class ProvisionService { ...@@ -469,11 +467,11 @@ public class ProvisionService {
Map<String, Object> properties = (Map<String, Object>) vmList.get(i).get("properties"); Map<String, Object> properties = (Map<String, Object>) vmList.get(i).get("properties");
properties.put("user_name", deployUser); properties.put("user_name", deployUser);
} }
if (name.contains("_key")) { }
for (String nodeName : nodeNames) { if (name.contains("_key")) {
Map<String, Object> keyOutput = TOSCAUtils.buildTOSCAOutput(nodeName, p.getValue()); for (String nodeName : nodeNames) {
outputs.put(name, keyOutput); Map<String, Object> keyOutput = TOSCAUtils.buildTOSCAOutput(nodeName, p.getValue());
} outputs.put(name, keyOutput);
} }
} }
// switch (name) { // switch (name) {
...@@ -536,12 +534,12 @@ public class ProvisionService { ...@@ -536,12 +534,12 @@ public class ProvisionService {
} }
topologyTemplate.put("outputs", outputs); topologyTemplate.put("outputs", outputs);
List<String> userKeyIds = null; // List<String> userKeyIds = null;
if (provisionRequest != null) { // if (provisionRequest != null) {
userKeyIds = provisionRequest.getUserKeyPairIDs(); // userKeyIds = provisionRequest.getUserKeyPairIDs();
} else { // } else {
// userKeyIds = provisionResponse.getUserKeyPairIDs(); //// userKeyIds = provisionResponse.getUserKeyPairIDs();
} // }
// if (saveUserKeys) { // if (saveUserKeys) {
// if (userKeyIds != null && !userKeyIds.isEmpty()) { // if (userKeyIds != null && !userKeyIds.isEmpty()) {
...@@ -592,7 +590,6 @@ public class ProvisionService { ...@@ -592,7 +590,6 @@ public class ProvisionService {
// existingCloudKeyPairIDs = cloudKeyPairIDs; // existingCloudKeyPairIDs = cloudKeyPairIDs;
// } // }
// provisionResponse.setCloudKeyPairIDs(existingCloudKeyPairIDs); // provisionResponse.setCloudKeyPairIDs(existingCloudKeyPairIDs);
// provisionResponse.setDeployParameters(deployParameters); // provisionResponse.setDeployParameters(deployParameters);
// provisionResponse.setKvMap(kvMap); // provisionResponse.setKvMap(kvMap);
provisionResponse.setKvMap(toscaPlan); provisionResponse.setKvMap(toscaPlan);
......
...@@ -29,10 +29,10 @@ public class TOSCAUtils { ...@@ -29,10 +29,10 @@ public class TOSCAUtils {
public static List<Map<String, Object>> getVMsFromTopology(Map<String, Object> toscaPlan) { public static List<Map<String, Object>> getVMsFromTopology(Map<String, Object> toscaPlan) {
List<String> vmNames = getVMsNodeNamesFromTopology(toscaPlan); List<String> vmNames = getVMsNodeNamesFromTopology(toscaPlan);
Map<String, Object> topologyTemplate = (Map<String, Object>) toscaPlan.get("topology_template"); Map<String, Object> nodeTemplates = (Map<String, Object>) ((Map<String, Object>) toscaPlan.get("topology_template")).get("node_templates");
List<Map<String, Object>> vmList = new ArrayList<>(); List<Map<String, Object>> vmList = new ArrayList<>();
for (String vmName : vmNames) { for (String vmName : vmNames) {
Map<String, Object> vm = (Map<String, Object>) topologyTemplate.get(vmName); Map<String, Object> vm = (Map<String, Object>) nodeTemplates.get(vmName);
// Map<String, Object> properties = (Map<String, Object>) vm.get("properties"); // Map<String, Object> properties = (Map<String, Object>) vm.get("properties");
vmList.add(vm); vmList.add(vm);
} }
......
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