Commit 4ae22a0e authored by Spiros Koulouzis's avatar Spiros Koulouzis

successfully provisioned topology

parent 7e2c4eef
......@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.dao.CloudCredentialsDao;
import nl.uva.sne.drip.api.service.UserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
/**
*
......@@ -46,7 +47,7 @@ public class CloudConfigurationController {
@RequestMapping(method = RequestMethod.POST)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
String postConf(CloudCredentials cc) {
String postConf(@RequestBody CloudCredentials cc) {
cloudCredentialsDao.save(cc);
return cc.getId();
}
......
......@@ -88,7 +88,7 @@ public class PlannerController {
dripComponetens.add(planner);
Message plannerReturnedMessage = planner.call(plannerInvokationMessage);
Message provisionerInvokationMessage = buildProvisionerMessage(plannerReturnedMessage, "58a1f0a963d42f004b1d63ad");
Message provisionerInvokationMessage = buildProvisionerMessage(plannerReturnedMessage, "58a7281c55363e65b3c9eb82");
provisioner = new ProvisionerCaller(messageBrokerHost);
dripComponetens.add(provisioner);
provisioner.call(provisionerInvokationMessage);
......
......@@ -116,6 +116,24 @@ public class ToscaController {
return null;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
ToscaRepresentation getToscaRepresentation(@PathVariable("id") String id) {
ToscaRepresentation tosca = dao.findOne(id);
return tosca;
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
String delete(@PathVariable("id") String id) {
dao.delete(id);
return "Deleted tosca :" + id;
}
// http://localhost:8080/drip-api/tosca/ids
@RequestMapping(value = "/ids")
@RolesAllowed({UserService.USER, UserService.ADMIN})
......
......@@ -82,19 +82,16 @@ public class Consumer extends DefaultConsumer {
List<File> files = panner.plan(inputFiles[0].getAbsolutePath(), inputFiles[1].getAbsolutePath(), tempDir.getAbsolutePath());
//Here we do the same as above with a different API
inputFiles = simpleJsonUnmarshalExample(message);
// inputFiles = simpleJsonUnmarshalExample(message);
//Call the method with the extracted parameters
files = panner.plan(inputFiles[0].getAbsolutePath(), inputFiles[1].getAbsolutePath(), tempDir.getAbsolutePath());
// files = panner.plan(inputFiles[0].getAbsolutePath(), inputFiles[1].getAbsolutePath(), tempDir.getAbsolutePath());
//Now we need to put the result of the call to a message and respond
//Example 1
response = jacksonMarshalExample(files);
//Example 2
response = simpleJsonMarshalExample(files);
} catch (IOException | JSONException ex) {
// response = simpleJsonMarshalExample(files);
} catch (Exception ex) {
response = ex.getMessage();
Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex);
} finally {
......
......@@ -24,6 +24,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import nl.uva.sne.drip.commons.utils.Converter;
/**
*
......@@ -45,9 +46,12 @@ public class Planner {
}
if (check) {
if (line.contains("file")) {
String content = line.trim().replace('\"', ' ');
String content = line.trim().replace('\'', ' ').replace('\"', ' ');
String[] cs = content.split(":");
String docker_name = cs[1].trim();
if (docker_name.equals("{file")) {
docker_name = cs[2].trim();
}
dockerNames.add(docker_name);
}
}
......@@ -111,7 +115,6 @@ public class Planner {
outputFiles.add(new File(outfPath));
outputFiles.add(new File(allFilePath));
return outputFiles;
}
private String generateVM(String block, String nodeName, String dockerName, String privateAddress, String role) {
......
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