summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java4
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java3
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java42
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java45
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java22
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json2
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json2
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json2
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json2
9 files changed, 98 insertions, 26 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
index 89c100d084..29f27d05e9 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
@@ -32,13 +32,13 @@ import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
*/
public class AaiUtil {
- public static RestfulResponse addRelation(String serviceInstanceID, String resourceInstanceID)
+ public static RestfulResponse addRelation(String globalSubsriberId, String serviceType, String serviceInstanceId, String resourceInstanceId)
{
//sent rest to aai to add relation for service and ns.
return null;
}
- public static RestfulResponse removeRelation(String serviceInstanceID ,String resourceInstanceID)
+ public static RestfulResponse removeRelation(String globalSubsriberId, String serviceType, String serviceInstanceId ,String resourceInstanceId)
{
//sent rest to aai to remove relation between service an ns.
return null;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
index 438393bc35..f4c295337a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
@@ -22,6 +22,7 @@ package org.openecomp.mso.adapters.vfc;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -92,7 +93,7 @@ public class VfcAdapterRest {
* @return response
* @since ONAP Amsterdam Release
*/
- @POST
+ @DELETE
@Path("/ns/{nsInstanceId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
index f4572c8351..c2d5fe241c 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.adapters.vfc;
import java.util.HashMap;
@@ -51,7 +52,7 @@ import org.slf4j.LoggerFactory;
* </p>
*
* @author
- * @version ONAP Amsterdam Release 2017-08-28
+ * @version ONAP Amsterdam Release 2017-08-28
*/
public class VfcManager {
@@ -71,14 +72,15 @@ public class VfcManager {
nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
}
- public VfcManager(){
-
+ public VfcManager() {
+
}
+
/**
* create network service
* <br>
*
- * @param segInput input parameters for current node from http request
+ * @param segInput input parameters for current node from http request
* @return
* @since ONAP Amsterdam Release
*/
@@ -117,7 +119,9 @@ public class VfcManager {
LOGGER.info("create ns -> end");
LOGGER.info("save segment and operaton info -> begin");
// Step 5: add relation between service and NS
- AaiUtil.addRelation(segInput.getNsOperationKey().getServiceId(), nsInstanceId);
+ AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
+ segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
+ nsInstanceId);
// Step 6: save resource operation information
ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
@@ -146,7 +150,7 @@ public class VfcManager {
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException{
+ public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException {
LOGGER.info("delete ns -> begin");
// Step1: prepare url and methodType
String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE);
@@ -158,8 +162,8 @@ public class VfcManager {
LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus());
LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent());
LOGGER.info("delete ns -> end");
- ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
- nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
if(!HttpCode.isSucess(deleteRsp.getStatus())) {
LOGGER.error("fail to delete ns");
@@ -171,7 +175,8 @@ public class VfcManager {
}
// Step3: remove relation info between service and ns
- AaiUtil.removeRelation(nsOperationKey.getServiceId(), nsInstanceId);
+ AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(),
+ nsOperationKey.getServiceId(), nsInstanceId);
LOGGER.info("delete segment information -> end");
// Step4: update service segment operation status
@@ -188,12 +193,13 @@ public class VfcManager {
* instantiate network service
* <br>
*
- * @param nsInstanceId The NS instance id
+ * @param nsInstanceId The NS instance id
* @param segInput input parameters for current node from http request
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) throws ApplicationException{
+ public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput)
+ throws ApplicationException {
// Call the NFVO or SDNO service to instantiate service
LOGGER.info("instantiate ns -> begin");
@@ -257,11 +263,11 @@ public class VfcManager {
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException{
+ public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException {
// Step1: save segment operation info for delete process
LOGGER.info("save segment operation for delete process");
- ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
- nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
(RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
@@ -322,12 +328,12 @@ public class VfcManager {
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException{
+ public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException {
ValidateUtil.assertObjectNotNull(jobId);
// Step 1: query the current resource operation status
- ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
- nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
// Step 2: start query
LOGGER.info("query ns status -> begin");
@@ -338,7 +344,7 @@ public class VfcManager {
ValidateUtil.assertObjectNotNull(rsp);
LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
- //Step 3:check the response staus
+ // Step 3:check the response staus
if(!HttpCode.isSucess(rsp.getStatus())) {
LOGGER.info("fail to query job status");
nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java
index d6cfbde906..e4d6d66cda 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java
@@ -31,6 +31,16 @@ package org.openecomp.mso.adapters.vfc.model;
public class NsOperationKey {
/**
+ * The subscriber id
+ */
+ private String globalSubscriberId;
+
+ /**
+ * The serviceType
+ */
+ private String serviceType;
+
+ /**
* The service ID
*/
private String serviceId;
@@ -45,6 +55,41 @@ public class NsOperationKey {
*/
private String nodeTemplateUUID;
+
+
+
+ /**
+ * @return Returns the globalSubscriberId.
+ */
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+
+ /**
+ * @param globalSubscriberId The globalSubscriberId to set.
+ */
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ /**
+ * @return Returns the serviceType.
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+
+
+ /**
+ * @param serviceType The serviceType to set.
+ */
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+
/**
*
* <br>
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
index 4c316f3196..f17c7215cf 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
@@ -95,9 +95,16 @@ public class VfcAdapterTest {
*/
@Mock
public RestfulResponse send(String url, String methodType, String content) {
- if(url.contains(CommonConstant.NFVO_CREATE_URL) && methodType.equals(CommonConstant.MethodType.POST)) {
+ if(url.equals(CommonConstant.NFVO_CREATE_URL) && methodType.equals(CommonConstant.MethodType.POST)) {
return getResponse("createNsRsp.json");
- } else {
+ } else if(url.contains("instantiate") && methodType.equals(CommonConstant.MethodType.POST)) {
+ return getResponse("instantiateNsRsp.json");
+ } else if(methodType.equals(CommonConstant.MethodType.DELETE)) {
+ return getResponse(null);
+ } else if(url.contains("terminate") && methodType.equals(CommonConstant.MethodType.POST)) {
+ return getResponse("terminateNsRsp.json");
+ }
+ else {
return null;
}
}
@@ -175,17 +182,22 @@ public class VfcAdapterTest {
@Test
public void deleteTest() {
-
+ // get request
+ mockRestfulUtil(FILE_PATH + "deleteNsReq.json");
+ vfcAdapter.deleteNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
}
@Test
public void instantiateTest() {
-
+ // get request
+ mockRestfulUtil(FILE_PATH + "instantiateNsReq.json");
+ vfcAdapter.instantiateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
}
@Test
public void terminateTest() {
-
+ mockRestfulUtil(FILE_PATH + "terminateNsReq.json");
+ vfcAdapter.terminateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
}
@Test
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
index da50897b7c..9534e5ece5 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
@@ -2,6 +2,8 @@
"nsServiceName":"vIMS",
"nsServiceDescription":"vIMS NS",
"nsOperationKey":{
+ "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350",
+ "serviceType":"service",
"serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351",
"operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352",
"nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353"
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json
index 4f7c29f9d0..ac095e6aa3 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json
@@ -1,4 +1,6 @@
{
+ "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350",
+ "serviceType":"service",
"serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351",
"operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352",
"nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353"
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
index da50897b7c..9534e5ece5 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
@@ -2,6 +2,8 @@
"nsServiceName":"vIMS",
"nsServiceDescription":"vIMS NS",
"nsOperationKey":{
+ "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350",
+ "serviceType":"service",
"serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351",
"operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352",
"nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353"
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json
index 4f7c29f9d0..ac095e6aa3 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json
@@ -1,4 +1,6 @@
{
+ "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350",
+ "serviceType":"service",
"serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351",
"operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352",
"nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353"