summaryrefslogtreecommitdiffstats
path: root/adapters/mso-vfc-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-vfc-adapter')
-rw-r--r--adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml2
-rw-r--r--adapters/mso-vfc-adapter/pom.xml190
-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.java103
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java87
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java57
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java9
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java45
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java34
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java112
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java19
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java25
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java5
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java244
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/LICENSE.txt19
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json32
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/createNsRsp.json3
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json7
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json32
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsRsp.json3
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/queryJobReq.json7
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/queryJobRsp.json10
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json7
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/terminateNsRsp.json3
24 files changed, 712 insertions, 347 deletions
diff --git a/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
index 5bf8864351..160dfb81bf 100644
--- a/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
+++ b/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
@@ -38,7 +38,7 @@
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
- <url-pattern>/rest/*</url-pattern>
+ <url-pattern>/vfcadapter/*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml
index 4f049c350f..fcf0682ca5 100644
--- a/adapters/mso-vfc-adapter/pom.xml
+++ b/adapters/mso-vfc-adapter/pom.xml
@@ -1,89 +1,94 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.openecomp.so</groupId>
- <artifactId>adapters</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
- <groupId>org.openecomp.so.adapters</groupId>
- <artifactId>mso-vfc-adapter</artifactId>
- <packaging>war</packaging>
- <name>mso-vfc-adapter</name>
- <description>Web service endpoint for vfc operations</description>
-
- <!-- <properties> -->
- <!-- <project.build.sourceEncoding/> -->
- <!-- <project.reporting.outputEncoding/> -->
- <!-- </properties> -->
-
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <warSourceDirectory>WebContent</warSourceDirectory>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- <attachClasses>true</attachClasses>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax</groupId>
- <artifactId>javaee-web-api</artifactId>
- <version>6.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so.adapters</groupId>
- <artifactId>mso-adapter-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so.adapters</groupId>
- <artifactId>mso-adapters-rest-interface</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.ejb</groupId>
- <artifactId>jboss-ejb-api_3.2_spec</artifactId>
- <version>1.0.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>2.2.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>status-control</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>mso-requests-db</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>adapters</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.openecomp.so.adapters</groupId>
+ <artifactId>mso-vfc-adapter</artifactId>
+ <packaging>war</packaging>
+ <name>mso-vfc-adapter</name>
+ <description>Web service endpoint for vfc operations</description>
+ <!-- <properties> -->
+ <!-- <project.build.sourceEncoding/> -->
+ <!-- <project.reporting.outputEncoding/> -->
+ <!-- </properties> -->
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <warSourceDirectory>WebContent</warSourceDirectory>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ <attachClasses>true</attachClasses>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!--<dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-web-api</artifactId>
+ <version>6.0</version>
+ <scope>provided</scope>
+ </dependency>-->
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.so.adapters</groupId>
+ <artifactId>mso-adapter-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.so.adapters</groupId>
+ <artifactId>mso-adapters-rest-interface</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.10.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.2_spec</artifactId>
+ <version>1.0.0.Final</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-ext-api</artifactId>
+ <version>2.2.0.Final</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>status-control</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.19</version>
@@ -101,5 +106,16 @@
<version>1.19</version>
<scope>test</scope>
</dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ <version>2.22.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ </dependencies>
</project>
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 1be5bab1c3..684933f3a9 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
@@ -17,10 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
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;
@@ -29,6 +31,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
+import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
import org.openecomp.mso.adapters.vfc.model.NSResourceInputParameter;
import org.openecomp.mso.adapters.vfc.model.NsOperationKey;
import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
@@ -44,15 +47,19 @@ import org.openecomp.mso.logger.MsoLogger;
* </p>
*
* @author
- * @version ONAP Amsterdam Release 2017-08-28
+ * @version ONAP Amsterdam Release 2017-08-28
*/
-@Path("/v1/vfcdrivers")
+@Path("/vfcadapter/v1")
public class VfcAdapterRest {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
private final VfcManager driverMgr = new VfcManager();
+ public VfcAdapterRest() {
+
+ }
+
/**
* Create a NS
* <br>
@@ -67,12 +74,16 @@ public class VfcAdapterRest {
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response createNfvoNs(HttpServletRequest servletReq) {
// Step 1: get parameters from request for current node
- String body = RestfulUtil.getRequestBody(servletReq);
- ValidateUtil.assertObjectNotNull(body);
- LOGGER.debug("body from request is {}" + body);
- NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
- RestfulResponse rsp = driverMgr.createNs(nsInput);
- return buildResponse(rsp);
+ try {
+ String body = RestfulUtil.getRequestBody(servletReq);
+ ValidateUtil.assertObjectNotNull(body);
+ LOGGER.debug("body from request is {}" + body);
+ NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
+ RestfulResponse rsp = driverMgr.createNs(nsInput);
+ return buildResponse(rsp);
+ } catch(ApplicationException e) {
+ return e.buildErrorResponse();
+ }
}
/**
@@ -82,19 +93,22 @@ 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})
public Response deleteNfvoNs(HttpServletRequest servletReq, @PathParam("nsInstanceId") String nsInstanceId) {
- // Step 1: get parameters from request for current node
- String body = RestfulUtil.getRequestBody(servletReq);
- ValidateUtil.assertObjectNotNull(body);
- LOGGER.debug("body from request is {}" + body);
- NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
-
- RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
- return buildResponse(rsp);
+ try {
+ // Step 1: get parameters from request for current node
+ String body = RestfulUtil.getRequestBody(servletReq);
+ ValidateUtil.assertObjectNotNull(body);
+ LOGGER.debug("body from request is {}" + body);
+ NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+ RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
+ return buildResponse(rsp);
+ } catch(ApplicationException e) {
+ return e.buildErrorResponse();
+ }
}
/**
@@ -102,7 +116,7 @@ public class VfcAdapterRest {
* <br>
*
* @param servletReq The Http Request
- * @param jobId The job id
+ * @param jobId The job id
* @return
* @since ONAP Amsterdam Release
*/
@@ -111,15 +125,19 @@ public class VfcAdapterRest {
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response queryNfvoJobStatus(HttpServletRequest servletReq, @PathParam("jobId") String jobId) {
- ValidateUtil.assertObjectNotNull(jobId);
- String body = RestfulUtil.getRequestBody(servletReq);
- ValidateUtil.assertObjectNotNull(body);
- LOGGER.debug("body from request is {}" + body);
- NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
- RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
- return buildResponse(rsp);
- }
+ try {
+ ValidateUtil.assertObjectNotNull(jobId);
+ String body = RestfulUtil.getRequestBody(servletReq);
+ ValidateUtil.assertObjectNotNull(body);
+ LOGGER.debug("body from request is {}" + body);
+ NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+ RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
+ return buildResponse(rsp);
+ } catch(ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
/**
* Instantiate NS instance
@@ -136,11 +154,15 @@ public class VfcAdapterRest {
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response instantiateNfvoNs(HttpServletRequest servletReq, @PathParam("nsInstanceId") String nsInstanceId) {
String body = RestfulUtil.getRequestBody(servletReq);
- ValidateUtil.assertObjectNotNull(body);
- LOGGER.debug("body from request is {}" + body);
- NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
- RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
- return buildResponse(rsp);
+ try {
+ ValidateUtil.assertObjectNotNull(body);
+ LOGGER.debug("body from request is {}" + body);
+ NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
+ RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
+ return buildResponse(rsp);
+ } catch(ApplicationException e) {
+ return e.buildErrorResponse();
+ }
}
/**
@@ -157,16 +179,19 @@ public class VfcAdapterRest {
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response terminateNfvoNs(HttpServletRequest servletReq, @PathParam("nsInstanceId") String nsInstanceId) {
- ValidateUtil.assertObjectNotNull(nsInstanceId);
- String body = RestfulUtil.getRequestBody(servletReq);
- ValidateUtil.assertObjectNotNull(body);
- LOGGER.debug("body from request is {}" + body);
- NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
- RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
- return buildResponse(rsp);
+ try {
+ ValidateUtil.assertObjectNotNull(nsInstanceId);
+ String body = RestfulUtil.getRequestBody(servletReq);
+ ValidateUtil.assertObjectNotNull(body);
+ LOGGER.debug("body from request is {}" + body);
+ NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+ RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
+ return buildResponse(rsp);
+ } catch(ApplicationException e) {
+ return e.buildErrorResponse();
+ }
}
-
/**
* build response from restful response
* <br>
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 afea05c2bb..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,18 +72,22 @@ public class VfcManager {
nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
}
+ 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
*/
- public RestfulResponse createNs(NSResourceInputParameter segInput) {
+ public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException {
// Step1: get service template by node type
- String nsdId = segInput.getNsOperationKey().getNodeTemplateId();
+ String nsdId = segInput.getNsOperationKey().getNodeTemplateUUID();
// nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id"
LOGGER.info("serviceTemplateId is {}, id is {}", nsdId);
@@ -94,8 +99,8 @@ public class VfcManager {
// Step3: Prepare restful parameters and options
NsCreateReq oRequest = new NsCreateReq();
oRequest.setNsdId(nsdId);
- oRequest.setNsName(segInput.getSubServiceName());
- oRequest.setDescription(segInput.getSubServiceDesc());
+ oRequest.setNsName(segInput.getNsServiceName());
+ oRequest.setDescription(segInput.getNsServiceDescription());
String createReq = JsonUtil.marshal(oRequest);
// Step4: Call NFVO or SDNO lcm to create ns
@@ -114,20 +119,22 @@ 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.getResourceOperationStatus(
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
- segInput.getNsOperationKey().getNodeTemplateId());
+ segInput.getNsOperationKey().getNodeTemplateUUID());
nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
if(!HttpCode.isSucess(createRsp.getStatus())) {
LOGGER.error("update segment operation status : fail to create ns");
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setErrorCode(String.valueOf(createRsp.getStatus()));
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS);
}
LOGGER.info("save segment and operation info -> end");
@@ -143,7 +150,7 @@ public class VfcManager {
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) {
+ 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);
@@ -155,26 +162,27 @@ 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.getResourceOperationStatus(nsOperationKey.getServiceId(),
- nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateId());
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
if(!HttpCode.isSucess(deleteRsp.getStatus())) {
LOGGER.error("fail to delete ns");
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS);
}
// 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
nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
LOGGER.info("update segment operaton status for delete -> end");
return deleteRsp;
@@ -185,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) {
+ public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput)
+ throws ApplicationException {
// Call the NFVO or SDNO service to instantiate service
LOGGER.info("instantiate ns -> begin");
@@ -213,15 +222,15 @@ public class VfcManager {
@SuppressWarnings("unchecked")
Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class);
String jobId = rsp.get(CommonConstant.JOB_ID);
- ResourceOperationStatus nsOperInfo = RequestsDatabase.getResourceOperationStatus(
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
- segInput.getNsOperationKey().getNodeTemplateId());
+ segInput.getNsOperationKey().getNodeTemplateUUID());
if(ValidateUtil.isStrEmpty(jobId)) {
LOGGER.error("Invalid jobId from instantiate operation");
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
}
@@ -232,14 +241,14 @@ public class VfcManager {
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
}
// Step 3: update segment operation job id
LOGGER.info("update resource operation status job id -> begin");
nsOperInfo.setJobId(jobId);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
LOGGER.info("update segment operation job id -> end");
return instRsp;
@@ -254,13 +263,13 @@ public class VfcManager {
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) {
+ 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.getResourceOperationStatus(nsOperationKey.getServiceId(),
- nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateId());
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
LOGGER.info("terminate ns -> begin");
// Step2: prepare url and method type
@@ -286,7 +295,7 @@ public class VfcManager {
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION);
}
@@ -298,13 +307,13 @@ public class VfcManager {
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS);
}
LOGGER.info("update segment job id -> begin");
nsOperInfo.setJobId(jobId);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
LOGGER.info("update segment job id -> end");
return terminateRsp;
@@ -319,12 +328,12 @@ public class VfcManager {
* @return
* @since ONAP Amsterdam Release
*/
- public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) {
+ public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException {
ValidateUtil.assertObjectNotNull(jobId);
// Step 1: query the current resource operation status
- ResourceOperationStatus nsOperInfo = RequestsDatabase.getResourceOperationStatus(nsOperationKey.getServiceId(),
- nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateId());
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
// Step 2: start query
LOGGER.info("query ns status -> begin");
@@ -335,13 +344,13 @@ 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()));
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
}
// Step 4: Process Network Service Instantiate Response
@@ -351,7 +360,7 @@ public class VfcManager {
nsOperInfo.setProgress(rspDesc.getProgress());
nsOperInfo.setStatusDescription(rspDesc.getStatusDescription());
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
// Step 6: update segment operation status
if(RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress())
@@ -363,13 +372,13 @@ public class VfcManager {
if(RequestsDbConstant.OperationType.CREATE.equals(nsOperInfo.getOperType())) {
nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
}
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
} else if(RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) {
LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType());
nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
- RequestsDatabase.updateResOperStatus(nsOperInfo);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
} else {
LOGGER.error("unexcepted response status");
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java
index b2fc4457a0..471ba43b2b 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java
@@ -32,62 +32,15 @@ public class CommonConstant {
public static final String STR_EMPTY = "";
- public static final String NFVO_CREATE_URL = "/openoapi/nslcm/v1/ns";
+ public static final String NFVO_CREATE_URL = "/api/nslcm/v1/ns";
- public static final String NFVO_INSTANTIATE_URL = "/openoapi/nslcm/v1/ns/%s/instantiate";
+ public static final String NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns/%s/instantiate";
- public static final String NFVO_TERMINATE_URL = "/openoapi/nslcm/v1/ns/%s/terminate";
+ public static final String NFVO_TERMINATE_URL = "/api/nslcm/v1/ns/%s/terminate";
- public static final String NFVO_DELETE_URL = "/openoapi/nslcm/v1/ns/%s";
+ public static final String NFVO_DELETE_URL = "/api/nslcm/v1/ns/%s";
- public static final String NFVO_QUERY_URL = "/openoapi/nslcm/v1/jobs/%s";
-
-
- public static final String LEFT_QUOTE_LEFT_BRACE = "\"\\{";
-
- public static final String LEFT_BRACE = "\\{";
-
- public static final String RIGHT_BRACE_RIGHT_QUOTE = "\\}\"";
-
- public static final String RIGHT_BRACE = "\\}";
-
- public static final String LEFT_QUOTE_LEFT_BRACKET = "\"\\[";
-
- public static final String LEFT_BRACKET = "\\[";
-
- public static final String RIGHT_BRACKET_RIGHT_QUOTE = "\\]\"";
-
- public static final String RIGHT_BRACKET = "\\]";
-
- /**
- * HttpContext constant
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
- public static class HttpContext {
-
- public static final String CONTENT_TYPE = "Content-Type";
-
- public static final String MEDIA_TYPE_JSON = "application/json;charset=UTF-8";
-
- public static final String URL = "url";
-
- public static final String METHOD_TYPE = "methodType";
-
- public static final String IP = "ip";
-
- public static final String PORT = "port";
-
- public static final String RAW_DATA = "rawData";
-
- private HttpContext() {
-
- }
- }
+ public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s";
/**
*
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
index 652de97f5f..a160b82e8a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.adapters.vfc.constant;
/**
@@ -30,12 +31,6 @@ package org.openecomp.mso.adapters.vfc.constant;
*/
public class DriverExceptionID {
- public static final String INVALID_PARAM = "Invalid parameter";
-
- public static final String INTERNAL_ERROR = "Internal error";
-
- public static final String FAILED_TO_SVCTMPL_CATALOGUE = "Failed to get service template from catalogue";
-
public static final String INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION =
"Invalid response from instantiate operation";
@@ -45,8 +40,6 @@ public class DriverExceptionID {
public static final String FAIL_TO_CREATE_NS = "Fail to create ns";
- public static final String INVALID_RESPONSEE_FROM_DELETE_OPERATION = "Invalid response from delete operation";
-
public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION = "Invalid response from terminate operation";
public static final String FAIL_TO_DELETE_NS = "Fail to delete ns";
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
index 6a78d2e73e..61966d07f2 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
@@ -17,19 +17,22 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.adapters.vfc.exceptions;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response;;
-public class ApplicationException extends WebApplicationException {
+public class ApplicationException extends Exception {
/**
* Serial number.
*/
private static final long serialVersionUID = 1L;
+ private int errorCode;
+
+ private String errorMsg;
+
/**
* Constructor<br/>
* <p>
@@ -37,9 +40,37 @@ public class ApplicationException extends WebApplicationException {
*
* @param errorCode error status
* @param errorDetail error detail
- * @since ONAP Amsterdam Release 2017-9-6
+ * @since ONAP Amsterdam Release 2017-9-6
+ */
+ public ApplicationException(int errorCode, String errorMsg) {
+ this.errorCode = errorCode;
+ this.errorMsg = errorMsg;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorMsg() {
+ return errorMsg;
+ }
+
+ public void setErrorMsg(String errorMsg) {
+ this.errorMsg = errorMsg;
+ }
+
+ /**
+ * build error Response
+ * <br>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
*/
- public ApplicationException(int errorCode, Object errorDetail) {
- super(Response.status(errorCode).entity(errorDetail).type(MediaType.APPLICATION_JSON).build());
+ public Response buildErrorResponse() {
+ return Response.status(errorCode).entity(errorMsg).build();
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java
index ca1807ce62..f88a11dee8 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java
@@ -30,38 +30,44 @@ public class NSResourceInputParameter {
private NsOperationKey nsOperationKey;
- private String subServiceName;
+ private String nsServiceName;
- private String subServiceDesc;
+ private String nsServiceDescription;
private NsParameters nsParameters;
+
+
+
/**
- * @return Returns the subServiceName.
+ * @return Returns the nsServiceName.
*/
- public String getSubServiceName() {
- return subServiceName;
+ public String getNsServiceName() {
+ return nsServiceName;
}
+
/**
- * @param subServiceName The subServiceName to set.
+ * @param nsServiceName The nsServiceName to set.
*/
- public void setSubServiceName(String subServiceName) {
- this.subServiceName = subServiceName;
+ public void setNsServiceName(String nsServiceName) {
+ this.nsServiceName = nsServiceName;
}
+
/**
- * @return Returns the subServiceDesc.
+ * @return Returns the nsServiceDescription.
*/
- public String getSubServiceDesc() {
- return subServiceDesc;
+ public String getNsServiceDescription() {
+ return nsServiceDescription;
}
+
/**
- * @param subServiceDesc The subServiceDesc to set.
+ * @param nsServiceDescription The nsServiceDescription to set.
*/
- public void setSubServiceDesc(String subServiceDesc) {
- this.subServiceDesc = subServiceDesc;
+ public void setNsServiceDescription(String nsServiceDescription) {
+ this.nsServiceDescription = nsServiceDescription;
}
/**
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 2c61d805ef..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
@@ -19,43 +19,135 @@
*/
package org.openecomp.mso.adapters.vfc.model;
-
+/**
+ * The operation key object for NS
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-09-15
+ */
public class NsOperationKey {
+ /**
+ * The subscriber id
+ */
+ private String globalSubscriberId;
+
+ /**
+ * The serviceType
+ */
+ private String serviceType;
+
+ /**
+ * The service ID
+ */
private String serviceId;
+ /**
+ * The Operation ID
+ */
private String operationId;
- private String nodeTemplateId;
+ /**
+ * the NS template uuid
+ */
+ 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>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
+ */
public String getServiceId() {
return serviceId;
}
-
+ /**
+ *
+ * <br>
+ *
+ * @param serviceId
+ * @since ONAP Amsterdam Release
+ */
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
-
+ /**
+ *
+ * <br>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
+ */
public String getOperationId() {
return operationId;
}
-
+ /**
+ *
+ * <br>
+ *
+ * @param operationId
+ * @since ONAP Amsterdam Release
+ */
public void setOperationId(String operationId) {
this.operationId = operationId;
}
- public String getNodeTemplateId() {
- return nodeTemplateId;
+ /**
+ * @return Returns the nodeTemplateUUID.
+ */
+ public String getNodeTemplateUUID() {
+ return nodeTemplateUUID;
}
- public void setNodeTemplateId(String nodeTemplateId) {
- this.nodeTemplateId = nodeTemplateId;
+ /**
+ * @param nodeTemplateUUID The nodeTemplateUUID to set.
+ */
+ public void setNodeTemplateUUID(String nodeTemplateUUID) {
+ this.nodeTemplateUUID = nodeTemplateUUID;
}
-
+
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
index 34beb02c13..a9546d5c4c 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.adapters.vfc.util;
import java.io.IOException;
@@ -29,7 +30,6 @@ import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
-
/**
* Interface for json analyzing.<br/>
* <p>
@@ -43,7 +43,7 @@ public class JsonUtil {
/**
* Log service
*/
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
/**
* Mapper.
@@ -75,11 +75,12 @@ public class JsonUtil {
* @return model object
* @since ONAP Amsterdam Release 2017-9-6
*/
- public static <T> T unMarshal(String jsonstr, Class<T> type) {
+ public static <T> T unMarshal(String jsonstr, Class<T> type) throws ApplicationException {
try {
return MAPPER.readValue(jsonstr, type);
} catch(IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "","", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e);
+ LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ "fail to unMarshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json");
}
}
@@ -92,11 +93,12 @@ public class JsonUtil {
* @return model object
* @since ONAP Amsterdam Release 2017-9-6
*/
- public static <T> T unMarshal(String jsonstr, TypeReference<T> type) {
+ public static <T> T unMarshal(String jsonstr, TypeReference<T> type) throws ApplicationException {
try {
return MAPPER.readValue(jsonstr, type);
} catch(IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "","", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e);
+ LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ "fail to unMarshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json");
}
}
@@ -108,11 +110,12 @@ public class JsonUtil {
* @return json string
* @since ONAP Amsterdam Release 2017-9-6
*/
- public static String marshal(Object srcObj) {
+ public static String marshal(Object srcObj) throws ApplicationException {
try {
return MAPPER.writeValueAsString(srcObj);
} catch(IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "","", MsoLogger.ErrorCode.BusinessProcesssError, "fail to marshal json", e);
+ LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ "fail to marshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
index 19cbca80e3..8e5f0b4274 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,38 +130,44 @@ public class RestfulUtil {
if(httpResponse.getStatusLine().getStatusCode() >= 300) {
String errMsg = "VFC returned " + statusCode + " " + statusMessage;
logError(errMsg);
- return CreateResponse(statusCode, errMsg);
+ return createResponse(statusCode, errMsg);
}
httpResponse = null;
- method.reset();
+ if(null != method) {
+ method.reset();
+ }
+ else {
+ LOGGER.debug("method is NULL:");
+ }
+
method = null;
LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
- return CreateResponse(statusCode, responseContent);
+ return createResponse(statusCode, responseContent);
} catch(SocketTimeoutException e) {
String errMsg = "Request to SDNC timed out";
logError(errMsg, e);
- return CreateResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+ return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
} catch(ConnectTimeoutException e) {
String errMsg = "Request to SDNC timed out";
logError(errMsg, e);
- return CreateResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+ return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
} catch(Exception e) {
String errMsg = "Error processing request to SDNC";
logError(errMsg, e);
- return CreateResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
+ return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
} finally {
if(httpResponse != null) {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch(Exception e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
@@ -168,7 +175,7 @@ public class RestfulUtil {
try {
method.reset();
} catch(Exception e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
}
@@ -184,7 +191,7 @@ public class RestfulUtil {
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
}
- private static RestfulResponse CreateResponse(int statusCode, String content) {
+ private static RestfulResponse createResponse(int statusCode, String content) {
RestfulResponse rsp = new RestfulResponse();
rsp.setStatus(statusCode);
rsp.setResponseContent(content);
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
index 37228c805c..a6fa2d29e2 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.adapters.vfc.util;
import org.openecomp.mso.adapters.vfc.constant.HttpCode;
@@ -49,7 +50,7 @@ public class ValidateUtil {
* @param name of parameter
* @since ONAP Amsterdam Release 2017-9-6
*/
- public static void assertStringNotNull(String paramValue, String paramName) {
+ public static void assertStringNotNull(String paramValue, String paramName) throws ApplicationException {
if(null != paramValue && !paramValue.isEmpty()) {
return;
}
@@ -64,7 +65,7 @@ public class ValidateUtil {
* @param object data object
* @since ONAP Amsterdam Release 2017-9-6
*/
- public static void assertObjectNotNull(Object object) {
+ public static void assertObjectNotNull(Object object) throws ApplicationException {
if(null == object) {
LOGGER.error("Object is null.");
throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null.");
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 46ab134bce..4dc8fffdc6 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
@@ -17,17 +17,29 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc;
+package org.openecomp.mso.adapters.vfc;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mock;
+import org.openecomp.mso.adapters.vfc.constant.CommonConstant;
+import org.openecomp.mso.adapters.vfc.constant.HttpCode;
+import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
import org.openecomp.mso.adapters.vfc.util.RestfulUtil;
import org.openecomp.mso.adapters.vfc.util.ValidateUtil;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.requestsdb.ResourceOperationStatus;
+import mockit.Mock;
import mockit.MockUp;
/**
@@ -37,89 +49,165 @@ import mockit.MockUp;
* </p>
*
* @author
- * @version ONAP Amsterdam Release 2017-08-31
+ * @version ONAP Amsterdam Release 2017-08-31
*/
public class VfcAdapterTest {
- @Mock
- private static CatalogDatabase db;
+ private VfcAdapterRest vfcAdapter = new VfcAdapterRest();
/**
* File path
*/
private static final String FILE_PATH = "src/test/resources/json/";
- @Test
- public void createTest () {
-// // get request
-// mockGetRequestBody(FILE_PATH + "createNfvoNsReq.json");
-// // get service template
-// ServiceTemplate svcTmpl = new ServiceTemplate();
-// svcTmpl.setId("id");
-// svcTmpl.setServiceTemplateId("svcTmplId");
-// new MockUp<CatalogProxyImpl>() {
-// @Mock
-// public ServiceTemplate getSvcTmplByNodeType(String nodeType, String domainHost){
-// return svcTmpl;
-// }
-// };
-// // get response
-// RestfulResponse restRsp = new RestfulResponse();
-// restRsp.setStatus(HttpStatus.SC_OK);
-// restRsp.setResponseJson(getJsonString(FILE_PATH + "createNfvoNsRsp.json"));
-// mockGetRestfulRsp(restRsp);
-// // insert data
-// new MockUp<ServiceSegmentDaoImpl>() {
-// @Mock
-// public void insertSegment(ServiceSegmentModel serviceSegment) {
-// // do nothing
-// }
-// @Mock
-// public void insertSegmentOper(ServiceSegmentOperation svcSegmentOper) {
-// // do nothing
-// }
-// };
-// Response rsp = impl.createNfvoNs(servletReq);
-// JSONObject obj = JSONObject.fromObject(rsp.getEntity());
-// Assert.assertEquals(null, "1", obj.getString("nsInstanceId"));
+ /**
+ * Mock the request body form a file
+ * <br>
+ *
+ * @param fileName
+ * @since ONAP Amsterdam Release
+ */
+ private void mockRestfulUtil(String fileName) {
+ new MockUp<RestfulUtil>() {
+
+ /**
+ * mock get request body
+ * <br>
+ *
+ * @param request
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Mock
+ public String getRequestBody(HttpServletRequest request) {
+ return getJsonString(fileName);
+ }
+
+ /**
+ * mock get send method
+ * <br>
+ *
+ * @param url
+ * @param methodType
+ * @param content
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Mock
+ public RestfulResponse send(String url, String methodType, String content) {
+ if(url.equals(CommonConstant.NFVO_CREATE_URL) && methodType.equals(CommonConstant.MethodType.POST)) {
+ return getResponse("createNsRsp.json");
+ } 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 if(url.contains("/api/nslcm/v1/jobs") && methodType.equals(CommonConstant.MethodType.GET)) {
+ return getResponse("queryJobRsp.json");
+ }
+ else {
+ return null;
+ }
+ }
+ };
}
- @Test
- public void deleteTest () {
-
+ /**
+ * Mock the request body form a file
+ * <br>
+ *
+ * @param fileName
+ * @since ONAP Amsterdam Release
+ */
+ private void mockRequestDatabase() {
+ new MockUp<RequestsDatabase>() {
+
+ /**
+ * mock get resource operation status
+ * <br>
+ *
+ * @param request
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Mock
+ public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId,
+ String resourceTemplateUUID) {
+ ResourceOperationStatus resStatus = new ResourceOperationStatus();
+ resStatus.setServiceId("111");
+ resStatus.setOperationId("111");
+ return resStatus;
+ }
+
+ /**
+ * Mock update Res Oper Status
+ * <br>
+ *
+ * @param operStatus
+ * @since ONAP Amsterdam Release
+ */
+ @Mock
+ public void updateResOperStatus(ResourceOperationStatus operStatus) {
+
+ }
+ };
}
- @Test
- public void instantiateTest () {
+ /**
+ * Before executing UT, start mock requst database
+ * <br>
+ *
+ * @since ONAP Amsterdam Release
+ */
+ @Before
+ public void start() {
+ mockRequestDatabase();
+ }
+
+ /**
+ * After executing UT, close session<br/>
+ *
+ * @since ONAP Amsterdam Release
+ */
+ @After
+ public void stop() {
}
@Test
- public void terminateTest () {
-
+ public void createTest() {
+ // get request
+ mockRestfulUtil(FILE_PATH + "createNsReq.json");
+ vfcAdapter.createNfvoNs(null);
}
@Test
- public void queryJobTest () {
+ 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");
}
-
- /**
- * Mock to get request body.<br/>
- *
- * @param file json file path.
- * @since ONAP Amsterdam Release 2017-9-6
- */
- private void mockGetRequestBody(final String file) {
- new MockUp<RestfulUtil>() {
-// @Mock
-// public String getRequestBody(HttpServletRequest request) {
-// return getJsonString(file);
-// }
- };
+ @Test
+ public void terminateTest() {
+ mockRestfulUtil(FILE_PATH + "terminateNsReq.json");
+ vfcAdapter.terminateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
+ }
+
+ @Test
+ public void queryJobTest() {
+ mockRestfulUtil(FILE_PATH + "queryJobReq.json");
+ vfcAdapter.queryNfvoJobStatus(null, "1");
}
-
+
/**
* Get json string from file.<br/>
*
@@ -128,19 +216,37 @@ public class VfcAdapterTest {
* @throws IOException when fail to read
* @since ONAP Amsterdam Release 2017-9-6
*/
+ @SuppressWarnings("deprecation")
private String getJsonString(final String file) {
if(ValidateUtil.isStrEmpty(file)) {
return "";
}
String json = null;
-// try {
-// FileInputStream fileStream = new FileInputStream(new File(file));
-// json = IOUtils.toString(fileStream);
-// } catch(Exception e) {
-// Assert.fail(e.getMessage());
-// }
-
+ try {
+ FileInputStream fileStream = new FileInputStream(new File(file));
+ json = IOUtils.toString(fileStream);
+ } catch(Exception e) {
+ Assert.fail(e.getMessage());
+ }
return json;
}
+
+ /**
+ * get the response from file
+ * <br>
+ *
+ * @param fileName
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ private RestfulResponse getResponse(String fileName) {
+ RestfulResponse responseSuccess = new RestfulResponse();
+ responseSuccess.setStatus(HttpCode.RESPOND_OK);
+ if(null != fileName) {
+ String jsonStr = getJsonString(FILE_PATH + fileName);
+ responseSuccess.setResponseContent(jsonStr);
+ }
+ return responseSuccess;
+ }
}
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/LICENSE.txt b/adapters/mso-vfc-adapter/src/test/resources/json/LICENSE.txt
new file mode 100644
index 0000000000..bc40e66b0b
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/LICENSE.txt
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */ \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
new file mode 100644
index 0000000000..9534e5ece5
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
@@ -0,0 +1,32 @@
+{
+ "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"
+ },
+ "nsParameters":{
+ "locationConstraints":[
+ {
+ "vnfProfileId":"zte-CSCF-1.0",
+ "locationConstraints":{
+ "vimId":"1"
+ }
+ }
+ ],
+ "additionalParamForNs":{
+ "externalDataNetworkName":"Flow_out_net",
+ "m6000_mng_ip":"181.18.20.2",
+ "externalCompanyFtpDataNetworkName":"Flow_out_net",
+ "externalPluginManageNetworkName":"plugin_net_2014",
+ "externalManageNetworkName":"mng_net_2017",
+ "sfc_data_network":"sfc_data_net_2016",
+ "NatIpRange":"210.1.1.10-210.1.1.20",
+ "location":"4050083f-465f-4838-af1e-47a545222ad0",
+ "sdncontroller":"9b9f02c0-298b-458a-bc9c-be3692e4f35e"
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/createNsRsp.json b/adapters/mso-vfc-adapter/src/test/resources/json/createNsRsp.json
new file mode 100644
index 0000000000..ccd1d66909
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/createNsRsp.json
@@ -0,0 +1,3 @@
+{
+ "nsInstanceId": "9b9f02c0-298b-458a-bc9c-be3692e4f354"
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json
new file mode 100644
index 0000000000..ac095e6aa3
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/deleteNsReq.json
@@ -0,0 +1,7 @@
+{
+ "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"
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
new file mode 100644
index 0000000000..9534e5ece5
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
@@ -0,0 +1,32 @@
+{
+ "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"
+ },
+ "nsParameters":{
+ "locationConstraints":[
+ {
+ "vnfProfileId":"zte-CSCF-1.0",
+ "locationConstraints":{
+ "vimId":"1"
+ }
+ }
+ ],
+ "additionalParamForNs":{
+ "externalDataNetworkName":"Flow_out_net",
+ "m6000_mng_ip":"181.18.20.2",
+ "externalCompanyFtpDataNetworkName":"Flow_out_net",
+ "externalPluginManageNetworkName":"plugin_net_2014",
+ "externalManageNetworkName":"mng_net_2017",
+ "sfc_data_network":"sfc_data_net_2016",
+ "NatIpRange":"210.1.1.10-210.1.1.20",
+ "location":"4050083f-465f-4838-af1e-47a545222ad0",
+ "sdncontroller":"9b9f02c0-298b-458a-bc9c-be3692e4f35e"
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsRsp.json b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsRsp.json
new file mode 100644
index 0000000000..51e4d010d0
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsRsp.json
@@ -0,0 +1,3 @@
+{
+ "jobId":"1"
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/queryJobReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/queryJobReq.json
new file mode 100644
index 0000000000..ac095e6aa3
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/queryJobReq.json
@@ -0,0 +1,7 @@
+{
+ "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"
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/queryJobRsp.json b/adapters/mso-vfc-adapter/src/test/resources/json/queryJobRsp.json
new file mode 100644
index 0000000000..9238b472a7
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/queryJobRsp.json
@@ -0,0 +1,10 @@
+{
+ "jobId": "1",
+ "responseDescriptor": {
+ "progress": "100",
+ "status": "finished",
+ "statusDescription": "OMC VMs are decommissioned in VIM",
+ "errorCode": "",
+ "responseId": "22"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json
new file mode 100644
index 0000000000..ac095e6aa3
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsReq.json
@@ -0,0 +1,7 @@
+{
+ "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"
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsRsp.json b/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsRsp.json
new file mode 100644
index 0000000000..51e4d010d0
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/terminateNsRsp.json
@@ -0,0 +1,3 @@
+{
+ "jobId":"1"
+} \ No newline at end of file