Commit 2f8b45bf authored by Spiros Koulouzis's avatar Spiros Koulouzis

Implemented API v0 for backwords compatibility

parent 5f66fae5
......@@ -7,8 +7,10 @@
</facets>
<api-classes>
<include pattern="nl.uva.sne.drip.api.rest.*" />
<include pattern="nl.uva.sne.drip.commons.types.*" />
<include pattern="nl.uva.sne.drip.api.v1.rest.*" />
<include pattern="nl.uva.sne.drip.api.v0.rest.*" />
<include pattern="nl.uva.sne.drip.commons.v1.types.*" />
<include pattern="nl.uva.sne.drip.commons.v0.types.*" />
</api-classes>
......
......@@ -132,6 +132,15 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
</dependencies>
<build>
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.api.conf;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
*
* @author alogo
*/
@EnableWebMvc
@Configuration
@ComponentScan({ "nl.uva.sne.drip.api" })
public class ConverterConfig extends WebMvcConfigurerAdapter {
}
......@@ -28,6 +28,7 @@ public class WebAppInitializer implements WebApplicationInitializer {
ctx.register(MultipartConfig.class);
ctx.register(MongoConfig.class);
ctx.register(SecurityConfig.class);
ctx.register(ConverterConfig.class);
ctx.setServletContext(servletContext);
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.ClusterCredentials;
import nl.uva.sne.drip.commons.v1.types.ClusterCredentials;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.Plan;
import nl.uva.sne.drip.commons.v1.types.Plan;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.ProvisionInfo;
import nl.uva.sne.drip.commons.v1.types.ProvisionInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.v1.types.ToscaRepresentation;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.User;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.types.UserScript;
import nl.uva.sne.drip.commons.v1.types.UserScript;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
......
......@@ -17,8 +17,8 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import nl.uva.sne.drip.commons.utils.Converter;
import org.json.JSONArray;
import org.json.JSONException;
......
......@@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.v1.types.Message;
/**
*
......
......@@ -29,10 +29,10 @@ import nl.uva.sne.drip.api.dao.PlanDao;
import nl.uva.sne.drip.api.exception.BadRequestException;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.rpc.PlannerCaller;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.types.MessageParameter;
import nl.uva.sne.drip.commons.types.Plan;
import nl.uva.sne.drip.commons.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.Plan;
import nl.uva.sne.drip.commons.v1.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.drip.converter.P2PConverter;
import nl.uva.sne.drip.drip.converter.SimplePlanContainer;
......
......@@ -29,10 +29,10 @@ import java.util.concurrent.TimeoutException;
import nl.uva.sne.drip.api.dao.PlanDao;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.rpc.PlannerCaller;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.types.MessageParameter;
import nl.uva.sne.drip.commons.types.Plan;
import nl.uva.sne.drip.commons.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.Plan;
import nl.uva.sne.drip.commons.v1.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.utils.Converter;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map;
import nl.uva.sne.drip.api.dao.ToscaDao;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.v1.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.utils.Converter;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -18,7 +18,7 @@ package nl.uva.sne.drip.api.service;
import java.util.ArrayList;
import java.util.List;
import nl.uva.sne.drip.api.dao.UserKeyDao;
import nl.uva.sne.drip.commons.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -20,7 +20,7 @@ import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.api.dao.UserDao;
import nl.uva.sne.drip.commons.types.User;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.api.v0.rest;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.commons.v0.types.Result;
import javax.annotation.security.RolesAllowed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.service.PlannerService;
import nl.uva.sne.drip.api.service.ToscaService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.commons.v0.types.Plan;
import org.json.JSONException;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
/**
* This controller is responsible for planing the type of resources to be
* provisopned based on a TOSCA description.
*
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/v0.0/switch/plan")
@Component
public class PlannerController0 {
@Autowired
private PlannerService plannerService;
@Autowired
private ToscaService toscaService;
@RequestMapping(value = "/planning", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Result plan(@RequestBody Plan plan0) {
try {
nl.uva.sne.drip.commons.v1.types.ToscaRepresentation toscaRep = new nl.uva.sne.drip.commons.v1.types.ToscaRepresentation();
toscaRep.setKvMap(Converter.ymlString2Map(plan0.getFile()));
toscaService.getDao().save(toscaRep);
nl.uva.sne.drip.commons.v1.types.Plan plan1 = plannerService.getPlan(toscaRep.getId());
return null;
} catch (JSONException | IOException | TimeoutException | InterruptedException ex) {
Logger.getLogger(PlannerController0.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@RequestMapping(value = "/get", method = RequestMethod.GET, produces = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Plan plan() {
Plan p = new Plan();
p.setFile("tosca_definitions_version: tosca_simple_yaml_1_0\\n\\n\\ndescription: example file for infrastructure planner\\n\\n\\nrepositories:\\n MOG_docker_hub: \\n description: MOG project’s code repository in GitHub\\n url: https://github.com/switch-project/mog\\n credential:\\n protocol: xauth\\n token_type: X-Auth-Token\\n # token encoded in Base64\\n token: 604bbe45ac7143a79e14f3158df67091\\n\\n\\nartifact_types:\\n tosca.artifacts.Deployment.Image.Container.Docker:\\n derived_from: tosca.artifacts.Deployment.Image\\n\\n\\ndata_types:\\n Switch.datatypes.QoS.AppComponent:\\n derived_from: tosca.datatypes.Root\\n properties:\\n response_time:\\n type: string\\n\\n Switch.datatypes.Application.Connection.EndPoint:\\n derived_from: tosca.datatypes.Root\\n properties:\\n address:\\n type: string\\n component_name:\\n type: string\\n netmask:\\n type: string\\n port_name:\\n type: string\\n\\n Switch.datatypes.Application.Connection.Multicast:\\n derived_from: tosca.datatypes.Root\\n properties:\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n\\n Switch.datatypes.Network.EndPoint:\\n derived_from: tosca.datatypes.Root\\n properties:\\n address:\\n type: string\\n host_name:\\n type: string\\n netmask:\\n type: string\\n port_name:\\n type: string\\n\\n Switch.datatypes.Network.Multicast:\\n derived_from: tosca.datatypes.Root\\n properties:\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n\\n\\nnode_types:\\n\\n Switch.nodes.Application.Container.Docker:\\n derived_from: tosca.nodes.Container.Application\\n properties:\\n QoS:\\n type: Switch.datatypes.QoS.AppComponent\\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n interfaces:\\n Standard:\\n create:\\n inputs:\\n command:\\n type: string\\n exported_ports:\\n type: list\\n entry_schema:\\n type: string\\n port_bindings:\\n type: list\\n entry_schema:\\n type: string\\n\\n Switch.nodes.Application.Container.Docker.MOG.InputDistributor:\\n derived_from: Switch.nodes.Application.Container.Docker\\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n file: \"mogswitch/InputDistributor:1.0\"\\n repository: MOG_docker_hub\\n properties:\\n inPort: \\n type: integer\\n waitingTime:\\n type: integer\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n videoWidth:\\n type: integer\\n videoHeight:\\n type: integer\\n\\n Switch.nodes.Application.Container.Docker.MOG.ProxyTranscoder:\\n derived_from: Switch.nodes.Application.Container.Docker \\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n file: \"mogswitch/ProxyTranscoder:1.0\"\\n repository: MOG_docker_hub\\n properties:\\n multicastAddrIP: \\n type: string\\n multicastAddrPort:\\n type: integer\\n videoWidth:\\n type: integer\\n videoHeight:\\n type: integer\\n\\n Switch.nodes.Application.Connection:\\n derived_from: tosca.nodes.Root \\n properties:\\n source:\\n type: Switch.datatypes.Application.Connection.EndPoint\\n target:\\n type: Switch.datatypes.Application.Connection.EndPoint\\n bandwidth:\\n type: string\\n latency: \\n type: string\\n jitter: \\n type: string\\n multicast:\\n type: Switch.datatypes.Application.Connection.Multicast\\n\\n Switch.nodes.Compute:\\n derived_from: tosca.nodes.Compute\\n properties:\\n OStype:\\n type: string\\n nodetype:\\n type: string\\n domain:\\n type: string\\n public_address:\\n type: string\\n \n"
+ " ethernet_port:\\n type: list\\n entry_schema:\\n type: tosca.datatypes.network.NetworkInfo\\n script:\\n type: string\\n installation:\\n type: string\\n ssh_credential:\\n type: tosca.datatypes.Credential\\n\\n Switch.nodes.Network:\\n derived_from: tosca.nodes.network.Network\\n properties:\\n bandwidth:\\n type: string\\n latency:\\n type: string\\n jitter:\\n type: string\\n source:\\n type: Switch.datatypes.Network.EndPoint\\n target:\\n type: Switch.datatypes.Network.EndPoint\\n multicast:\\n type: Switch.datatypes.Network.Multicast\\n\\n\\ntopology_template:\\n \\n node_templates:\\n 2d13d708e3a9441ab8336ce874e08dd1:\\n type: Switch.nodes.Application.Container.Docker.MOG.InputDistributor\\n artifacts:\\n docker_image:\\n file: \"mogswitch/InputDistributor:1.0\"\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n repository: MOG_docker_hub\\n properties:\\n QoS:\\n response_time: 30ms\\n inPort: 2000\\n waitingTime: 5\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n videoWidth: 176\\n videoHeight: 100\\n interfaces:\\n Standard:\\n create:\\n implementation: docker_image\\n inputs:\\n command: InputDistributor\\n exported_ports:\\n - 2000\\n port_bindings:\\n - \"2000:2000\"\\n - \"3000:3000\"\\n\\n 8fcc1788d9ee462c826572c79fdb2a6a:\\n type: Switch.nodes.Application.Container.Docker.MOG.ProxyTranscoder\\n artifacts:\\n docker_image:\\n file: \"mogswitch/ProxyTranscoder:1.0\"\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n repository: MOG_docker_hub\\n properties:\\n QoS:\\n response_time: 30ms\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n videoWidth: 176\\n videoHeight: 100\\n interfaces:\\n Standard:\\n create:\\n implementation: docker_image\\n inputs:\\n command: ProxyTranscoder\\n exported_ports:\\n - 80\\n port_bindings:\\n - \"8080:80\"\\n\\n 5e0add703c8a43938a39301f572e46c0:\\n type: Switch.nodes.Application.Connection\\n properties:\\n source:\\n address: 192.168.21.11\\n component_name: 2d13d708e3a9441ab8336ce874e08dd1\\n netmask: 255.255.255.0\\n port_name: \"inputDistributor_out\"\\n target:\\n address: 192.168.21.12\\n component_name: 8fcc1788d9ee462c826572c79fdb2a6a\\n netmask: 255.255.255.0\\n port_name: \"proxyTranscoder_in\"\\n latency: 30ms\\n bandwidth: 130MB/s\\n jitter: 500ms\\n multicast:\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n");
p.setPwd("123");
p.setUser("user");
return p;
}
}
......@@ -25,7 +25,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.commons.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -38,7 +38,7 @@ import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.exception.NullKeyException;
import nl.uva.sne.drip.api.exception.NullKeyIDException;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -54,7 +54,7 @@ import org.springframework.web.multipart.MultipartFile;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/configuration/cloud")
@RequestMapping("/user/v1.0/configuration/cloud")
@Component
public class CloudConfigurationController {
......
......@@ -29,8 +29,8 @@ import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.dao.CloudCredentialsDao;
import nl.uva.sne.drip.api.exception.BadRequestException;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -44,11 +44,11 @@ import nl.uva.sne.drip.api.rpc.DeployerCaller;
import nl.uva.sne.drip.api.service.ClusterCredentialService;
import nl.uva.sne.drip.api.service.ProvisionService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.types.CloudCredentials;
import nl.uva.sne.drip.commons.types.ClusterCredentials;
import nl.uva.sne.drip.commons.types.DeployParameter;
import nl.uva.sne.drip.commons.types.LoginKey;
import nl.uva.sne.drip.commons.types.ProvisionInfo;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.ClusterCredentials;
import nl.uva.sne.drip.commons.v1.types.DeployParameter;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.ProvisionInfo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -58,7 +58,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/deployer")
@RequestMapping("/user/v1.0/deployer")
@Component
public class DeployController {
......
......@@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.service.PlannerService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.types.Plan;
import nl.uva.sne.drip.commons.v1.types.Plan;
import org.springframework.web.bind.annotation.RequestParam;
/**
......@@ -43,7 +43,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/planner")
@RequestMapping("/user/v1.0/planner")
@Component
public class PlannerController {
......
......@@ -16,7 +16,7 @@
package nl.uva.sne.drip.api.v1.rest;
import com.fasterxml.jackson.core.JsonParser;
import nl.uva.sne.drip.commons.types.ProvisionInfo;
import nl.uva.sne.drip.commons.v1.types.ProvisionInfo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.ByteArrayOutputStream;
......@@ -33,8 +33,8 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.dao.CloudCredentialsDao;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import nl.uva.sne.drip.commons.utils.Converter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -55,11 +55,11 @@ import nl.uva.sne.drip.api.service.SimplePlannerService;
import nl.uva.sne.drip.api.service.UserKeyService;
import nl.uva.sne.drip.api.service.UserScriptService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.types.CloudCredentials;
import nl.uva.sne.drip.commons.types.DeployParameter;
import nl.uva.sne.drip.commons.types.LoginKey;
import nl.uva.sne.drip.commons.types.Plan;
import nl.uva.sne.drip.commons.types.UserScript;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.DeployParameter;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.Plan;
import nl.uva.sne.drip.commons.v1.types.UserScript;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.json.JSONException;
......@@ -72,7 +72,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/provisioner")
@RequestMapping("/user/v1.0/provisioner")
@Component
public class ProvisionController {
......
......@@ -15,7 +15,7 @@
*/
package nl.uva.sne.drip.api.v1.rest;
import nl.uva.sne.drip.commons.types.ToscaRepresentation;
import nl.uva.sne.drip.commons.v1.types.ToscaRepresentation;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
......@@ -42,7 +42,7 @@ import nl.uva.sne.drip.api.service.UserService;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/tosca")
@RequestMapping("/user/v1.0/tosca")
@Component
public class ToscaController {
......
......@@ -24,7 +24,7 @@ import nl.uva.sne.drip.api.exception.PasswordNullException;
import nl.uva.sne.drip.api.exception.UserExistsException;
import nl.uva.sne.drip.api.exception.UserNotFoundException;
import nl.uva.sne.drip.api.exception.UserNullException;
import nl.uva.sne.drip.commons.types.User;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -43,7 +43,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/manager/user/")
@RequestMapping("/manager/v1.0/user/")
@Component
public class UserController {
......
......@@ -17,7 +17,7 @@ package nl.uva.sne.drip.api.v1.rest;
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import nl.uva.sne.drip.commons.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
......@@ -47,7 +47,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/user_key")
@RequestMapping("/user/v1.0/user_key")
@Component
public class UserPublicKeysController {
......
......@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import nl.uva.sne.drip.api.dao.UserScriptDao;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.types.UserScript;
import nl.uva.sne.drip.commons.v1.types.UserScript;
import org.springframework.web.bind.annotation.PathVariable;
/**
......@@ -40,7 +40,7 @@ import org.springframework.web.bind.annotation.PathVariable;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/user_script")
@RequestMapping("/user/v1.0/user_script")
@Component
public class UserScriptController {
......
......@@ -26,9 +26,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import nl.uva.sne.drip.commons.types.CloudCredentials;
import nl.uva.sne.drip.commons.types.Message;
import nl.uva.sne.drip.commons.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* This class represents a plan to be provided to the planner.
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Plan implements Serializable {
private String user;
private String pwd;
private String file;
/**
* Not used. It's only there for backwords compatibility
*
* @return the user
*/
@DocumentationExample("user")
public String getUser() {
return user;
}
/**
* @param user the user to set
*/
public void setUser(String user) {
this.user = user;
}
/**
* Not used. It's only there for backwords compatibility
*
* @return the pwd
*/
@DocumentationExample("123")
public String getPwd() {
return pwd;
}
/**
* The password
*
* @param pwd the pwd to set
*/
public void setPwd(String pwd) {
this.pwd = pwd;
}
/**
* The contents of the TOSCA description
*
* @return the file
*/
@DocumentationExample("tosca_definitions_version: tosca_simple_yaml_1_0\\n\\n\\ndescription: example file for infrastructure planner\\n\\n\\nrepositories:\\n MOG_docker_hub: \\n description: MOG project’s code repository in GitHub\\n url: https://github.com/switch-project/mog\\n credential:\\n protocol: xauth\\n token_type: X-Auth-Token\\n # token encoded in Base64\\n token: 604bbe45ac7143a79e14f3158df67091\\n\\n\\nartifact_types:\\n tosca.artifacts.Deployment.Image.Container.Docker:\\n derived_from: tosca.artifacts.Deployment.Image\\n\\n\\ndata_types:\\n Switch.datatypes.QoS.AppComponent:\\n derived_from: tosca.datatypes.Root\\n properties:\\n response_time:\\n type: string\\n\\n Switch.datatypes.Application.Connection.EndPoint:\\n derived_from: tosca.datatypes.Root\\n properties:\\n address:\\n type: string\\n component_name:\\n type: string\\n netmask:\\n type: string\\n port_name:\\n type: string\\n\\n Switch.datatypes.Application.Connection.Multicast:\\n derived_from: tosca.datatypes.Root\\n properties:\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n\\n Switch.datatypes.Network.EndPoint:\\n derived_from: tosca.datatypes.Root\\n properties:\\n address:\\n type: string\\n host_name:\\n type: string\\n netmask:\\n type: string\\n port_name:\\n type: string\\n\\n Switch.datatypes.Network.Multicast:\\n derived_from: tosca.datatypes.Root\\n properties:\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n\\n\\nnode_types:\\n\\n Switch.nodes.Application.Container.Docker:\\n derived_from: tosca.nodes.Container.Application\\n properties:\\n QoS:\\n type: Switch.datatypes.QoS.AppComponent\\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n interfaces:\\n Standard:\\n create:\\n inputs:\\n command:\\n type: string\\n exported_ports:\\n type: list\\n entry_schema:\\n type: string\\n port_bindings:\\n type: list\\n entry_schema:\\n type: string\\n\\n Switch.nodes.Application.Container.Docker.MOG.InputDistributor:\\n derived_from: Switch.nodes.Application.Container.Docker\\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n file: \"mogswitch/InputDistributor:1.0\"\\n repository: MOG_docker_hub\\n properties:\\n inPort: \\n type: integer\\n waitingTime:\\n type: integer\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n videoWidth:\\n type: integer\\n videoHeight:\\n type: integer\\n\\n Switch.nodes.Application.Container.Docker.MOG.ProxyTranscoder:\\n derived_from: Switch.nodes.Application.Container.Docker \\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n file: \"mogswitch/ProxyTranscoder:1.0\"\\n repository: MOG_docker_hub\\n properties:\\n multicastAddrIP: \\n type: string\\n multicastAddrPort:\\n type: integer\\n videoWidth:\\n type: integer\\n videoHeight:\\n type: integer\\n\\n Switch.nodes.Application.Connection:\\n derived_from: tosca.nodes.Root \\n properties:\\n source:\\n type: Switch.datatypes.Application.Connection.EndPoint\\n target:\\n type: Switch.datatypes.Application.Connection.EndPoint\\n bandwidth:\\n type: string\\n latency: \\n type: string\\n jitter: \\n type: string\\n multicast:\\n type: Switch.datatypes.Application.Connection.Multicast\\n\\n Switch.nodes.Compute:\\n derived_from: tosca.nodes.Compute\\n properties:\\n OStype:\\n type: string\\n nodetype:\\n type: string\\n domain:\\n type: string\\n public_address:\\n type: string\\n \n"
+ " ethernet_port:\\n type: list\\n entry_schema:\\n type: tosca.datatypes.network.NetworkInfo\\n script:\\n type: string\\n installation:\\n type: string\\n ssh_credential:\\n type: tosca.datatypes.Credential\\n\\n Switch.nodes.Network:\\n derived_from: tosca.nodes.network.Network\\n properties:\\n bandwidth:\\n type: string\\n latency:\\n type: string\\n jitter:\\n type: string\\n source:\\n type: Switch.datatypes.Network.EndPoint\\n target:\\n type: Switch.datatypes.Network.EndPoint\\n multicast:\\n type: Switch.datatypes.Network.Multicast\\n\\n\\ntopology_template:\\n \\n node_templates:\\n 2d13d708e3a9441ab8336ce874e08dd1:\\n type: Switch.nodes.Application.Container.Docker.MOG.InputDistributor\\n artifacts:\\n docker_image:\\n file: \"mogswitch/InputDistributor:1.0\"\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n repository: MOG_docker_hub\\n properties:\\n QoS:\\n response_time: 30ms\\n inPort: 2000\\n waitingTime: 5\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n videoWidth: 176\\n videoHeight: 100\\n interfaces:\\n Standard:\\n create:\\n implementation: docker_image\\n inputs:\\n command: InputDistributor\\n exported_ports:\\n - 2000\\n port_bindings:\\n - \"2000:2000\"\\n - \"3000:3000\"\\n\\n 8fcc1788d9ee462c826572c79fdb2a6a:\\n type: Switch.nodes.Application.Container.Docker.MOG.ProxyTranscoder\\n artifacts:\\n docker_image:\\n file: \"mogswitch/ProxyTranscoder:1.0\"\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n repository: MOG_docker_hub\\n properties:\\n QoS:\\n response_time: 30ms\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n videoWidth: 176\\n videoHeight: 100\\n interfaces:\\n Standard:\\n create:\\n implementation: docker_image\\n inputs:\\n command: ProxyTranscoder\\n exported_ports:\\n - 80\\n port_bindings:\\n - \"8080:80\"\\n\\n 5e0add703c8a43938a39301f572e46c0:\\n type: Switch.nodes.Application.Connection\\n properties:\\n source:\\n address: 192.168.21.11\\n component_name: 2d13d708e3a9441ab8336ce874e08dd1\\n netmask: 255.255.255.0\\n port_name: \"inputDistributor_out\"\\n target:\\n address: 192.168.21.12\\n component_name: 8fcc1788d9ee462c826572c79fdb2a6a\\n netmask: 255.255.255.0\\n port_name: \"proxyTranscoder_in\"\\n latency: 30ms\\n bandwidth: 130MB/s\\n jitter: 500ms\\n multicast:\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n")
public String getFile() {
return file;
}
/**
* @param file the file to set
*/
public void setFile(String file) {
this.file = file;
}
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v0.types;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Result {
}
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import org.springframework.data.annotation.Id;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
/**
*
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import java.util.Date;
import java.util.List;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.Map;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import java.io.Serializable;
import java.util.List;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import java.io.Serializable;
import java.util.Map;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import java.util.Map;
import java.util.Set;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import java.util.List;
import java.util.Map;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import java.util.Map;
import org.springframework.data.annotation.Id;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.types;
package nl.uva.sne.drip.commons.v1.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import org.springframework.data.annotation.Id;
......
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