Commit 01605b7e authored by Spiros Koulouzis's avatar Spiros Koulouzis

change schema

parent 2cd7a42d
...@@ -15,6 +15,9 @@ import java.util.ArrayList; ...@@ -15,6 +15,9 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
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.ToscaTemplate; import nl.uva.sne.drip.model.ToscaTemplate;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
...@@ -22,7 +25,7 @@ import org.apache.commons.io.FilenameUtils; ...@@ -22,7 +25,7 @@ import org.apache.commons.io.FilenameUtils;
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
class ProvisionerRPCService { class CloudStormService {
private List<Map.Entry> vmTopologies; private List<Map.Entry> vmTopologies;
private String tempInputDirPath; private String tempInputDirPath;
...@@ -39,8 +42,14 @@ class ProvisionerRPCService { ...@@ -39,8 +42,14 @@ class ProvisionerRPCService {
return toscaTemplate; return toscaTemplate;
} }
private Map<String, Object> buildCloudStormTopTopology(ToscaTemplate toscaTemplate) throws JSchException, IOException { private CloudsStormTopTopology buildCloudStormTopTopology(ToscaTemplate toscaTemplate) throws JSchException, IOException {
Map<String, Object> topTopology = new HashMap<>(); CloudsStormTopTopology topTopology = new CloudsStormTopTopology();
String publicKeyPath = buildSSHKeyPair();
topTopology.setPublicKeyPath(publicKeyPath);
topTopology.setUserName(getUserName());
List<CloudsStormSubTopology> topologies = getCloudsStormSubTopologies(toscaTemplate);
topTopology.setTopologies(topologies);
return topTopology; return topTopology;
} }
...@@ -56,4 +65,23 @@ class ProvisionerRPCService { ...@@ -56,4 +65,23 @@ class ProvisionerRPCService {
return publicKeyPath; return publicKeyPath;
} }
private String getUserName() {
return "vm_user";
}
private List<CloudsStormSubTopology> getCloudsStormSubTopologies(ToscaTemplate toscaTemplate) {
List<CloudsStormSubTopology> cloudsStormSubTopologies = new ArrayList<>();
CloudsStormSubTopology cloudsStormSubTopology = new CloudsStormSubTopology();
List<CloudsStormVM> vms = new ArrayList<>();
CloudsStormVM cloudsStormVM = new CloudsStormVM();
cloudsStormVM.setName("Node1");
vms.add(cloudsStormVM);
cloudsStormSubTopology.setVms(vms);
cloudsStormSubTopology.
return cloudsStormSubTopologies;
}
} }
...@@ -69,7 +69,7 @@ public class Consumer extends DefaultConsumer { ...@@ -69,7 +69,7 @@ public class Consumer extends DefaultConsumer {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
} }
ProvisionerRPCService service = new ProvisionerRPCService(); CloudStormService service = new CloudStormService();
ToscaTemplate toscaTemplate = service.execute(message.getToscaTemplate()); ToscaTemplate toscaTemplate = service.execute(message.getToscaTemplate());
Message responceMessage = new Message(); Message responceMessage = new Message();
......
CloudsStormSubTopology: CloudsStormSubTopology:
type: "object" type: "object"
properties: properties:
VMs: topology:
type: array type: "string"
items: cloudProvider:
$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormVM.yml#/CloudsStormVM' type: "string"
domain:
type: "string"
status:
type: "string"
#VMs:
#type: array
#items:
#$ref: 'https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudsStormVM.yml#/CloudsStormVM'
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