Commit 6b86c1a2 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added MissingVMTopologyException

parent 2a282261
......@@ -12,7 +12,7 @@ matrix:
- python -m unittest discover
- docker build -t alogo53/planner:3.0.0 .
- language: python
python: 3.8
python: 3.7
before_script:
- cd sure_tosca-flask-server
- pip install -r requirements.txt
......
......@@ -16,6 +16,7 @@ import java.util.logging.Logger;
import nl.uva.sne.drip.api.NotFoundException;
import nl.uva.sne.drip.commons.utils.ToscaHelper;
import nl.uva.sne.drip.model.Exceptions.MissingCredentialsException;
import nl.uva.sne.drip.model.Exceptions.MissingVMTopologyException;
import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import nl.uva.sne.drip.model.Message;
import nl.uva.sne.drip.model.NodeTemplateMap;
......@@ -94,8 +95,11 @@ public class DRIPService {
return credentials.get(0);
}
private ToscaTemplate addCredentials(ToscaTemplate toscaTemplate) throws MissingCredentialsException, ApiException, TypeExeption {
private ToscaTemplate addCredentials(ToscaTemplate toscaTemplate) throws MissingCredentialsException, ApiException, TypeExeption, MissingVMTopologyException {
List<NodeTemplateMap> vmTopologies = helper.getVMTopologyTemplates();
if(vmTopologies== null){
throw new MissingVMTopologyException("ToscaTemplate: "+toscaTemplate+" has no VM topology");
}
List<Credential> credentials = null;
for (NodeTemplateMap vmTopologyMap : vmTopologies) {
String provider = helper.getTopologyProvider(vmTopologyMap);
......@@ -120,7 +124,7 @@ public class DRIPService {
return execute(toscaTemplate);
}
public String provision(String id) throws MissingCredentialsException, ApiException, TypeExeption, IOException, JsonProcessingException, TimeoutException, InterruptedException, NotFoundException {
public String provision(String id) throws MissingCredentialsException, ApiException, TypeExeption, IOException, JsonProcessingException, TimeoutException, InterruptedException, NotFoundException, MissingVMTopologyException {
ToscaTemplate toscaTemplate = initExecution(id);
toscaTemplate = addCredentials(toscaTemplate);
toscaTemplate = setProvisionerOperation(toscaTemplate, PROVISIONER_OPERATION.PROVISION);
......@@ -169,13 +173,15 @@ public class DRIPService {
void deleteActions(ToscaTemplate toscaTemplate) throws ApiException, TypeExeption, IOException {
helper.uploadToscaTemplate(toscaTemplate);
List<NodeTemplateMap> vmTopologies = helper.getVMTopologyTemplates();
if (vmTopologies != null) {
for (NodeTemplateMap vmTopology : vmTopologies) {
CloudsStormSubTopology.StatusEnum status = helper.getVMTopologyTemplateStatus(vmTopology);
if (!status.equals(CloudsStormSubTopology.StatusEnum.DELETED)) {
Logger.getLogger(ToscaHelper.class.getName()).log(Level.FINE, "Deleting VMs from " + vmTopology);
}
}
}
}
......
......@@ -221,9 +221,11 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
prop = None
queries.append(query.artifacts != prop)
query_results = query_db(queries, db=node_template_db)
if query_results:
return change_to_node_template_model(query_results)
else:
return query_results
def get_tosca_template_get_dsl_definitions(id, anchors, derived_from):
......
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