Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18
Issue-ID: SO-670
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
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/onap/so/adapters/vfc/AaiUtil.java
similarity index 93%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/AaiUtil.java
index 7f1a6da..a4f0515 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/onap/so/adapters/vfc/AaiUtil.java
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc;
-import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
+package org.onap.so.adapters.vfc;
+
+import org.onap.so.adapters.vfc.model.RestfulResponse;
/**
* Implement class of operating aai database table <br>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/HealthCheckHandler.java
similarity index 63%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/HealthCheckHandler.java
index 8e163d4..8fcf315 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/HealthCheckHandler.java
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc;
+package org.onap.so.adapters.vfc;
-import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.HealthCheckUtils;
-import org.openecomp.mso.utils.UUIDChecker;
+import org.apache.http.HttpStatus;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.stereotype.Component;
/**
* Health Check
@@ -41,34 +41,25 @@
* @version ONAP Amsterdam Release 2017-08-28
*/
@Path("/")
+@Component
public class HealthCheckHandler {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, HealthCheckHandler.class);
- private static final String MSO_PROP_VFC_ADAPTER = "MSO_PROP_VFC_ADAPTER";
+
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+
+ public static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK)
+ .entity (CHECK_HTML)
+ .build ();
@HEAD
- @GET
@Path("/healthcheck")
@Produces("text/html")
public Response healthcheck(@QueryParam("requestId") String requestId) {
- long startTime = System.currentTimeMillis();
MsoLogger.setServiceName("Healthcheck");
UUIDChecker.verifyOldUUID(requestId, msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils();
- if(!healthCheck.siteStatusCheck(msoLogger)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if(!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_VFC_ADAPTER)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
-
- if(!healthCheck.catalogDBCheck(msoLogger, startTime)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
- msoLogger.debug("healthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
+ return HEALTH_CHECK_RESPONSE;
}
}
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/onap/so/adapters/vfc/VfcAdapterRest.java
similarity index 89%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/VfcAdapterRest.java
index c1f19b7..e07753b 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/onap/so/adapters/vfc/VfcAdapterRest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc;
+package org.onap.so.adapters.vfc;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -29,13 +29,15 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-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;
-import org.openecomp.mso.adapters.vfc.util.JsonUtil;
-import org.openecomp.mso.adapters.vfc.util.ValidateUtil;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.onap.so.adapters.vfc.model.NSResourceInputParameter;
+import org.onap.so.adapters.vfc.model.NsOperationKey;
+import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.onap.so.adapters.vfc.util.JsonUtil;
+import org.onap.so.adapters.vfc.util.ValidateUtil;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
/**
* The rest class for VF-c Adapter <br>
@@ -45,12 +47,14 @@
* @author
* @version ONAP Amsterdam Release 2017-08-28
*/
+@Component
@Path("/v1/vfcadapter")
public class VfcAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VfcAdapterRest.class);
- private final VfcManager driverMgr = new VfcManager();
+ @Autowired
+ private VfcManager driverMgr ;
public VfcAdapterRest() {
@@ -59,7 +63,7 @@
/**
* Create a NS <br>
*
- * @param data the http request
+ * @param data http request
* @return
* @since ONAP Amsterdam Release
*/
@@ -83,7 +87,8 @@
/**
* Delete NS instance<br>
*
- * @param servletReq http request
+ * @param data The http request
+ * @param nsInstanceId The NS instance id
* @return response
* @since ONAP Amsterdam Release
*/
@@ -108,7 +113,7 @@
/**
* Query Operation job status <br>
*
- * @param servletReq The Http Request
+ * @param data The Http Request
* @param jobId The job id
* @return
* @since ONAP Amsterdam Release
@@ -133,7 +138,7 @@
/**
* Instantiate NS instance <br>
*
- * @param servletReq The http request
+ * @param data The http request
* @param nsInstanceId The NS instance id
* @return
* @since ONAP Amsterdam Release
@@ -158,7 +163,7 @@
/**
* Terminate NS instance <br>
*
- * @param servletReq The http request
+ * @param data The http request
* @param nsInstanceId The NS instance id
* @return
* @since ONAP Amsterdam Release
@@ -180,7 +185,7 @@
}
}
- /**
+ /**
* Scale NS instance
* <br>
*
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/VfcManager.java
new file mode 100644
index 0000000..47d3842
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/VfcManager.java
@@ -0,0 +1,496 @@
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.so.adapters.vfc;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.so.adapters.vfc.constant.CommonConstant;
+import org.onap.so.adapters.vfc.constant.CommonConstant.Step;
+import org.onap.so.adapters.vfc.constant.DriverExceptionID;
+import org.onap.so.adapters.vfc.constant.HttpCode;
+import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.onap.so.adapters.vfc.model.CustomerModel;
+import org.onap.so.adapters.vfc.model.NSResourceInputParameter;
+import org.onap.so.adapters.vfc.model.NsCreateReq;
+import org.onap.so.adapters.vfc.model.NsInstantiateReq;
+import org.onap.so.adapters.vfc.model.NsOperationKey;
+import org.onap.so.adapters.vfc.model.NsParameters;
+import org.onap.so.adapters.vfc.model.NsProgressStatus;
+import org.onap.so.adapters.vfc.model.NsScaleParameters;
+import org.onap.so.adapters.vfc.model.ResponseDescriptor;
+import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.onap.so.adapters.vfc.model.VFCScaleData;
+import org.onap.so.adapters.vfc.util.JsonUtil;
+import org.onap.so.adapters.vfc.util.RestfulUtil;
+import org.onap.so.adapters.vfc.util.ValidateUtil;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.onap.so.requestsdb.RequestsDbConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Component;
+
+/**
+ * VF-C Manager <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-08-28
+ */
+@Component
+public class VfcManager {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class);
+
+ /**
+ * nfvo url map
+ */
+ private static Map<String, String> nfvoUrlMap;
+ @Autowired
+ private ResourceOperationStatusRepository resourceOperationStatusRepository;
+
+ @Autowired
+ private RestfulUtil restfulUtil;
+
+ static {
+ nfvoUrlMap = new HashMap<>();
+ nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL);
+ nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL);
+ nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL);
+ nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL);
+ nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
+ nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL);
+ }
+
+ public VfcManager() {
+
+ }
+
+ /**
+ * create network service <br>
+ *
+ * @param segInput input parameters for current node from http request
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException {
+
+ // Step1: get service template by node type
+ String csarId = segInput.getNsServiceModelUUID();
+ // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id"
+ LOGGER.info("serviceTemplateId is {}, id is {}", csarId, csarId);
+
+ LOGGER.info("create ns -> begin");
+ // Step2: Prepare url and method type
+ String url = getUrl(null, CommonConstant.Step.CREATE);
+ String methodType = CommonConstant.MethodType.POST;
+
+ // Step3: Prepare restful parameters and options
+ NsCreateReq oRequest = new NsCreateReq();
+ oRequest.setCsarId(csarId);
+ oRequest.setNsName(segInput.getNsServiceName());
+ oRequest.setDescription(segInput.getNsServiceDescription());
+ CustomerModel context = new CustomerModel();
+ context.setGlobalCustomerId(segInput.getNsOperationKey().getGlobalSubscriberId());
+ context.setServiceType(segInput.getNsOperationKey().getServiceType());
+ oRequest.setContext(context);
+ String createReq = JsonUtil.marshal(oRequest);
+
+ // Step4: Call NFVO or SDNO lcm to create ns
+ RestfulResponse createRsp = restfulUtil.send(url, methodType, createReq);
+ ValidateUtil.assertObjectNotNull(createRsp);
+ LOGGER.info("create ns response status is : {}", createRsp.getStatus());
+ LOGGER.info("create ns response content is : {}", createRsp.getResponseContent());
+
+ // Step 5: save resource operation information
+ ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID());
+ status.setStatus(RequestsDbConstant.Status.PROCESSING);
+ status = resourceOperationStatusRepository.save(status);
+ if (!HttpCode.isSucess(createRsp.getStatus())) {
+ LOGGER.error("update segment operation status : fail to create ns");
+ status.setProgress("40");
+ status.setStatusDescription("NS is created");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(createRsp.getStatus()));
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_CREATE_NS);
+ }
+ @SuppressWarnings("unchecked")
+ Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
+ String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID);
+ if (ValidateUtil.isStrEmpty(nsInstanceId)) {
+ LOGGER.error("Invalid instanceId from create operation");
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
+ }
+ LOGGER.info("create ns -> end");
+ LOGGER.info("save segment and operaton info -> begin");
+ // Step 6: add relation between service and NS
+ AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
+ segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
+ nsInstanceId);
+ LOGGER.info("save segment and operation info -> end");
+ return createRsp;
+ }
+
+ /**
+ * delete network service <br>
+ *
+ * @param nsOperationKey The operation key of the NS resource
+ * @param nsInstanceId The NS instance id
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ 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);
+ String methodType = CommonConstant.MethodType.DELETE;
+
+ // Step2: prepare restful parameters and options
+ RestfulResponse deleteRsp = restfulUtil.send(url, methodType, "");
+ ValidateUtil.assertObjectNotNull(deleteRsp);
+ LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus());
+ LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent());
+ LOGGER.info("delete ns -> end");
+
+ ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ if (!HttpCode.isSucess(deleteRsp.getStatus())) {
+ LOGGER.error("fail to delete ns");
+
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(deleteRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_DELETE_NS);
+ }
+
+ // Step3: remove relation info between service and ns
+ AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(),
+ nsOperationKey.getServiceId(), nsInstanceId);
+ LOGGER.info("delete segment information -> end");
+
+ // Step4: update service segment operation status
+ status.setStatus(RequestsDbConstant.Status.FINISHED);
+ status.setErrorCode(String.valueOf(deleteRsp.getStatus()));
+ status.setProgress("100");
+ status.setStatusDescription("VFC resource deletion finished");
+ resourceOperationStatusRepository.save(status);
+ LOGGER.info("update segment operaton status for delete -> end");
+
+ return deleteRsp;
+
+ }
+
+ /**
+ * instantiate network service <br>
+ *
+ * @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 {
+ // Call the NFVO or SDNO service to instantiate service
+ LOGGER.info("instantiate ns -> begin");
+
+ // Step1: Prepare restful parameters and options
+ NsInstantiateReq oRequest = new NsInstantiateReq();
+ oRequest.setNsInstanceId(nsInstanceId);
+ NsParameters nsParameters = segInput.getNsParameters();
+ oRequest.setLocationConstraints(nsParameters.getLocationConstraints());
+ oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs());
+ String instReq = JsonUtil.marshal(oRequest);
+ // Step2: prepare url and
+ String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE);
+ String methodType = CommonConstant.MethodType.POST;
+
+ RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq);
+ ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID());
+ ValidateUtil.assertObjectNotNull(instRsp);
+ if (!HttpCode.isSucess(instRsp.getStatus())) {
+ LOGGER.error("update segment operation status : fail to instantiate ns");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(instRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ }
+ LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus());
+ LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent());
+ ValidateUtil.assertObjectNotNull(instRsp.getResponseContent());
+ @SuppressWarnings("unchecked")
+ Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class);
+ String jobId = rsp.get(CommonConstant.JOB_ID);
+ if (ValidateUtil.isStrEmpty(jobId)) {
+ LOGGER.error("Invalid jobId from instantiate operation");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(instRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
+ }
+ LOGGER.info("instantiate ns -> end");
+ // Step 3: update segment operation job id
+ LOGGER.info("update resource operation status job id -> begin");
+ status.setJobId(jobId);
+ status.setProgress("100");
+ status.setStatusDescription("NS initiation completed.");
+ resourceOperationStatusRepository.save(status);
+ LOGGER.info("update segment operation job id -> end");
+
+ return instRsp;
+ }
+
+ /**
+ * terminate network service <br>
+ *
+ * @param nsOperationKey The operation key for NS resource
+ * @param nsInstanceId The NS instance id
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ 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 status = new ResourceOperationStatus(nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ status.setStatus(RequestsDbConstant.Status.PROCESSING);
+ resourceOperationStatusRepository.save(status);
+
+ LOGGER.info("terminate ns -> begin");
+ // Step2: prepare url and method type
+ String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE);
+ String methodType = CommonConstant.MethodType.POST;
+
+ // Step3: prepare restful parameters and options
+ Map<String, String> reqBody = new HashMap<>();
+ reqBody.put("nsInstanceId", nsInstanceId);
+ reqBody.put("terminationType", "graceful");
+ reqBody.put("gracefulTerminationTimeout", "60");
+
+ // Step4: Call the NFVO or SDNO service to terminate service
+ RestfulResponse terminateRsp = restfulUtil.send(url, methodType, JsonUtil.marshal(reqBody));
+ ValidateUtil.assertObjectNotNull(terminateRsp);
+ LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus());
+ LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent());
+ // Step 3: update segment operation
+ if (!HttpCode.isSucess(terminateRsp.getStatus())) {
+ LOGGER.error("fail to instantiate ns");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ }
+ @SuppressWarnings("unchecked")
+ Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class);
+ String jobId = rsp.get(CommonConstant.JOB_ID);
+ if (ValidateUtil.isStrEmpty(jobId)) {
+ LOGGER.error("Invalid jobId from terminate operation");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION);
+ }
+ LOGGER.info("terminate ns -> end");
+
+ LOGGER.info("update segment job id -> begin");
+ status.setProgress("60");
+ status.setStatusDescription("NS is termination completed");
+ status.setJobId(jobId);
+ resourceOperationStatusRepository.save(status);
+ LOGGER.info("update segment job id -> end");
+
+ return terminateRsp;
+ }
+
+ /**
+ * get ns progress by job Id <br>
+ *
+ * @param nsOperationKey The OperationKey for NS resource
+ * @param jobId the job id
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId)
+ throws ApplicationException {
+
+ ValidateUtil.assertObjectNotNull(jobId);
+ // Step 1: query the current resource operation status
+ ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ status = resourceOperationStatusRepository.findOne(Example.of(status));
+ // Step 2: start query
+ LOGGER.info("query ns status -> begin");
+ String url = getUrl(jobId, CommonConstant.Step.QUERY);
+ String methodType = CommonConstant.MethodType.GET;
+ // prepare restful parameters and options
+ RestfulResponse rsp = restfulUtil.send(url, methodType, "");
+ 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
+ if (!HttpCode.isSucess(rsp.getStatus())) {
+ LOGGER.info("fail to query job status");
+ status.setErrorCode(String.valueOf(rsp.getStatus()));
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
+ }
+ // Step 4: Process Network Service Instantiate Response
+ NsProgressStatus nsProgress =
+ JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class);
+ ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor();
+ // Step 5: update segment operation progress
+
+ status.setProgress(rspDesc.getProgress());
+ status.setStatusDescription(rspDesc.getStatusDescription());
+ resourceOperationStatusRepository.save(status);
+
+ // Step 6: update segment operation status
+ if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress())
+ && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) {
+ LOGGER.info("job result is succeeded, operType is {}", status.getOperType());
+ status.setErrorCode(String.valueOf(rsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+
+ if(RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(status.getOperType()) || "createInstance".equalsIgnoreCase (status.getOperType())) {
+ status.setStatus(RequestsDbConstant.Status.FINISHED);
+ }
+ resourceOperationStatusRepository.save(status);
+ } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) {
+ LOGGER.error("job result is failed, operType is {}", status.getOperType());
+ status.setErrorCode(String.valueOf(rsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.JOB_STATUS_ERROR);
+ } else {
+ LOGGER.error("unexcepted response status");
+ }
+ LOGGER.info("query ns status -> end");
+
+ return rsp;
+ }
+
+ /**
+ * Scale NS instance
+ * <br>
+ *
+ * @param nsInstanceId The NS instance id
+ * @param segInput input parameters for current node from http request
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput)
+ throws ApplicationException {
+ // Call the NFVO to scale service
+ LOGGER.info("scale ns -> begin");
+
+ // Step1: Prepare restful parameters and options
+ VFCScaleData oRequest = new VFCScaleData();
+ oRequest.setNsInstanceId(nsInstanceId);
+ NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters();
+ oRequest.setScaleType(nsScaleParameters.getScaleType());
+ oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData());
+ String scaleReq = JsonUtil.marshal(oRequest);
+
+ // Step2: prepare url and method type
+ String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE);
+ String methodType = CommonConstant.MethodType.POST;
+ LOGGER.info("scale ns request is {}", scaleReq);
+ // Step3: Call NFVO lcm to scale ns
+ RestfulResponse scaleRsp = restfulUtil.send(url, methodType, scaleReq);
+
+ ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID());
+ ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status));
+ ValidateUtil.assertObjectNotNull(scaleRsp);
+ if(!HttpCode.isSucess(scaleRsp.getStatus())) {
+ LOGGER.error("update segment operation status : fail to scale ns");
+ nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+ nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
+ nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
+ resourceOperationStatusRepository.save(nsOperInfo);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS);
+ }
+ LOGGER.info("scale ns response status is {}", scaleRsp.getStatus());
+ LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent());
+
+ ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent());
+ @SuppressWarnings("unchecked")
+ Map<String, String> rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class);
+ String jobId = rsp.get(CommonConstant.JOB_ID);
+ if(ValidateUtil.isStrEmpty(jobId)) {
+ LOGGER.error("Invalid jobId from scale operation");
+ nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+ nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
+ nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
+ resourceOperationStatusRepository.save(nsOperInfo);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION);
+ }
+
+ LOGGER.info("update resource operation status job id -> begin");
+ // Step 4: update segment operation job id
+ nsOperInfo.setJobId(jobId);
+ resourceOperationStatusRepository.save(nsOperInfo);
+ LOGGER.info("update segment operation job id -> end");
+ LOGGER.info("scale ns -> end");
+
+ return scaleRsp;
+ }
+
+ /**
+ * get url for the operation <br>
+ *
+ * @param variable variable should be put in the url
+ * @param step step of the operation (terminate,query,delete)
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ private String getUrl(String variable, String step) {
+
+ String url;
+ String originalUrl;
+ originalUrl = nfvoUrlMap.get(step);
+ url = String.format(originalUrl, variable);
+ return url;
+
+ }
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/JerseyConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/JerseyConfiguration.java
new file mode 100644
index 0000000..a975491
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/JerseyConfiguration.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.onap.so.adapters.vfc.application;
+
+import javax.annotation.PostConstruct;
+import javax.ws.rs.ApplicationPath;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.onap.so.adapters.vfc.HealthCheckHandler;
+import org.onap.so.adapters.vfc.VfcAdapterRest;
+import org.springframework.context.annotation.Configuration;
+
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.jaxrs.listing.ApiListingResource;
+import io.swagger.jaxrs.listing.SwaggerSerializers;
+
+@Configuration
+@ApplicationPath("/vfc")
+public class JerseyConfiguration extends ResourceConfig {
+
+ public JerseyConfiguration() {
+
+ }
+
+ @PostConstruct
+ public void setUp() {
+ register(VfcAdapterRest.class);
+ register(HealthCheckHandler.class);
+
+ this.register(ApiListingResource.class);
+ this.register(SwaggerSerializers.class);
+
+ BeanConfig beanConfig = new BeanConfig();
+ beanConfig.setVersion("1.0.2");
+ beanConfig.setSchemes(new String[] { "http" });
+ beanConfig.setHost("localhost:8080");
+ beanConfig.setBasePath("/");
+ beanConfig.setResourcePackage("org.onap.so.adapters.vfc.application");
+ beanConfig.setPrettyPrint(true);
+ beanConfig.setScan(true);
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/MSOVfcApplication.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/MSOVfcApplication.java
new file mode 100644
index 0000000..c6d1413
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/MSOVfcApplication.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.onap.so.adapters.vfc.application;
+
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+
+
+
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@EnableJpaRepositories({"org.onap.so.db.request.data.repository"})
+@EntityScan({"org.onap.so.db.request.beans"})
+public class MSOVfcApplication {
+
+ public static void main(String... args) {
+ SpringApplication.run(MSOVfcApplication.class, args);
+ }
+
+}
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/onap/so/adapters/vfc/constant/CommonConstant.java
similarity index 98%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java
index 57c68de..128dc52 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/onap/so/adapters/vfc/constant/CommonConstant.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.constant;
+
+package org.onap.so.adapters.vfc.constant;
/**
* CommonConstant
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/onap/so/adapters/vfc/constant/DriverExceptionID.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java
index 48273f0..f82a38e 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/onap/so/adapters/vfc/constant/DriverExceptionID.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.constant;
+package org.onap.so.adapters.vfc.constant;
/**
* <br>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java
index 0eda7bd..e08c157 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.constant;
+
+package org.onap.so.adapters.vfc.constant;
/**
* Constant Class.<br/>
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/onap/so/adapters/vfc/exceptions/ApplicationException.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java
index 039c160..1e712cb 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/onap/so/adapters/vfc/exceptions/ApplicationException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.exceptions;
+package org.onap.so.adapters.vfc.exceptions;
import javax.ws.rs.core.Response;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/CustomerModel.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/CustomerModel.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java
index fa0347b..986d168 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/CustomerModel.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java
@@ -1,69 +1,70 @@
-/*-
- * ============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=========================================================
- */
-package org.openecomp.mso.adapters.vfc.model;
-
-/**
- * The Customer Model
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-10-12
- */
-public class CustomerModel {
-
- String globalCustomerId;
-
- String serviceType;
-
-
- /**
- * @return Returns the globalCustomerId.
- */
- public String getGlobalCustomerId() {
- return globalCustomerId;
- }
-
-
- /**
- * @param globalCustomerId The globalCustomerId to set.
- */
- public void setGlobalCustomerId(String globalCustomerId) {
- this.globalCustomerId = globalCustomerId;
- }
-
-
- /**
- * @return Returns the serviceType.
- */
- public String getServiceType() {
- return serviceType;
- }
-
-
- /**
- * @param serviceType The serviceType to set.
- */
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
-}
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+/**
+ * The Customer Model
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-10-12
+ */
+public class CustomerModel {
+
+ String globalCustomerId;
+
+ String serviceType;
+
+
+ /**
+ * @return Returns the globalCustomerId.
+ */
+ public String getGlobalCustomerId() {
+ return globalCustomerId;
+ }
+
+
+ /**
+ * @param globalCustomerId The globalCustomerId to set.
+ */
+ public void setGlobalCustomerId(String globalCustomerId) {
+ this.globalCustomerId = globalCustomerId;
+ }
+
+
+ /**
+ * @return Returns the serviceType.
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+
+ /**
+ * @param serviceType The serviceType to set.
+ */
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java
index 214451b..a28bd9a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
/**
* <br>
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/onap/so/adapters/vfc/model/NSResourceInputParameter.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
index d468443..ce5637b 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/onap/so/adapters/vfc/model/NSResourceInputParameter.java
@@ -18,16 +18,18 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
+import org.onap.so.logger.MsoLogger;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-import org.openecomp.mso.logger.MsoLogger;
/**
* NS Create Input Parameter For VFC Adapter<br>
@@ -38,7 +40,7 @@
*/
public class NSResourceInputParameter {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NSResourceInputParameter.class);
private NsOperationKey nsOperationKey;
@@ -52,7 +54,7 @@
private NsScaleParameters nsScaleParameters;
-
+
/**
* @return Returns the nsServiceName.
*/
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsCreateReq.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsCreateReq.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java
index 3887624..2d09f55 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsCreateReq.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
/**
* Network Service Request<br/>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java
index 7e8a9ce..4281026 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
/**
* <br>
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/onap/so/adapters/vfc/model/NsOperationKey.java
similarity index 98%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java
index 23bf36f..bc67832 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/onap/so/adapters/vfc/model/NsOperationKey.java
@@ -1,141 +1,141 @@
-/*-
- * ============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=========================================================
- */
-
-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;
-
- /**
- * 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;
- }
-
- /**
- * @return Returns the nodeTemplateUUID.
- */
- public String getNodeTemplateUUID() {
- return nodeTemplateUUID;
- }
-
- /**
- * @param nodeTemplateUUID The nodeTemplateUUID to set.
- */
- public void setNodeTemplateUUID(String nodeTemplateUUID) {
- this.nodeTemplateUUID = nodeTemplateUUID;
- }
-
-}
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.so.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;
+
+ /**
+ * 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;
+ }
+
+ /**
+ * @return Returns the nodeTemplateUUID.
+ */
+ public String getNodeTemplateUUID() {
+ return nodeTemplateUUID;
+ }
+
+ /**
+ * @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/model/NsParameters.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java
index b4827d0..5da3d80 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
import java.util.HashMap;
import java.util.List;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java
index d68da47..a7e72ef 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
import java.util.List;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java
index eb40cdd..e4e217a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import java.util.List;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java
index 1d9e7aa..79ed02c 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
/**
* <br>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptor.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java
similarity index 98%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptor.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java
index 6c40c0d..08e3dca 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptor.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+
+package org.onap.so.adapters.vfc.model;
/**
* <br>
* <p>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java
similarity index 98%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java
index e4f7f30..ee5ecd6 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java
@@ -1,100 +1,101 @@
-/*-
- * ============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=========================================================
- */
-package org.openecomp.mso.adapters.vfc.model;
-
-import java.util.Map;
-
-/**
- * The Unified Restful Reponse Class
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-09-06
- */
-public class RestfulResponse {
-
- // the response content
- private String responseContent;
-
- //the response status
- private int status;
-
- //the response header
- private Map<String, String> respHeaderMap;
-
- public RestfulResponse() {
- this.status = -1;
-
- this.respHeaderMap = null;
- }
-
- public int getStatus() {
- return this.status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public Map<String, String> getRespHeaderMap() {
- return this.respHeaderMap;
- }
-
- public void setRespHeaderMap(Map<String, String> header) {
- this.respHeaderMap = header;
- }
-
- public int getRespHeaderInt(String key) {
- if(this.respHeaderMap != null) {
- String result = this.respHeaderMap.get(key);
- if(result != null) {
- return Integer.parseInt(result);
- }
- }
- return -1;
- }
-
- public long getRespHeaderLong(String key) {
- if(this.respHeaderMap != null) {
- String result = this.respHeaderMap.get(key);
- if(result != null) {
- return Long.parseLong(result);
- }
- }
- return -1L;
- }
-
- public String getRespHeaderStr(String key) {
- if(this.respHeaderMap != null) {
- return this.respHeaderMap.get(key);
- }
- return null;
- }
-
- public String getResponseContent() {
- return this.responseContent;
- }
-
- public void setResponseContent(String responseString) {
- this.responseContent = responseString;
- }
-}
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.Map;
+
+/**
+ * The Unified Restful Reponse Class
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-09-06
+ */
+public class RestfulResponse {
+
+ // the response content
+ private String responseContent;
+
+ //the response status
+ private int status;
+
+ //the response header
+ private Map<String, String> respHeaderMap;
+
+ public RestfulResponse() {
+ this.status = -1;
+
+ this.respHeaderMap = null;
+ }
+
+ public int getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public Map<String, String> getRespHeaderMap() {
+ return this.respHeaderMap;
+ }
+
+ public void setRespHeaderMap(Map<String, String> header) {
+ this.respHeaderMap = header;
+ }
+
+ public int getRespHeaderInt(String key) {
+ if(this.respHeaderMap != null) {
+ String result = this.respHeaderMap.get(key);
+ if(result != null) {
+ return Integer.parseInt(result);
+ }
+ }
+ return -1;
+ }
+
+ public long getRespHeaderLong(String key) {
+ if(this.respHeaderMap != null) {
+ String result = this.respHeaderMap.get(key);
+ if(result != null) {
+ return Long.parseLong(result);
+ }
+ }
+ return -1L;
+ }
+
+ public String getRespHeaderStr(String key) {
+ if(this.respHeaderMap != null) {
+ return this.respHeaderMap.get(key);
+ }
+ return null;
+ }
+
+ public String getResponseContent() {
+ return this.responseContent;
+ }
+
+ public void setResponseContent(String responseString) {
+ this.responseContent = responseString;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java
index 668b660..938064d 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
/**
* <br>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java
index 437af5b..b0ad26a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import java.util.List;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java
index 33460b4..4a393e1 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import java.util.ArrayList;
import java.util.List;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VimLocation.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VimLocation.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java
index 3c07f9c..9f6f8ec 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VimLocation.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java
@@ -1,50 +1,51 @@
-/*-
- * ============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=========================================================
- */
-package org.openecomp.mso.adapters.vfc.model;
-
-/**
- *
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-10-18
- */
-public class VimLocation {
- private String vimId;
-
-
- /**
- * @return Returns the vimId.
- */
- public String getVimId() {
- return vimId;
- }
-
-
- /**
- * @param vimId The vimId to set.
- */
- public void setVimId(String vimId) {
- this.vimId = vimId;
- }
-
-}
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+/**
+ *
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-10-18
+ */
+public class VimLocation {
+ private String vimId;
+
+
+ /**
+ * @return Returns the vimId.
+ */
+ public String getVimId() {
+ return vimId;
+ }
+
+
+ /**
+ * @param vimId The vimId to set.
+ */
+ public void setVimId(String vimId) {
+ this.vimId = vimId;
+ }
+
+}
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/onap/so/adapters/vfc/util/JsonUtil.java
similarity index 92%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index d270230..c12cd7d 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/onap/so/adapters/vfc/util/JsonUtil.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.util;
+package org.onap.so.adapters.vfc.util;
import java.io.IOException;
-import org.openecomp.mso.adapters.vfc.constant.HttpCode;
-import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.adapters.vfc.constant.HttpCode;
+import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -45,7 +45,7 @@
/**
* Log service
*/
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, JsonUtil.class);
/**
* Mapper.
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/onap/so/adapters/vfc/util/RestfulUtil.java
similarity index 82%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index 9b00e4e..5b8779a 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/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -19,11 +19,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.util;
+package org.onap.so.adapters.vfc.util;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
+import javax.ws.rs.core.UriBuilder;
+
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -37,12 +39,13 @@
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
-import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
/**
* <br>
@@ -53,48 +56,46 @@
* @author
* @version ONAP Amsterdam Release 2017-9-6
*/
+@Component
public class RestfulUtil {
/**
* Log service
*/
- private static final Logger LOGGER = LoggerFactory.getLogger(RestfulUtil.class);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class);
private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
private static final int DEFAULT_TIME_OUT = 60000;
-
+
private static final String ONAP_IP = "ONAP_IP";
private static final String DEFAULT_MSB_IP = "127.0.0.1";
- private static final String DEFAULT_MSB_PORT = "80";
+ private static final Integer DEFAULT_MSB_PORT = 80;
- private static final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ @Autowired
+ private Environment env;
- public static String getMsbHost() {
- String msbPort = DEFAULT_MSB_PORT;
+ public String getMsbHost() {
// MSB_IP will be set as ONAP_IP environment parameter in install flow.
String msbIp = System.getenv().get(ONAP_IP);
- try {
- // if ONAP IP is not set. get it from config file.
- if(null == msbIp || msbIp.isEmpty()) {
- msbIp = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-ip", DEFAULT_MSB_IP);
- msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", DEFAULT_MSB_PORT);
- }
- } catch(MsoPropertiesException e) {
- LOGGER.error("Get msb properties failed",e);
- }
- return "http://" + msbIp + ":" + msbPort;
+ // if ONAP IP is not set. get it from config file.
+ if(null == msbIp || msbIp.isEmpty()) {
+ msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP);
+ }
+ Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
+
+ return UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString();
}
private RestfulUtil() {
}
- public static RestfulResponse send(String url, String methodType, String content) {
+ public RestfulResponse send(String url, String methodType, String content) {
String msbUrl = getMsbHost() + url;
- LOGGER.info("Begin to sent message " + methodType +": " + msbUrl);
+ LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.onap.so.adapters.vfc.util.RestfulUtil","VFC Adapter");
HttpRequestBase method = null;
HttpResponse httpResponse = null;
@@ -195,12 +196,12 @@
}
private static void logError(String errMsg, Throwable t) {
- LOGGER.error(errMsg, t);
+ LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
}
private static void logError(String errMsg) {
- LOGGER.error(errMsg);
+ LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
}
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/onap/so/adapters/vfc/util/ValidateUtil.java
similarity index 93%
rename from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
rename to adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java
index 8bfa933..d920dbe 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/onap/so/adapters/vfc/util/ValidateUtil.java
@@ -1,87 +1,87 @@
-/*-
- * ============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=========================================================
- */
-
-package org.openecomp.mso.adapters.vfc.util;
-
-import org.openecomp.mso.adapters.vfc.constant.HttpCode;
-import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ValidateUtil {
-
- /**
- * Log server.
- */
- private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
-
- /**
- * Constructor<br/>
- * <p>
- * </p>
- *
- * @since ONAP Amsterdam Release 2017-9-6
- */
- private ValidateUtil() {
-
- }
-
- /**
- * Assert String parameter.<br/>
- *
- * @param paramValue parameter data
- * @param paramName parameter name
- * @since ONAP Amsterdam Release 2017-9-6
- */
- public static void assertStringNotNull(String paramValue, String paramName)
- throws ApplicationException {
- if (null != paramValue && !paramValue.isEmpty()) {
- return;
- }
-
- LOGGER.error(paramName + ": Parameter is null or empty.");
- throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter.");
- }
-
- /**
- * Assert object is null.<br/>
- *
- * @param object data object
- * @since ONAP Amsterdam Release 2017-9-6
- */
- 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.");
- }
-
- }
-
- /**
- * <br>
- *
- * @param str
- * @return
- * @since ONAP Amsterdam Release
- */
- public static boolean isStrEmpty(String str) {
- return null == str || str.isEmpty();
- }
-}
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.so.adapters.vfc.util;
+
+import org.onap.so.adapters.vfc.constant.HttpCode;
+import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ValidateUtil {
+
+ /**
+ * Log server.
+ */
+ private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since ONAP Amsterdam Release 2017-9-6
+ */
+ private ValidateUtil() {
+
+ }
+
+ /**
+ * Assert String parameter.<br/>
+ *
+ * @param paramValue parameter data
+ * @param paramName parameter name
+ * @since ONAP Amsterdam Release 2017-9-6
+ */
+ public static void assertStringNotNull(String paramValue, String paramName)
+ throws ApplicationException {
+ if (null != paramValue && !paramValue.isEmpty()) {
+ return;
+ }
+
+ LOGGER.error(paramName + ": Parameter is null or empty.");
+ throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter.");
+ }
+
+ /**
+ * Assert object is null.<br/>
+ *
+ * @param object data object
+ * @since ONAP Amsterdam Release 2017-9-6
+ */
+ 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.");
+ }
+
+ }
+
+ /**
+ * <br>
+ *
+ * @param str
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public static boolean isStrEmpty(String str) {
+ return null == str || str.isEmpty();
+ }
+}
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
deleted file mode 100644
index 01e4c71..0000000
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/*-
- * ============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=========================================================
- */
-
-package org.openecomp.mso.adapters.vfc;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.openecomp.mso.adapters.vfc.constant.CommonConstant;
-import org.openecomp.mso.adapters.vfc.constant.CommonConstant.Step;
-import org.openecomp.mso.adapters.vfc.constant.DriverExceptionID;
-import org.openecomp.mso.adapters.vfc.constant.HttpCode;
-import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
-import org.openecomp.mso.adapters.vfc.model.CustomerModel;
-import org.openecomp.mso.adapters.vfc.model.NSResourceInputParameter;
-import org.openecomp.mso.adapters.vfc.model.NsCreateReq;
-import org.openecomp.mso.adapters.vfc.model.NsInstantiateReq;
-import org.openecomp.mso.adapters.vfc.model.NsOperationKey;
-import org.openecomp.mso.adapters.vfc.model.NsParameters;
-import org.openecomp.mso.adapters.vfc.model.NsProgressStatus;
-import org.openecomp.mso.adapters.vfc.model.ResponseDescriptor;
-import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
-import org.openecomp.mso.adapters.vfc.model.*;
-import org.openecomp.mso.adapters.vfc.util.JsonUtil;
-import org.openecomp.mso.adapters.vfc.util.RestfulUtil;
-import org.openecomp.mso.adapters.vfc.util.ValidateUtil;
-import org.openecomp.mso.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.RequestsDbConstant;
-import org.openecomp.mso.requestsdb.ResourceOperationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * VF-C Manager <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
-public class VfcManager {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class);
-
- /**
- * nfvo url map
- */
- private static Map<String, String> nfvoUrlMap;
-
- static {
- nfvoUrlMap = new HashMap<>();
- nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL);
- nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL);
- nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL);
- nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL);
- nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
- nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL);
- }
-
- public VfcManager() {
-
- }
-
- /**
- * create network service <br>
- *
- * @param segInput input parameters for current node from http request
- * @return
- * @since ONAP Amsterdam Release
- */
- public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException {
-
- // Step1: get service template by node type
- String csarId = segInput.getNsServiceModelUUID();
- // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id"
- LOGGER.info("serviceTemplateId is {}, id is {}", csarId);
-
- LOGGER.info("create ns -> begin");
- // Step2: Prepare url and method type
- String url = getUrl(null, CommonConstant.Step.CREATE);
- String methodType = CommonConstant.MethodType.POST;
-
- // Step3: Prepare restful parameters and options
- NsCreateReq oRequest = new NsCreateReq();
- oRequest.setCsarId(csarId);
- oRequest.setNsName(segInput.getNsServiceName());
- oRequest.setDescription(segInput.getNsServiceDescription());
- CustomerModel context = new CustomerModel();
- context.setGlobalCustomerId(segInput.getNsOperationKey().getGlobalSubscriberId());
- context.setServiceType(segInput.getNsOperationKey().getServiceType());
- oRequest.setContext(context);
- String createReq = JsonUtil.marshal(oRequest);
-
- // Step4: Call NFVO or SDNO lcm to create ns
- RestfulResponse createRsp = RestfulUtil.send(url, methodType, createReq);
- ValidateUtil.assertObjectNotNull(createRsp);
- LOGGER.info("create ns response status is : {}", createRsp.getStatus());
- LOGGER.info("create ns response content is : {}", createRsp.getResponseContent());
-
- // Step 5: save resource operation information
- ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
- .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
- segInput.getNsOperationKey().getOperationId(),
- segInput.getNsOperationKey().getNodeTemplateUUID());
- nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
- nsOperInfo.setProgress("40");
- nsOperInfo.setStatusDescription("NS is created");
- (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.getInstance()).updateResOperStatus(nsOperInfo);
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.FAIL_TO_CREATE_NS);
- }
- @SuppressWarnings("unchecked")
- Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
- String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID);
- if (ValidateUtil.isStrEmpty(nsInstanceId)) {
- LOGGER.error("Invalid instanceId from create operation");
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
- }
- LOGGER.info("create ns -> end");
- LOGGER.info("save segment and operaton info -> begin");
- // Step 6: add relation between service and NS
- AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
- segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
- nsInstanceId);
- LOGGER.info("save segment and operation info -> end");
- return createRsp;
- }
-
- /**
- * delete network service <br>
- *
- * @param nsOperationKey The operation key of the NS resource
- * @param nsInstanceId The NS instance id
- * @return
- * @since ONAP Amsterdam Release
- */
- 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);
- String methodType = CommonConstant.MethodType.DELETE;
-
- // Step2: prepare restful parameters and options
- RestfulResponse deleteRsp = RestfulUtil.send(url, methodType, "");
- ValidateUtil.assertObjectNotNull(deleteRsp);
- 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());
- 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.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.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()));
- nsOperInfo.setProgress("100");
- nsOperInfo.setStatusDescription("VFC resource deletion finished");
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- LOGGER.info("update segment operaton status for delete -> end");
-
- return deleteRsp;
-
- }
-
- /**
- * instantiate network service <br>
- *
- * @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 {
- // Call the NFVO or SDNO service to instantiate service
- LOGGER.info("instantiate ns -> begin");
-
- // Step1: Prepare restful parameters and options
- NsInstantiateReq oRequest = new NsInstantiateReq();
- oRequest.setNsInstanceId(nsInstanceId);
- NsParameters nsParameters = segInput.getNsParameters();
- oRequest.setLocationConstraints(nsParameters.getLocationConstraints());
- oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs());
- String instReq = JsonUtil.marshal(oRequest);
- // Step2: prepare url and
- String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE);
- String methodType = CommonConstant.MethodType.POST;
-
- RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq);
- ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
- .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
- segInput.getNsOperationKey().getOperationId(),
- segInput.getNsOperationKey().getNodeTemplateUUID());
- ValidateUtil.assertObjectNotNull(instRsp);
- if (!HttpCode.isSucess(instRsp.getStatus())) {
- LOGGER.error("update segment operation status : fail to instantiate ns");
- nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
- nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
- nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
- }
- LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus());
- LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent());
- ValidateUtil.assertObjectNotNull(instRsp.getResponseContent());
- @SuppressWarnings("unchecked")
- Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class);
- String jobId = rsp.get(CommonConstant.JOB_ID);
- 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.getInstance()).updateResOperStatus(nsOperInfo);
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
- }
- LOGGER.info("instantiate ns -> end");
- // Step 3: update segment operation job id
- LOGGER.info("update resource operation status job id -> begin");
- nsOperInfo.setJobId(jobId);
- nsOperInfo.setProgress("100");
- nsOperInfo.setStatusDescription("NS initiation completed.");
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- LOGGER.info("update segment operation job id -> end");
-
- return instRsp;
- }
-
- /**
- * terminate network service <br>
- *
- * @param nsOperationKey The operation key for NS resource
- * @param nsInstanceId The NS instance id
- * @return
- * @since ONAP Amsterdam Release
- */
- 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());
- nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
- LOGGER.info("terminate ns -> begin");
- // Step2: prepare url and method type
- String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE);
- String methodType = CommonConstant.MethodType.POST;
-
- // Step3: prepare restful parameters and options
- Map<String, String> reqBody = new HashMap<>();
- reqBody.put("nsInstanceId", nsInstanceId);
- reqBody.put("terminationType", "graceful");
- reqBody.put("gracefulTerminationTimeout", "60");
-
- // Step4: Call the NFVO or SDNO service to terminate service
- RestfulResponse terminateRsp = RestfulUtil.send(url, methodType, JsonUtil.marshal(reqBody));
- ValidateUtil.assertObjectNotNull(terminateRsp);
- LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus());
- LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent());
- // Step 3: update segment operation
- if (!HttpCode.isSucess(terminateRsp.getStatus())) {
- LOGGER.error("fail to instantiate ns");
- nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
- nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
- nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.FAIL_TO_TERMINATE_NS);
- }
- @SuppressWarnings("unchecked")
- Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class);
- String jobId = rsp.get(CommonConstant.JOB_ID);
- if (ValidateUtil.isStrEmpty(jobId)) {
- LOGGER.error("Invalid jobId from terminate operation");
- nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
- nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
- nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION);
- }
- LOGGER.info("terminate ns -> end");
-
- LOGGER.info("update segment job id -> begin");
- nsOperInfo.setProgress("60");
- nsOperInfo.setStatusDescription("NS is termination completed");
- nsOperInfo.setJobId(jobId);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- LOGGER.info("update segment job id -> end");
-
- return terminateRsp;
- }
-
- /**
- * get ns progress by job Id <br>
- *
- * @param nsOperationKey The OperationKey for NS resource
- * @param jobId the job id
- * @return
- * @since ONAP Amsterdam Release
- */
- 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 ());
-
- // Step 2: start query
- LOGGER.info ("query ns status -> begin");
- String url = getUrl (jobId, CommonConstant.Step.QUERY);
- String methodType = CommonConstant.MethodType.GET;
- // prepare restful parameters and options
- RestfulResponse rsp = RestfulUtil.send (url, methodType, "");
- 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
- 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.getInstance ()).updateResOperStatus (nsOperInfo);
- throw new ApplicationException (HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
- }
- // Step 4: Process Network Service Instantiate Response
- NsProgressStatus nsProgress = JsonUtil.unMarshal (rsp.getResponseContent (), NsProgressStatus.class);
- ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor ();
- // Step 5: update segment operation progress
-
- nsOperInfo.setProgress (rspDesc.getProgress ());
- nsOperInfo.setStatusDescription (rspDesc.getStatusDescription ());
- (RequestsDatabase.getInstance ()).updateResOperStatus (nsOperInfo);
-
- // Step 6: update segment operation status
- if (RequestsDbConstant.Progress.ONE_HUNDRED.equals (rspDesc.getProgress ())
- && RequestsDbConstant.Status.FINISHED.equals (rspDesc.getStatus ())) {
- LOGGER.info ("job result is succeeded, operType is {}", nsOperInfo.getOperType ());
- nsOperInfo.setErrorCode (String.valueOf (rsp.getStatus ()));
- String operType = nsOperInfo.getOperType ();
- if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase (operType)
- || "createInstance".equalsIgnoreCase (operType)) {
- nsOperInfo.setStatus (RequestsDbConstant.Status.FINISHED);
- }
- (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.getInstance ()).updateResOperStatus (nsOperInfo);
- throw new ApplicationException (HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
- } else {
- LOGGER.error ("unexcepted response status");
- }
- LOGGER.info ("query ns status -> end");
-
- return rsp;
- }
-
- /**
- * Scale NS instance
- * <br>
- *
- * @param nsInstanceId The NS instance id
- * @param segInput input parameters for current node from http request
- * @return
- * @since ONAP Amsterdam Release
- */
- public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput)
- throws ApplicationException {
- // Call the NFVO to scale service
- LOGGER.info("scale ns -> begin");
-
- // Step1: Prepare restful parameters and options
- VFCScaleData oRequest = new VFCScaleData();
- oRequest.setNsInstanceId(nsInstanceId);
- NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters();
- oRequest.setScaleType(nsScaleParameters.getScaleType());
- oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData());
- String scaleReq = JsonUtil.marshal(oRequest);
-
- // Step2: prepare url and method type
- String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE);
- String methodType = CommonConstant.MethodType.POST;
- LOGGER.info("scale ns request is {}", scaleReq);
- // Step3: Call NFVO lcm to scale ns
- RestfulResponse scaleRsp = RestfulUtil.send(url, methodType, scaleReq);
- ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
- segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
- segInput.getNsOperationKey().getNodeTemplateUUID());
- ValidateUtil.assertObjectNotNull(scaleRsp);
- if(!HttpCode.isSucess(scaleRsp.getStatus())) {
- LOGGER.error("update segment operation status : fail to scale ns");
- nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
- nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
- nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS);
- }
- LOGGER.info("scale ns response status is {}", scaleRsp.getStatus());
- LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent());
-
- ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent());
- @SuppressWarnings("unchecked")
- Map<String, String> rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class);
- String jobId = rsp.get(CommonConstant.JOB_ID);
- if(ValidateUtil.isStrEmpty(jobId)) {
- LOGGER.error("Invalid jobId from scale operation");
- nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
- nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
- nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
- DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION);
- }
-
- LOGGER.info("update resource operation status job id -> begin");
- // Step 4: update segment operation job id
- nsOperInfo.setJobId(jobId);
- (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
- LOGGER.info("update segment operation job id -> end");
- LOGGER.info("scale ns -> end");
-
- return scaleRsp;
- }
-
- /**
- * get url for the operation <br>
- *
- * @param variable variable should be put in the url
- * @param step step of the operation (terminate,query,delete)
- * @return
- * @since ONAP Amsterdam Release
- */
- private String getUrl(String variable, String step) {
-
- String url;
- String originalUrl;
- originalUrl = (String) nfvoUrlMap.get(step);
- url = String.format(originalUrl, variable);
- return url;
-
- }
-
-}
diff --git a/adapters/mso-vfc-adapter/src/main/resources/application.yaml b/adapters/mso-vfc-adapter/src/main/resources/application.yaml
new file mode 100644
index 0000000..ba574ba
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/resources/application.yaml
@@ -0,0 +1,37 @@
+logging:
+ path: logs
+
+# H2
+spring:
+ datasource:
+ url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;
+ username: sa
+ password: sa
+ driver-class-name: org.h2.Driver
+ intialize: true
+ h2:
+ console:
+ enabled: true
+ path: /h2
+
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+mso:
+ site-name: localSite
+
+#Actuator
+management:
+ security:
+ enabled: false
+ basic:
+ enabled: false
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
+
+
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java
new file mode 100644
index 0000000..ec3741d
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java
@@ -0,0 +1,42 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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=========================================================
+*/
+
+package org.onap.so.adapters.vfc.exceptions;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ApplicationExceptionTest {
+ private ApplicationException application = new ApplicationException(0,null);
+
+ @Test
+ public void testApplicationException() {
+ application.setErrorCode(0);
+ application.setErrorMsg("ErrorMsg");
+ assertEquals(application.getErrorCode(), 0);
+ assertEquals(application.getErrorMsg(), "ErrorMsg");
+ }
+
+ @Test
+ public void testbuildErrorResponse(){
+ assert(application.buildErrorResponse()!=null);
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java
index 293c037..2acd6c2 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java
index e4b275c..ef5eb26 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java
index 3e6aede..2e720e4 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java
index 56a0617..caf2d7e 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java
index d63748d..330e34d 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java
index 79b5fb2..e315eef 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java
similarity index 96%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java
index 512c061..852bac2 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java
index 2569631..e99d9ae 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java
index 0bfb0df..a9f2f4c 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java
similarity index 97%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java
index 5117e73..61ddac2 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vfc.model;
+package org.onap.so.adapters.vfc.model;
import org.junit.Test;
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java
similarity index 95%
rename from adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java
rename to adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java
index d3da7f6..e9b2507 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java
@@ -8,16 +8,16 @@
* 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=========================================================
- */package org.openecomp.mso.adapters.vfc.model;
+ */package org.onap.so.adapters.vfc.model;
import org.junit.Test;
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
deleted file mode 100644
index 759ceed..0000000
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*-
- * ============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=========================================================
- */
-
-package org.openecomp.mso.adapters.vfc;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import org.apache.commons.io.IOUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-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.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.ResourceOperationStatus;
-
-import mockit.Mock;
-import mockit.MockUp;
-
-/**
- * VF-C adapter UT <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-31
- */
-public class VfcAdapterTest {
-
- private VfcAdapterRest vfcAdapter = new VfcAdapterRest();
-
- /**
- * File path
- */
- private static final String FILE_PATH = "src/test/resources/json/";
-
- /**
- * mock get request body <br>
- *
- * @param fileName
- * @return
- * @since ONAP Amsterdam Release
- */
- public String getRequestBody(String fileName) {
- return getJsonString(fileName);
- }
-
- /**
- * Mock the request body form a file <br>
- *
- * @since ONAP Amsterdam Release
- */
- private void mockRestfulUtil() {
- new MockUp<RestfulUtil>() {
-
- /**
- * 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;
- }
- }
- };
- }
-
- /**
- * 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) {
-
- }
- };
- }
-
- /**
- * Before executing UT, start mock requst database <br>
- *
- * @since ONAP Amsterdam Release
- */
- @Before
- public void start() {
- mockRequestDatabase();
- mockRestfulUtil();
- }
-
- /**
- * After executing UT, close session<br/>
- *
- * @since ONAP Amsterdam Release
- */
- @After
- public void stop() {
-
- }
-
- @Test
- public void createTest() {
- // get request
- String createReq = getRequestBody(FILE_PATH + "createNsReq.json");
- vfcAdapter.createNfvoNs(createReq);
- }
-
- @Test
- public void deleteTest() {
- // get request
- String req = getRequestBody(FILE_PATH + "deleteNsReq.json");
- vfcAdapter.deleteNfvoNs(req, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
- }
-
- @Test
- public void instantiateTest() {
- // get request
- String req = getRequestBody(FILE_PATH + "instantiateNsReq.json");
- vfcAdapter.instantiateNfvoNs(req, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
- }
-
- @Test
- public void terminateTest() {
- String req = getRequestBody(FILE_PATH + "terminateNsReq.json");
- vfcAdapter.deleteNfvoNs(req, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
- }
-
- @Test
- public void queryJobTest() {
- String req = getRequestBody(FILE_PATH + "queryJobReq.json");
- vfcAdapter.queryNfvoJobStatus(req, "1");
- }
-
- /**
- * Get json string from file.<br/>
- *
- * @param file the path of file
- * @return json string
- * @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());
- }
- 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/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationExceptionTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationExceptionTest.java
deleted file mode 100644
index 231e210..0000000
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationExceptionTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-
-package org.openecomp.mso.adapters.vfc.exceptions;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ApplicationExceptionTest {
- private ApplicationException application = new ApplicationException(0,null);
-
- @Test
- public void testApplicationException() {
- application.setErrorCode(0);
- application.setErrorMsg("ErrorMsg");
- assertEquals(application.getErrorCode(), 0);
- assertEquals(application.getErrorMsg(), "ErrorMsg");
- }
-
- @Test
- public void testbuildErrorResponse(){
- assert(application.buildErrorResponse()!=null);
- }
-}
diff --git a/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml b/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml
new file mode 100644
index 0000000..ab5fa61
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml
@@ -0,0 +1,6 @@
+mso:
+ site-name: localSite
+ msb-ip: "127.0.0.1"
+ msb-port: 8080
+
+
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 9534e5e..047c810 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
@@ -19,7 +19,7 @@
],
"additionalParamForNs":{
"externalDataNetworkName":"Flow_out_net",
- "m6000_mng_ip":"181.18.20.2",
+ "m6000_mng_ip":"192.168.20.2",
"externalCompanyFtpDataNetworkName":"Flow_out_net",
"externalPluginManageNetworkName":"plugin_net_2014",
"externalManageNetworkName":"mng_net_2017",
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 9534e5e..047c810 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/instantiateNsReq.json
@@ -19,7 +19,7 @@
],
"additionalParamForNs":{
"externalDataNetworkName":"Flow_out_net",
- "m6000_mng_ip":"181.18.20.2",
+ "m6000_mng_ip":"192.168.20.2",
"externalCompanyFtpDataNetworkName":"Flow_out_net",
"externalPluginManageNetworkName":"plugin_net_2014",
"externalManageNetworkName":"mng_net_2017",
diff --git a/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml b/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml
index 61d9c45..c2e0098 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml
+++ b/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml
@@ -30,7 +30,10 @@
<logger name="com.att.eelf.error" level="trace" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
+ <logger name="org.onap" level="${so.log.level:-DEBUG}"
+ additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
<root level="info">
<appender-ref ref="STDOUT" />
</root>