aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java481
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java228
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java239
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java1403
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java328
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java110
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestParameters.java65
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java63
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java74
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java334
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java57
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java108
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java52
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java469
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java74
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java491
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json61
111 files changed, 4936 insertions, 931 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
index 8df4c87898..a32f9ef0f7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -27,5 +27,8 @@ public enum Action {
createInstance,
updateInstance,
deleteInstance,
- configureInstance
+ configureInstance,
+ replaceInstance,
+ activateInstance,
+ deactivateInstance
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
index b3c8a9539e..3e29a8221a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
new file mode 100644
index 0000000000..6b6cfc3390
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -0,0 +1,481 @@
+/*-
+ * ============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.apihandlerinfra;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.ResponseHandler;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/e2eServiceInstances")
+public class E2EServiceInstances {
+
+ private HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ public E2EServiceInstances() {
+ }
+
+ @POST
+ @Path("/{version:[vV][3-5]}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createE2EServiceInstance(String request, @PathParam("version") String version) {
+
+ Response response = E2EserviceInstances(request, Action.createInstance, null, version);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{version:[vV][3-5]}/{serviceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteE2EServiceInstance(String request, @PathParam("version") String version) {
+
+ Response response = E2EserviceInstances(request, Action.deleteInstance, null, version);
+
+ return response;
+ }
+
+ private Response E2EserviceInstances(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceRequest sir = null;
+
+ MsoRequest msoRequest = new MsoRequest(requestId);
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ sir = mapper
+ .readValue(requestJSON, E2EServiceInstanceRequest.class);
+
+ } catch (Exception e) {
+
+ msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Mapping of request to JSON object failed. "
+ + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.SchemaError,
+ "Mapping of request to JSON object failed");
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) response.getEntity());
+ return response;
+ }
+
+ InfraActiveRequests dup = null;
+ String instanceName = sir.getService().getName();
+ String requestScope = sir.getService().getParameters().getNodeType();
+
+ try {
+ if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){
+ dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ e.getMessage(),
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ if (dup != null) {
+ // Found the duplicate record. Return the appropriate error.
+ String instance = null;
+ if(instanceName != null){
+ instance = instanceName;
+ }else{
+ instance = instanceIdMap.get(requestScope + "InstanceId");
+ }
+ String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
+ dupMessage,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+
+
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ CatalogDatabase db = null;
+ try {
+ db = CatalogDatabase.getInstance();
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "No communication to catalog DB " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED,action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+
+ RecipeLookupResult recipeLookupResult = null;
+
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, sir, action);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "Recipe could not be retrieved from catalog DB " + e.getMessage (),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED,action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ db.close();
+ return response;
+ }
+ finally{
+ if(null != db)
+ {
+ db.close();
+ }
+
+ }
+
+ if (recipeLookupResult == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
+ null);
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+
+ return response;
+ }
+
+
+ String modelInfo = sir.getService().getParameters().getNodeTemplateName();
+ String[] arrayOfInfo = modelInfo.split(":");
+ String serviceInstanceType = arrayOfInfo[0];
+
+
+
+ String serviceInstanceId = "";
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+ String sirRequestJson = mappingObtainedRequestJSONToServiceInstanceRequest(sir);
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), MsoPropertiesUtils.loadMsoProperties ());
+
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+
+ response = requestClient.post(requestId, false,
+ recipeLookupResult.getRecipeTimeout(),
+ action.name(), serviceInstanceId, null, null, null, null, serviceInstanceType,
+ null, null, null, sirRequestJson);
+
+ msoLogger.recordMetricEvent(subStartTime,
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent(subStartTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError,
+ "Exception while communicate with BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError,
+ "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError,
+ "Exception while communicate with BPMN engine");
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
+ return resp;
+ }
+
+ if (response == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Null response from BPEL");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
+ "Null response from BPMN");
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response,
+ requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+
+ // BPEL accepted the request, the request is in progress
+ if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+ String camundaJSONResponseBody = respHandler.getResponseBody();
+ msoLogger
+ .debug("Received from Camunda: " + camundaJSONResponseBody);
+ (RequestsDatabase.getInstance()).updateInfraStatus(requestId,
+ Status.IN_PROGRESS.toString(),
+ Constants.PROGRESS_REQUEST_IN_PROGRESS,
+ Constants.MODIFIED_BY_APIHANDLER);
+
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "BPMN accepted the request, the request is in progress");
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) camundaJSONResponseBody);
+ return Response.status(HttpStatus.SC_ACCEPTED)
+ .entity(camundaJSONResponseBody).build();
+ } else {
+ List<String> variables = new ArrayList<String>();
+ variables.add(bpelStatus + "");
+ String camundaJSONResponseBody = respHandler.getResponseBody();
+ if (camundaJSONResponseBody != null
+ && !camundaJSONResponseBody.isEmpty()) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ bpelStatus, MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1 "
+ + '\n' + camundaJSONResponseBody,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Response from BPEL engine is failed with HTTP Status="
+ + bpelStatus);
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
+ "Response from BPMN engine is failed");
+ msoLogger
+ .debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
+ return resp;
+ } else {
+ Response resp = msoRequest
+ .buildServiceErrorResponse(
+ bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ variables);
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
+ "Response from BPEL engine is empty");
+ msoLogger
+ .debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
+ return resp;
+ }
+ }
+ }
+
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(
+ CatalogDatabase db, E2EServiceInstanceRequest sir, Action action) {
+
+ RecipeLookupResult recipeLookupResult = null;
+
+ recipeLookupResult = getServiceURI(db, sir, action);
+
+ if (recipeLookupResult != null) {
+ msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ()));
+ }
+ else {
+ msoLogger.debug("No matching recipe record found");
+ }
+ return recipeLookupResult;
+ }
+
+ private RecipeLookupResult getServiceURI(CatalogDatabase db,
+ E2EServiceInstanceRequest sir, Action action) {
+
+ String defaultServiceModelName = "UUI_DEFAULT";
+
+ Service serviceRecord = null;
+ ServiceRecipe recipe = null;
+
+ serviceRecord = db.getServiceByModelName(defaultServiceModelName);
+ recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(),
+ recipe.getRecipeTimeout());
+
+ }
+
+ private String mappingObtainedRequestJSONToServiceInstanceRequest(E2EServiceInstanceRequest e2eSir){
+
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+
+ String returnString = null;
+
+ //ModelInvariantId
+ sir.getRequestDetails().getModelInfo().setModelInvariantId(e2eSir.getService().getServiceDefId());
+
+ //modelNameVersionId
+ sir.getRequestDetails().getModelInfo().setModelNameVersionId(e2eSir.getService().getTemplateId());
+
+ String modelInfo = e2eSir.getService().getParameters().getNodeTemplateName();
+ String[] arrayOfInfo = modelInfo.split(":");
+ String modelName = arrayOfInfo[0];
+ String modelVersion = arrayOfInfo[0];
+
+ //modelName
+ sir.getRequestDetails().getModelInfo().setModelName(modelName);
+
+ //modelVersion
+ sir.getRequestDetails().getModelInfo().setModelVersion(modelVersion);
+
+ //modelType
+ if(ModelType.service.equals(e2eSir.getService().getParameters().getNodeType())){
+ sir.getRequestDetails().getModelInfo().setModelType(ModelType.service);
+ }
+
+ sir.getRequestDetails().getModelInfo().getModelType();
+
+ //globalsubscriberId
+ sir.getRequestDetails().getSubscriberInfo().setGlobalSubscriberId(e2eSir.getService().getParameters().getGlobalSubscriberId());
+
+ //subscriberName
+ sir.getRequestDetails().getSubscriberInfo().setSubscriberName(e2eSir.getService().getParameters().getSubscriberName());
+
+ //instanceName
+ sir.getRequestDetails().getRequestInfo().setInstanceName(e2eSir.getService().getName());
+
+ //source
+ sir.getRequestDetails().getRequestInfo().setSource("UUI");
+
+ //suppressRollback
+ sir.getRequestDetails().getRequestInfo().setSuppressRollback(true);
+
+ //subscriptionServiceType
+ sir.getRequestDetails().getRequestParameters().setSubscriptionServiceType("MOG");
+
+ //Userparams
+ List<E2EUserParam> userParams = new ArrayList<>();
+ userParams = e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+ List<Map<String, String>> userParamList = new ArrayList<Map<String,String>>();
+ Map<String,String> userParamMap= new HashMap<String, String>();
+ for(E2EUserParam userp: userParams){
+ userParamMap.put(userp.getName(), userp.getValue());
+ userParamList.add(userParamMap);
+ }
+
+ sir.getRequestDetails().getRequestParameters().setUserParams(userParamList);
+
+ //converting to string
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ returnString = mapper.writeValueAsString(sir);
+ } catch (IOException e) {
+ msoLogger.debug("Exception while converting ServiceInstancesRequest object to string", e);
+ }
+
+ return returnString;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
new file mode 100644
index 0000000000..6123ee906c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -0,0 +1,48 @@
+package org.openecomp.mso.apihandlerinfra;
+
+import javax.ws.rs.DefaultValue;
+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.HealthCheckUtils;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/globalhealthcheck")
+@Api(value="/globalhealthcheck",description="APIH Infra Global Health Check")
+public class GlobalHealthcheckHandler {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @HEAD
+ @GET
+ @Produces("text/html")
+ @ApiOperation(value="Performing global health check",response=Response.class)
+ public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("GlobalHealthcheck");
+ // Generate a Request Id
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ HealthCheckUtils healthCheck = new HealthCheckUtils ();
+ if (!healthCheck.siteStatusCheck (msoLogger, startTime)) {
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+
+ if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) {
+ msoLogger.debug("globalHealthcheck - Successful");
+ return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
+ } else {
+ msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available");
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
index 0ae1695516..291414bf10 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -25,14 +25,17 @@ import javax.ws.rs.HEAD;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
-import javax.ws.rs.DefaultValue;
import javax.ws.rs.core.Response;
-import org.openecomp.mso.HealthCheckUtils;
+import org.openecomp.mso.HealthCheckUtils;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.utils.UUIDChecker;
-@Path("/")
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/healthcheck")
+@Api(value="/healthcheck",description="API Handler Infra Health Check")
public class HealthcheckHandler {
public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@@ -41,8 +44,8 @@ public class HealthcheckHandler {
@HEAD
@GET
- @Path("/healthcheck")
@Produces("text/html")
+ @ApiOperation(value="Perform Health Check",response=Response.class)
public Response healthcheck (@QueryParam("requestId") String requestId) {
long startTime = System.currentTimeMillis ();
MsoLogger.setServiceName ("Healthcheck");
@@ -62,51 +65,4 @@ public class HealthcheckHandler {
msoLogger.debug("healthcheck - Successful");
return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
}
-
- @HEAD
- @GET
- @Path("/nodehealthcheck")
- @Produces("text/html")
- public Response nodeHealthcheck () {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("NodeHealthcheck");
- // Generate a Request Id
- String requestId = UUIDChecker.generateUUID(msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck (msoLogger, startTime)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, requestId)) {
- msoLogger.debug("nodeHealthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- } else {
- msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available.");
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
- }
-
- @HEAD
- @GET
- @Path("/globalhealthcheck")
- @Produces("text/html")
- public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("GlobalHealthcheck");
- // Generate a Request Id
- String requestId = UUIDChecker.generateUUID(msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck (msoLogger, startTime)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) {
- msoLogger.debug("globalHealthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- } else {
- msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available");
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
- }
-
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
index 7088a33b16..1d70224100 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
new file mode 100644
index 0000000000..f6abcc35b1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
@@ -0,0 +1,228 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.apihandlerinfra;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.ApiOperation;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.ResponseHandler;
+import org.openecomp.mso.apihandlerinfra.tasksbeans.*;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+
+
+@Path("/tasks")
+public class ManualTasks {
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ @POST
+ @Path("/{version:[vV]1}/{taskId}/complete")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Complete specified task",response=Response.class)
+ public Response completeTask(String request, @PathParam("version") String version, @PathParam("taskId") String taskId) {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+ TasksRequest tr = null;
+
+ MsoRequest msoRequest = new MsoRequest (requestId);
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ tr= mapper.readValue(request, TasksRequest.class);
+
+ if (tr.getRequestDetails() == null) {
+ throw new ValidationException("requestDetails");
+ }
+ if (tr.getRequestDetails().getRequestInfo() == null) {
+ throw new ValidationException("requestInfo");
+ }
+ if (empty(tr.getRequestDetails().getRequestInfo().getSource())) {
+ throw new ValidationException("source");
+ }
+ if (empty(tr.getRequestDetails().getRequestInfo().getRequestorId())) {
+ throw new ValidationException("requestorId");
+ }
+
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, request, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ // Transform the request to Camunda-style Complete request
+ Variables variablesForComplete = new Variables();
+ Value sourceValue = new Value();
+ sourceValue.setValue(tr.getRequestDetails().getRequestInfo().getSource());
+ Value responseValue = new Value();
+ responseValue.setValue(tr.getRequestDetails().getRequestInfo().getResponseValue().name());
+ Value requestorIdValue = new Value();
+ requestorIdValue.setValue(tr.getRequestDetails().getRequestInfo().getRequestorId());
+ variablesForComplete.setSource(sourceValue);
+ variablesForComplete.setResponseValue(responseValue);
+ variablesForComplete.setRequestorId(requestorIdValue);
+
+ String camundaJsonReq = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ camundaJsonReq = mapper.writeValueAsString(variablesForComplete);
+ msoLogger.debug("Camunda Json Request: " + camundaJsonReq);
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of JSON object to Camunda request failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ "Mapping of JSON object to Camunda Request failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, request, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+ String requestUrl = "/mso/task/" + taskId + "/complete";
+ try {
+ requestClient = RequestClientFactory.getRequestClient (requestUrl, MsoPropertiesUtils.loadMsoProperties ());
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to Camunda engine for url: " + requestClient.getUrl ());
+
+ System.out.println("URL : " + requestClient.getUrl ());
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed");
+
+ response = requestClient.post(camundaJsonReq);
+
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null);
+ } catch (Exception e) {
+ msoLogger.debug ("Exception:", e);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ if (response == null) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+
+ // BPEL accepted the request, the request is in progress
+ if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
+ msoLogger.debug ("Received good response from Camunda");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
+ TaskRequestReference trr = new TaskRequestReference();
+ trr.setTaskId(taskId);
+ String completeResp = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ completeResp = mapper.writeValueAsString(trr);
+ }
+ catch (Exception e) {
+ msoLogger.debug("Unable to format response",e);
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to bad response format" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Bad response format");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Bad response format");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+ msoLogger.debug("Response to the caller: " + completeResp);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) completeResp);
+ return Response.status (HttpStatus.SC_ACCEPTED).entity (completeResp).build ();
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ }
+
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
index cdccaf27e3..0f39ad07b6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java
index 2f01c4fcdb..1db847e9d9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java
index 2ef1e4a0ec..5204816bb8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
index 0dd9a03c90..3f8074b9ba 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index 5b84a59b6b..8ee106efc1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -1,8 +1,9 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,39 +21,12 @@
package org.openecomp.mso.apihandlerinfra;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.StringTokenizer;
-
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
import org.hibernate.Session;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.CloudConfiguration;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
@@ -64,16 +38,41 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceException;
import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo;
import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest;
-import org.openecomp.mso.db.HibernateUtils;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
import org.openecomp.mso.utils.UUIDChecker;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.StringTokenizer;
public class MsoRequest {
@@ -109,7 +108,7 @@ public class MsoRequest {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static final String NOT_PROVIDED = "not provided";
- protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb ();
+ protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
MsoRequest (String requestId) {
this.requestId = requestId;
@@ -147,7 +146,7 @@ public class MsoRequest {
RequestError re = new RequestError();
- if(exceptionType.name().equals("PolicyException")){
+ if("PolicyException".equals(exceptionType.name())){
PolicyException pe = new PolicyException();
pe.setMessageId(messageId);
@@ -165,11 +164,9 @@ public class MsoRequest {
se.setMessageId(messageId);
se.setText(text);
if(variables != null){
- if(variables != null){
- for(String variable: variables){
- se.getVariables().add(variable);
- }
- }
+ for(String variable: variables){
+ se.getVariables().add(variable);
+ }
}
re.setServiceException(se);
}
@@ -214,7 +211,7 @@ public class MsoRequest {
requestJSON = mapper.writeValueAsString(sir.getRequestDetails());
} catch(Exception e){
- throw new ValidationException ("Parse ServiceInstanceRequest to JSON string");
+ throw new ValidationException ("Parse ServiceInstanceRequest to JSON string",e);
}
if(instanceIdMap != null){
@@ -287,10 +284,31 @@ public class MsoRequest {
this.requestScope = modelInfo.getModelType().name();
+ // modelCustomizationId is required when usePreLoad is false for v4 and higher for VF Module Create
+ if(requestParameters != null && reqVersion > 3 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.createInstance && !requestParameters.isUsePreload()) {
+ if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) {
+ throw new ValidationException("modelCustomizationId");
+ }
+ }
+
+ // modelCustomizationId is required when usePreLoad is false for v5 and higher for VF Module Replace
+ if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.replaceInstance && !requestParameters.isUsePreload()) {
+ if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) {
+ throw new ValidationException("modelCustomizationId");
+ }
+ }
+
+ // modelCustomizationId or modelCustomizationName are required when usePreLoad is false for v5 and higher for VNF Replace
+ if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance && !requestParameters.isUsePreload()) {
+ if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId()) && modelInfo.getModelCustomizationName() == null) {
+ throw new ValidationException("modelCustomizationId or modelCustomizationName");
+ }
+ }
+
//is required for serviceInstance delete macro when aLaCarte=false (v3)
- //create and updates except for network
+ //create and updates except for network (except v4)
if (empty (modelInfo.getModelInvariantId ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
- !(requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) {
+ !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) {
throw new ValidationException ("modelInvariantId");
}
@@ -307,11 +325,17 @@ public class MsoRequest {
throw new ValidationException ("modelName");
}
- if (empty (modelInfo.getModelVersion ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
- !(requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) {
+ if (empty (modelInfo.getModelVersion ()) && ((this.reqVersion == 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
+ !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) {
throw new ValidationException ("modelVersion");
}
+ // modelVersionId doesn't exist in v2, not required field in v3, is required for serviceInstance delete macro when aLaCarte=false in v4
+ if (this.reqVersion > 3 && empty (modelInfo.getModelVersionId()) && ((!this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
+ (action == Action.createInstance || action == Action.updateInstance))) {
+ throw new ValidationException ("modelVersionId");
+ }
+
if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) {
if(this.reqVersion<=2){
throw new ValidationException ("modelCustomizationName");
@@ -328,12 +352,9 @@ public class MsoRequest {
if(!empty(modelInfo.getModelNameVersionId())){
modelInfo.setModelVersionId(modelInfo.getModelNameVersionId());
}
- if(!empty(modelInfo.getModelVersionId())){
- modelInfo.setModelNameVersionId(modelInfo.getModelVersionId());
- }
this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration ();
- if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ())) ||
+ if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ()) && this.reqVersion < 5) ||
(!requestScope.equalsIgnoreCase (ModelType.service.name ())) && action != Action.updateInstance))
&& cloudConfiguration == null) {
throw new ValidationException ("cloudConfiguration");
@@ -349,7 +370,6 @@ public class MsoRequest {
}
-
if (requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) {
if (requestParameters == null) {
throw new ValidationException ("requestParameters");
@@ -358,6 +378,16 @@ public class MsoRequest {
throw new ValidationException ("subscriptionServiceType");
}
}
+
+ if (this.reqVersion > 4 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) {
+ SubscriberInfo subscriberInfo = sir.getRequestDetails ().getSubscriberInfo();
+ if (subscriberInfo == null) {
+ throw new ValidationException ("subscriberInfo");
+ }
+ if (empty (subscriberInfo.getGlobalSubscriberId ())) {
+ throw new ValidationException ("globalSubscriberId");
+ }
+ }
if(requestScope.equalsIgnoreCase(ModelType.service.name())){
this.serviceInstanceType = modelInfo.getModelName();
@@ -378,10 +408,20 @@ public class MsoRequest {
}
}
- if (empty (requestInfo.getProductFamilyId ()) && ((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) ||
- (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)))) {
+ if (empty (requestInfo.getProductFamilyId ())) {
+ // Mandatory for vnf Create(aLaCarte=true), Network Create(aLaCarte=true) and network update
+ //Mandatory for macro request create service instance
+ if((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) ||
+ (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)) ||
+ (this.reqVersion > 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance)) {
throw new ValidationException ("productFamilyId");
}
+ }
+
+ //required for all operations in V4
+ if(empty(requestInfo.getRequestorId()) && this.reqVersion > 3) {
+ throw new ValidationException ("requestorId");
+ }
if (empty (requestInfo.getSource ())) {
throw new ValidationException ("source");
@@ -401,11 +441,12 @@ public class MsoRequest {
for(RelatedInstanceList relatedInstanceList : instanceList){
RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- if (relatedInstance.getModelInfo () == null) {
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo ();
+ if (relatedInstanceModelInfo == null) {
throw new ValidationException ("modelInfo in relatedInstance");
}
- if (relatedInstance.getModelInfo ().getModelType () == null) {
+ if (relatedInstanceModelInfo.getModelType () == null) {
throw new ValidationException ("modelType in relatedInstance");
}
@@ -426,50 +467,47 @@ public class MsoRequest {
if (action != Action.deleteInstance) {
+ if(!relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
- // ModelInvariantId is not required in volumeGroup relatedInstance
- if(!(relatedInstance.getModelInfo ().getModelType ().equals(ModelType.volumeGroup)) &&
- empty (relatedInstance.getModelInfo ().getModelInvariantId ())) {
+ if(empty (relatedInstanceModelInfo.getModelInvariantId ())) {
throw new ValidationException ("modelInvariantId in relatedInstance");
+ } else if(this.reqVersion > 3 && empty(relatedInstanceModelInfo.getModelVersionId ())) {
+ throw new ValidationException("modelVersionId in relatedInstance");
+ } else if(empty(relatedInstanceModelInfo.getModelName ())) {
+ throw new ValidationException ("modelName in relatedInstance");
+ } else if (empty (relatedInstanceModelInfo.getModelVersion ())) {
+ throw new ValidationException ("modelVersion in relatedInstance");
+ }
}
- if (!empty (relatedInstance.getModelInfo ().getModelInvariantId ()) &&
- !UUIDChecker.isValidUUID (relatedInstance.getModelInfo ().getModelInvariantId ())) {
+ if (!empty (relatedInstanceModelInfo.getModelInvariantId ()) &&
+ !UUIDChecker.isValidUUID (relatedInstanceModelInfo.getModelInvariantId ())) {
throw new ValidationException ("modelInvariantId format in relatedInstance");
}
-
- if (empty(relatedInstance.getModelInfo ().getModelName ()) &&
- !(relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) {
- throw new ValidationException ("modelName in relatedInstance");
}
- if (empty (relatedInstance.getModelInfo ().getModelVersion ()) &&
- !(relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) {
- throw new ValidationException ("modelVersion in relatedInstance");
- }
+ if (empty (relatedInstanceModelInfo.getModelCustomizationName ()) && relatedInstanceModelInfo.getModelType ().equals (ModelType.vnf) ) {
+ if(this.reqVersion >=3 && empty (relatedInstanceModelInfo.getModelCustomizationId()) && action != Action.deleteInstance) {
+ throw new ValidationException ("modelCustomizationName or modelCustomizationId in relatedInstance of vnf");
+ } else if(this.reqVersion < 3) {
+ throw new ValidationException ("modelCustomizationName in relatedInstance");
}
-
- if (empty (relatedInstance.getModelInfo ().getModelCustomizationName ()) &&
- relatedInstance.getModelInfo ().getModelType ().equals (ModelType.vnf)) {
- throw new ValidationException ("modelCustomizationName in relatedInstance");
}
- if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
+ if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
isRelatedServiceInstancePresent = true;
if (!relatedInstance.getInstanceId ().equals (this.sir.getServiceInstanceId ())) {
throw new ValidationException ("serviceInstanceId matching the serviceInstanceId in request URI");
}
- serviceModelName = relatedInstance.getModelInfo ().getModelName ();
- asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion ();
- }
- else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ serviceModelName = relatedInstanceModelInfo.getModelName ();
+ asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion ();
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
isRelatedVnfInstancePresent = true;
if (!relatedInstance.getInstanceId ().equals (this.sir.getVnfInstanceId ())) {
throw new ValidationException ("vnfInstanceId matching the vnfInstanceId in request URI");
}
- vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName();
- }
- else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) {
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
volumeGroupId = relatedInstance.getInstanceId ();
}
}
@@ -556,21 +594,22 @@ public class MsoRequest {
try{
if(queryParam.equalsIgnoreCase("filter")){
-
- StringTokenizer st = new StringTokenizer(entry.getValue().get(0), ":");
-
- int counter=0;
- String mapKey=null;
- List<String> orchestrationList = new ArrayList<String>();
- while (st.hasMoreElements()) {
- if(counter == 0){
- mapKey = st.nextElement() + "";
- } else{
- orchestrationList.add(st.nextElement() + "");
- }
- counter++;
- }
- orchestrationFilterParams.put(mapKey, orchestrationList);
+ for(String value : entry.getValue()) {
+ StringTokenizer st = new StringTokenizer(value, ":");
+
+ int counter=0;
+ String mapKey=null;
+ List<String> orchestrationList = new ArrayList<String>();
+ while (st.hasMoreElements()) {
+ if(counter == 0){
+ mapKey = st.nextElement() + "";
+ } else{
+ orchestrationList.add(st.nextElement() + "");
+ }
+ counter++;
+ }
+ orchestrationFilterParams.put(mapKey, orchestrationList);
+ }
}
}catch(Exception e){
@@ -590,7 +629,7 @@ public class MsoRequest {
Session session = null;
try {
- session = hibernateUtils.getSessionFactory ().openSession ();
+ session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
session.beginTransaction ();
if (null == sir) {
@@ -727,7 +766,7 @@ public class MsoRequest {
public void updateFinalStatus (Status status) {
int result = 0;
try {
- result = RequestsDatabase.updateInfraFinalStatus (requestId,
+ result = (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId,
status.toString (),
this.errorMessage,
this.progress,
@@ -939,6 +978,20 @@ public class MsoRequest {
//mapper.configure(Feature.WRAP_ROOT_VALUE, true);
msoLogger.debug ("building sir from object " + sir);
requestJSON = mapper.writeValueAsString(sir);
+
+ // Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields
+
+ msoLogger.debug("REQUEST JSON before mapping: " + requestJSON);
+ // modelUuid = modelVersionId
+ requestJSON = requestJSON.replaceAll("\"modelVersionId\":","\"modelUuid\":");
+ // modelCustomizationUuid = modelCustomizationId
+ requestJSON = requestJSON.replaceAll("\"modelCustomizationId\":","\"modelCustomizationUuid\":");
+ // modelInstanceName = modelCustomizationName
+ requestJSON = requestJSON.replaceAll("\"modelCustomizationName\":","\"modelInstanceName\":");
+ // modelInvariantUuid = modelInvariantId
+ requestJSON = requestJSON.replaceAll("\"modelInvariantId\":","\"modelInvariantUuid\":");
+ msoLogger.debug("REQUEST JSON after mapping: " + requestJSON);
+
return requestJSON;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
index 59b93eadde..f61a50bb06 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
@@ -39,8 +39,6 @@ import javax.xml.bind.Unmarshaller;
import javax.xml.transform.sax.SAXSource;
import org.apache.http.HttpStatus;
-import org.xml.sax.InputSource;
-
import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.apihandlerinfra.networkbeans.ActionType;
import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkInputs;
@@ -55,8 +53,13 @@ import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
+import org.xml.sax.InputSource;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
@Path("/{version: v1|v2|v3}/network-request")
+@Api(value="/{version: v1|v2|v3}/network-request",description="API Requests for network requests")
public class NetworkInfoHandler {
protected ObjectFactory beansObjectFactory = new ObjectFactory ();
@@ -64,6 +67,7 @@ public class NetworkInfoHandler {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@GET
+ @ApiOperation(value="Finds Network Requests",response=Response.class)
public Response queryFilters (@QueryParam("network-type") String networkType,
@QueryParam("service-type") String serviceType,
@QueryParam("aic-node-clli") String aicNodeClli,
@@ -94,6 +98,7 @@ public class NetworkInfoHandler {
@GET
@Path(Constants.REQUEST_ID_PATH)
+ @ApiOperation(value="Add a Network Outputs from requestId and version",response=Response.class)
public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
// Check INFRA_ACTIVE_REQUESTS table to find info
// on this request
@@ -213,7 +218,7 @@ public class NetworkInfoHandler {
String responseString = null;
- InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, "NETWORK");
+ InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, "NETWORK");
if (activeReq != null) {
// build response for active
responseString = infraRequestsResponse (activeReq, version);
@@ -230,7 +235,7 @@ public class NetworkInfoHandler {
getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
- List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ List <InfraActiveRequests> activeReqList = (RequestsDatabase.getInstance()).getRequestListFromInfraActive (queryAttribute,
queryValue,
"NETWORK");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
index c25f5ce1ef..c87b4f387d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -56,10 +56,10 @@ import org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.db.HibernateUtils;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
public class NetworkMsoInfraRequest {
@@ -80,7 +80,7 @@ public class NetworkMsoInfraRequest {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static final String NOT_PROVIDED = "not provided";
- protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb ();
+ protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
NetworkMsoInfraRequest (String requestId) {
this.requestId = requestId;
@@ -255,7 +255,7 @@ public class NetworkMsoInfraRequest {
Session session = null;
try {
- session = hibernateUtils.getSessionFactory ().openSession ();
+ session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
session.beginTransaction ();
InfraActiveRequests aq = new InfraActiveRequests ();
@@ -348,7 +348,7 @@ public class NetworkMsoInfraRequest {
public void updateFinalStatus (Status status) {
try {
- RequestsDatabase.updateInfraFinalStatus (requestId,
+ (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId,
status.toString (),
this.errorMessage,
this.progress,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
index 8d44d213b1..395b2529f5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -94,6 +94,8 @@ public class NetworkRequestHandler {
.entity (NOT_FOUND)
.build ();
+ private RequestsDatabase requestDB = RequestsDatabase.getInstance();
+
@GET
public Response queryFilters (@QueryParam("network-type") String networkType,
@QueryParam("service-type") String serviceType,
@@ -244,7 +246,7 @@ public class NetworkRequestHandler {
String responseString = null;
- InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, "NETWORK");
+ InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId, "NETWORK");
if (activeReq != null) {
// build response for active
responseString = infraRequestsResponse (activeReq, version);
@@ -261,7 +263,7 @@ public class NetworkRequestHandler {
getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
- List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ List <InfraActiveRequests> activeReqList = requestDB.getRequestListFromInfraActive (queryAttribute,
queryValue,
"NETWORK");
@@ -433,7 +435,7 @@ public class NetworkRequestHandler {
InfraActiveRequests dup = null;
try {
- dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (),
+ dup = requestDB.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (),
msoRequest.getRequestInfo ().getAction ().value (),
"NETWORK");
@@ -471,7 +473,7 @@ public class NetworkRequestHandler {
InfraActiveRequests dup = null;
msoLogger.debug ("Checking for a duplicate with the same network-id");
try {
- dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (),
+ dup = requestDB.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (),
msoRequest.getRequestInfo ().getAction ().value (),
"NETWORK");
@@ -511,7 +513,7 @@ public class NetworkRequestHandler {
String orchestrationURI = "";
// Query MSO Catalog DB
- try (CatalogDatabase db = new CatalogDatabase()) {
+ try (CatalogDatabase db = CatalogDatabase.getInstance()) {
Recipe recipe = null;
@@ -618,7 +620,7 @@ public class NetworkRequestHandler {
String bpelXMLResponseBody = respHandler.getResponseBody ();
msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.IN_PROGRESS);
- RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ requestDB.updateInfraStatus (msoRequest.getRequestId (),
Status.IN_PROGRESS.toString (),
Constants.PROGRESS_REQUEST_IN_PROGRESS,
Constants.MODIFIED_BY_APIHANDLER);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
index 3bdb745b15..b01c6d6e2a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -26,28 +26,34 @@ import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.apache.http.HttpStatus;
-
import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkType;
import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkTypes;
import org.openecomp.mso.apihandlerinfra.networkbeans.ObjectFactory;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.NetworkResource;
import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
@Path(Constants.NETWORK_TYPES_PATH)
+@Api(value="/{version: v1|v2|v3}/network-types",description="API Requests to find Network Types")
public class NetworkTypesHandler {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@GET
- public Response getNetworkTypes () {
+ @ApiOperation(value="Finds Network Types",response=Response.class)
+ public Response getNetworkTypes (@PathParam("version") String version) {
long startTime = System.currentTimeMillis ();
MsoLogger.setServiceName ("getNetworkTypes");
// Generate a Request Id
@@ -55,7 +61,7 @@ public class NetworkTypesHandler {
msoLogger.debug ("Incoming request received for getNetworkTypes");
List <NetworkResource> networkResources = null;
- try (CatalogDatabase db = new CatalogDatabase()){
+ try (CatalogDatabase db = CatalogDatabase.getInstance()){
networkResources = db.getAllNetworkResources ();
} catch (Exception e) {
msoLogger.debug ("No connection to catalog DB", e);
@@ -75,9 +81,9 @@ public class NetworkTypesHandler {
for (int i = 0; i < networkResources.size (); i++) {
NetworkType networkType = beansObjectFactory.createNetworkType ();
NetworkResource vr = networkResources.get (i);
- networkType.setType (vr.getNetworkType ());
+ networkType.setType (vr.getModelName());
networkType.setDescription (vr.getDescription ());
- networkType.setId (String.valueOf (vr.getId ()));
+ networkType.setId (String.valueOf (vr.getModelUUID()));
networkTypes.getNetworkType ().add (networkType);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
new file mode 100644
index 0000000000..cb4b94ce3a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
@@ -0,0 +1,46 @@
+package org.openecomp.mso.apihandlerinfra;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.mso.HealthCheckUtils;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/nodehealthcheck")
+@Api(value="/nodehealthcheck",description="API Handler Infra Node Health Check")
+public class NodeHealthcheckHandler {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @HEAD
+ @GET
+ @Produces("text/html")
+ @ApiOperation(value="Performing node health check",response=Response.class)
+ public Response nodeHealthcheck () {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("NodeHealthcheck");
+ // Generate a Request Id
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ HealthCheckUtils healthCheck = new HealthCheckUtils ();
+ if (!healthCheck.siteStatusCheck (msoLogger, startTime)) {
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+
+ if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, requestId)) {
+ msoLogger.debug("nodeHealthcheck - Successful");
+ return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
+ } else {
+ msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available.");
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
index f42ba97e89..26fdba47c4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
@@ -1,8 +1,9 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +25,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
@@ -33,16 +39,26 @@ import javax.ws.rs.core.UriInfo;
import org.apache.http.HttpStatus;
import org.codehaus.jackson.map.ObjectMapper;
-
import org.openecomp.mso.apihandler.common.ErrorNumbers;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
-@Path("/")
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/orchestrationRequests")
+@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests")
public class OrchestrationRequests {
public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@@ -51,6 +67,8 @@ public class OrchestrationRequests {
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private RequestsDatabase requestsDB = RequestsDatabase.getInstance();
+
/**
*
*/
@@ -59,9 +77,10 @@ public class OrchestrationRequests {
}
@GET
- @Path("/orchestrationRequests/{version:[vV][2-3]}/{requestId}")
+ @Path("/{version:[vV][2-5]}/{requestId}")
+ @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class)
@Produces(MediaType.APPLICATION_JSON)
- public Response getOrchestrationRequest(@PathParam("requestId") String requestId) {
+ public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) {
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
@@ -72,7 +91,7 @@ public class OrchestrationRequests {
InfraActiveRequests requestDB = null;
try {
- requestDB = RequestsDatabase.getRequestFromInfraActive(requestId);
+ requestDB = requestsDB.getRequestFromInfraActive(requestId);
} catch (Exception e) {
msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
@@ -112,9 +131,10 @@ public class OrchestrationRequests {
}
@GET
- @Path("/orchestrationRequests/{version:[vV][2-3]}")
+ @Path("/{version:[vV][2-5]}")
+ @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class)
@Produces(MediaType.APPLICATION_JSON)
- public Response getOrchestrationRequest(@Context UriInfo ui) {
+ public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) {
long startTime = System.currentTimeMillis ();
@@ -131,7 +151,7 @@ public class OrchestrationRequests {
Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams);
- activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap);
+ activeRequests = requestsDB.getOrchestrationFiltersFromInfraActive(orchestrationMap);
orchestrationList = new GetOrchestrationListResponse();
@@ -166,10 +186,11 @@ public class OrchestrationRequests {
@POST
- @Path("/orchestrationRequests/v3/{requestId}/unlock")
+ @Path("/{version: [vV][3-5]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId) {
+ @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class)
+ public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) {
MsoRequest msoRequest = new MsoRequest (requestId);
@@ -218,7 +239,7 @@ public class OrchestrationRequests {
}
try {
- requestDB = RequestsDatabase.getRequestFromInfraActive(requestId);
+ requestDB = requestsDB.getRequestFromInfraActive(requestId);
if(requestDB == null) {
Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
@@ -238,7 +259,7 @@ public class OrchestrationRequests {
if(status == Status.IN_PROGRESS || status == Status.PENDING){
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED);
reqStatus.setRequestState(Status.UNLOCKED.toString ());
- RequestsDatabase.updateInfraStatus (requestId,
+ requestsDB.updateInfraStatus (requestId,
Status.UNLOCKED.toString (),
Constants.MODIFIED_BY_APIHANDLER);
@@ -323,7 +344,7 @@ public class OrchestrationRequests {
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
}catch(Exception e){
- msoLogger.debug("Exception caught mapping requestBody to RequestDetails");
+ msoLogger.debug("Exception caught mapping requestBody to RequestDetails",e);
}
request.setRequestDetails(requestDetails);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
index 234f4068e3..ac4c01175a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
index 940fcc9c57..2b7511a22e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -43,6 +43,7 @@ public class RequestActionMap {
actionMap.put("createInstance", "createInstance");
actionMap.put("deleteInstance", "deleteInstance");
actionMap.put("updateInstance", "updateInstance");
+ actionMap.put("replaceInstance", "replaceInstance");
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
index 988d72cc6f..66a14db610 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
@@ -1,8 +1,9 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,55 +37,91 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.codehaus.jackson.map.ObjectMapper;
-
-import org.openecomp.mso.apihandler.common.*;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.ResponseHandler;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestReferences;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesResponse;
import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.*;
+import org.openecomp.mso.db.catalog.beans.NetworkResource;
+import org.openecomp.mso.db.catalog.beans.Recipe;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
-@Path("/serviceInstances/{version:[vV][2-3]}")
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/serviceInstances")
+@Api(value="/serviceInstances",description="API Requests for Service Instances")
public class ServiceInstances {
- private HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ private HashMap<String, String> instanceIdMap = new HashMap<>();
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ @POST
+ @Path("/{version:[vV][3-5]}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create a Service Instance on a version provided",response=Response.class)
+ public Response createServiceInstance(String request, @PathParam("version") String version) {
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ Response response = serviceInstances(request, Action.createInstance, null, version);
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][5]}/{serviceInstanceId}/activate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Activate provided Service Instance",response=Response.class)
+ public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
- private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties ();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.activateInstance, instanceIdMap, version);
- /**
- *
- */
- public ServiceInstances() {
- // TODO Auto-generated constructor stub
+ return response;
}
-
+
@POST
- @Path("/")
+ @Path("/{version:[vV][5]}/{serviceInstanceId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public Response createServiceInstance(String request, @PathParam("version") String version) {
+ @ApiOperation(value="Deactivate provided Service Instance",response=Response.class)
+ public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
- Response response = serviceInstances(request, Action.createInstance, null, version);
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.deactivateInstance, instanceIdMap, version);
return response;
}
+
@DELETE
- @Path("/{serviceInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided Service Instance",response=Response.class)
public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
@@ -93,23 +130,56 @@ public class ServiceInstances {
}
@POST
- @Path("/{serviceInstanceId}/vnfs")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create VNF on a specified version and serviceInstance",response=Response.class)
public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
- msoLogger.debug ("version is: " + version);
+ msoLogger.debug ("version is: " + version);
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version);
return response;
}
+
+ @POST
+ @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Replace provided VNF instance",response=Response.class)
+ public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+ msoLogger.debug ("version is: " + version);
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.replaceInstance, instanceIdMap, version);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update VNF on a specified version, serviceInstance and vnfInstance",response=Response.class)
+ public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version);
+
+ return response;
+ }
+
@DELETE
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided VNF instance",response=Response.class)
public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId) {
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
@@ -119,26 +189,46 @@ public class ServiceInstances {
}
@POST
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class)
public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId) {
- msoLogger.debug ("version is: " + version);
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+ msoLogger.debug ("version is: " + version);
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version);
return response;
}
+
+ @POST
+ @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class)
+ public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+
+ msoLogger.debug ("version is: " + version);
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ Response response = serviceInstances(request, Action.replaceInstance, instanceIdMap, version);
+
+ return response;
+ }
@PUT
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",response=Response.class)
public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId,
- @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
@@ -149,12 +239,13 @@ public class ServiceInstances {
}
@DELETE
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided VfModule instance",response=Response.class)
public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId,
- @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
@@ -167,11 +258,12 @@ public class ServiceInstances {
@POST
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create VolumeGroup on a specified version, serviceInstance, vnfInstance",response=Response.class)
public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId) {
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
@@ -181,12 +273,13 @@ public class ServiceInstances {
}
@PUT
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",response=Response.class)
public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId,
- @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
@@ -198,12 +291,13 @@ public class ServiceInstances {
}
@DELETE
- @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided VolumeGroup instance",response=Response.class)
public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("vnfInstanceId") String vnfInstanceId,
- @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
@@ -215,9 +309,10 @@ public class ServiceInstances {
}
@POST
- @Path("/{serviceInstanceId}/networks")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create NetworkInstance on a specified version and serviceInstance ",response=Response.class)
public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
@@ -227,11 +322,12 @@ public class ServiceInstances {
}
@PUT
- @Path("/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, networkInstance",response=Response.class)
public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("networkInstanceId") String networkInstanceId) {
+ @PathParam("networkInstanceId") String networkInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("networkInstanceId", networkInstanceId);
@@ -241,11 +337,12 @@ public class ServiceInstances {
}
@DELETE
- @Path("/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided Network instance",response=Response.class)
public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
- @PathParam("networkInstanceId") String networkInstanceId) {
+ @PathParam("networkInstanceId") String networkInstanceId) {
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("networkInstanceId", networkInstanceId);
@@ -258,573 +355,647 @@ public class ServiceInstances {
private Response serviceInstances(String requestJSON, Action action, HashMap<String,String> instanceIdMap, String version) {
- String requestId = UUIDChecker.generateUUID(msoLogger);
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("requestId is: " + requestId);
- ServiceInstancesRequest sir = null;
-
- MsoRequest msoRequest = new MsoRequest (requestId);
-
-
- try{
- ObjectMapper mapper = new ObjectMapper();
- sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
-
- } catch(Exception e){
- msoLogger.debug ("Mapping of request to JSON object failed : ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
- "Mapping of request to JSON object failed. " + e.getMessage(),
- ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId () != null) {
- msoLogger.debug ("Mapping of request to JSON object failed");
- msoRequest.createRequestRecord (Status.FAILED, action);
- }
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- }
-
-
- try{
- msoRequest.parse(sir, instanceIdMap, action, version);
- } catch (Exception e) {
- msoLogger.debug ("Validation failed: ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
- "Error parsing request. " + e.getMessage(),
- ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId () != null) {
- msoLogger.debug ("Logging failed message to the database");
- msoRequest.createRequestRecord (Status.FAILED, action);
- }
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- }
-
- InfraActiveRequests dup = null;
- String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
- String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
- try {
- if(!(instanceName==null && requestScope.equals("service") && action == Action.createInstance)){
- dup = RequestsDatabase.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
- }
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
-
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
- e.getMessage(),
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- null) ;
-
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- }
-
- if (dup != null) {
- // Found the duplicate record. Return the appropriate error.
- String instance = null;
- if(instanceName != null){
- instance = instanceName;
- }else{
- instance = instanceIdMap.get(requestScope + "InstanceId");
- }
- String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
- //List<String> variables = new ArrayList<String>();
- //variables.add(dup.getRequestStatus());
-
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
- dupMessage,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- null) ;
-
-
- msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service");
- msoRequest.createRequestRecord (Status.FAILED, action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- }
-
-
- ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
-
- RequestReferences referencesResponse = new RequestReferences();
-
- referencesResponse.setRequestId(requestId);
-
- serviceResponse.setRequestReferences(referencesResponse);
-
- CatalogDatabase db = null;
- try {
- db = new CatalogDatabase ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- "No communication to catalog DB " + e.getMessage (),
- ErrorNumbers.SVC_NO_SERVER_RESOURCES,
- null);
- alarmLogger.sendAlarm ("MsoDatabaseAccessError",
- MsoAlarmLogger.CRITICAL,
- Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
- msoRequest.createRequestRecord (Status.FAILED,action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- }
-
-
-
- RecipeLookupResult recipeLookupResult = null;
- try {
- recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action);
- } catch (ValidationException e) {
- msoLogger.debug ("Validation failed: ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
- "Error validating request. " + e.getMessage(),
- ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId () != null) {
- msoLogger.debug ("Logging failed message to the database");
- msoRequest.createRequestRecord (Status.FAILED, action);
- }
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- "Recipe could not be retrieved from catalog DB " + e.getMessage (),
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
- null);
- alarmLogger.sendAlarm ("MsoDatabaseAccessError",
- MsoAlarmLogger.CRITICAL,
- Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB));
- msoRequest.createRequestRecord (Status.FAILED,action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- db.close();
- return response;
- }
-
- if (recipeLookupResult == null) {
- msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- "Recipe does not exist in catalog DB",
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
- null);
- msoRequest.createRequestRecord (Status.FAILED, action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- db.close();
- return response;
- }
-
-
- Boolean isBaseVfModule = false;
-
- if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule)) {
- String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion ();
-
- // Get VF Module-specific base module indicator
- VfModule vfm = null;
-
- if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
- vfm = db.getVfModuleType (msoRequest.getVfModuleType (), asdcServiceModelVersion);
- }
- else {
- vfm = db.getVfModuleType (msoRequest.getVfModuleType ());
- }
-
- if (vfm != null) {
- if (vfm.getIsBase() == 1) {
- isBaseVfModule = true;
- }
- }
- else if (action == Action.createInstance || action == Action.updateInstance){
- // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB.
- // This request cannot proceed
- msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB");
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- String serviceVersionText = "";
- if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
- serviceVersionText = " with version " + asdcServiceModelVersion;
- }
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- "VnfType " + msoRequest.getVnfType () + " and VF Module Model Name " + msoRequest.getVfModuleModelName() + serviceVersionText + " not found in MSO Catalog DB",
- ErrorNumbers.SVC_BAD_PARAMETER,
- null);
- msoRequest.createRequestRecord (Status.FAILED, action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No matching vfModuleType found in DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- db.close();
- return response;
- }
- }
-
- db.close();
-
- String serviceInstanceId = "";
- String vnfId = "";
- String vfModuleId = "";
- String volumeGroupId = "";
- String networkId = "";
- ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
-
- if(siReq.getServiceInstanceId () != null){
- serviceInstanceId = siReq.getServiceInstanceId ();
- }
-
- if(siReq.getVnfInstanceId () != null){
- vnfId = siReq.getVnfInstanceId ();
- }
-
- if(siReq.getVfModuleInstanceId () != null){
- vfModuleId = siReq.getVfModuleInstanceId ();
- }
-
- if(siReq.getVolumeGroupInstanceId () != null){
- volumeGroupId = siReq.getVolumeGroupInstanceId ();
- }
-
- if(siReq.getNetworkInstanceId () != null){
- networkId = siReq.getNetworkInstanceId ();
- }
-
-
- requestId = msoRequest.getRequestId ();
- msoLogger.debug ("requestId is: " + requestId);
- msoLogger.debug ("About to insert a record");
-
- try {
- msoRequest.createRequestRecord (Status.PENDING, action);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
- MsoException.ServiceException,
- "Exception while creating record in DB " + e.getMessage(),
- ErrorNumbers.SVC_BAD_PARAMETER,
- null);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
- }
-
- RequestClient requestClient = null;
- HttpResponse response = null;
- long subStartTime = System.currentTimeMillis();
- try {
- requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), props);
- // Capture audit event
- msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
-
- System.out.println("URL : " + requestClient.getUrl ());
-
- response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (),
- serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
- msoRequest.getServiceInstanceType (),
- msoRequest.getVnfType (), msoRequest.getVfModuleType (),
- msoRequest.getNetworkType (), msoRequest.getRequestJSON());
-
- msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
- } catch (Exception e) {
- msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
- MsoException.ServiceException,
- "Failed calling bpmn " + e.getMessage (),
- ErrorNumbers.SVC_NO_SERVER_RESOURCES,
- null);
- alarmLogger.sendAlarm ("MsoConfigurationError",
- MsoAlarmLogger.CRITICAL,
- Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
- msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
- return resp;
- }
-
- if (response == null) {
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
- MsoException.ServiceException,
- "bpelResponse is null",
- ErrorNumbers.SVC_NO_SERVER_RESOURCES,
- null);
- msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
- return resp;
- }
-
- ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
- int bpelStatus = respHandler.getStatus ();
-
- // BPEL accepted the request, the request is in progress
- if (bpelStatus == HttpStatus.SC_ACCEPTED) {
- String camundaJSONResponseBody = respHandler.getResponseBody ();
- msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
- RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
- Status.IN_PROGRESS.toString (),
- Constants.PROGRESS_REQUEST_IN_PROGRESS,
- Constants.MODIFIED_BY_APIHANDLER);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody);
- return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build ();
- } else {
- List<String> variables = new ArrayList<String>();
- variables.add(bpelStatus + "");
- String camundaJSONResponseBody = respHandler.getResponseBody ();
- if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
- MsoException.ServiceException,
- "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- variables);
- msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
- return resp;
- } else {
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
- MsoException.ServiceException,
- "Request Failed due to BPEL error with HTTP Status= %1" ,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- variables);
- msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
- return resp;
- }
- }
-
- //return Response.status (HttpStatus.SC_ACCEPTED).entity (serviceResponse).build ();
- // return serviceResponse;
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+ ServiceInstancesRequest sir = null;
+
+ MsoRequest msoRequest = new MsoRequest (requestId);
+
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Mapping of request to JSON object failed");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+
+ try{
+ msoRequest.parse(sir, instanceIdMap, action, version);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Error parsing request. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ InfraActiveRequests dup = null;
+ String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+ String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ try {
+ if(!(instanceName==null && "service".equals(requestScope) && (action == Action.createInstance || action == Action.activateInstance))){
+ dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ e.getMessage(),
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ if (dup != null) {
+ // Found the duplicate record. Return the appropriate error.
+ String instance;
+ if(instanceName != null){
+ instance = instanceName;
+ }else{
+ instance = instanceIdMap.get(requestScope + "InstanceId");
+ }
+ String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
+ //List<String> variables = new ArrayList<String>();
+ //variables.add(dup.getRequestStatus());
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
+ dupMessage,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+
+
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+
+ ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
+
+ RequestReferences referencesResponse = new RequestReferences();
+
+ referencesResponse.setRequestId(requestId);
+
+ serviceResponse.setRequestReferences(referencesResponse);
+
+ CatalogDatabase db = null;
+ try {
+ db = CatalogDatabase.getInstance();
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "No communication to catalog DB " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED,action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action);
+ } catch (ValidationException e) {
+ msoLogger.debug ("Validation failed: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Error validating request. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "Recipe could not be retrieved from catalog DB " + e.getMessage (),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED,action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ db.close();
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
+ null);
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ db.close();
+ return response;
+ }
+
+
+ Boolean isBaseVfModule = false;
+
+ if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule)) {
+ String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion ();
+
+ // Get VF Module-specific base module indicator
+ VfModule vfm;
+
+ String modelVersionId = msoRequest.getModelInfo().getModelVersionId();
+
+ if(modelVersionId != null) {
+ vfm = db.getVfModuleByModelUuid(modelVersionId);
+ } else {
+ vfm = db.getVfModuleByModelInvariantUuidAndModelVersion(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion());
+ }
+
+ if (vfm != null) {
+ if (vfm.getIsBase() == 1) {
+ isBaseVfModule = true;
+ }
+ }
+ else if (action == Action.createInstance || action == Action.updateInstance){
+ // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB.
+ // This request cannot proceed
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ String serviceVersionText = "";
+ if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
+ serviceVersionText = " with version " + asdcServiceModelVersion;
+ }
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "VnfType " + msoRequest.getVnfType () + " and VF Module Model Name " + msoRequest.getVfModuleModelName() + serviceVersionText + " not found in MSO Catalog DB",
+ ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No matching vfModuleType found in DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ db.close();
+ return response;
+ }
+ }
+
+ db.close();
+
+ String serviceInstanceId = "";
+ String vnfId = "";
+ String vfModuleId = "";
+ String volumeGroupId = "";
+ String networkId = "";
+ ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
+
+ if(siReq.getServiceInstanceId () != null){
+ serviceInstanceId = siReq.getServiceInstanceId ();
+ }
+
+ if(siReq.getVnfInstanceId () != null){
+ vnfId = siReq.getVnfInstanceId ();
+ }
+
+ if(siReq.getVfModuleInstanceId () != null){
+ vfModuleId = siReq.getVfModuleInstanceId ();
+ }
+
+ if(siReq.getVolumeGroupInstanceId () != null){
+ volumeGroupId = siReq.getVolumeGroupInstanceId ();
+ }
+
+ if(siReq.getNetworkInstanceId () != null){
+ networkId = siReq.getNetworkInstanceId ();
+ }
+
+
+ requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING, action);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ "Exception while creating record in DB " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+ try {
+ requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), MsoPropertiesUtils.loadMsoProperties ());
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+
+ msoLogger.debug ("URL : " + requestClient.getUrl ());
+
+ response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (),
+ serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
+ msoRequest.getServiceInstanceType (),
+ msoRequest.getVnfType (), msoRequest.getVfModuleType (),
+ msoRequest.getNetworkType (), msoRequest.getRequestJSON());
+
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
+ return resp;
+ }
+
+ if (response == null) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+
+ // BPEL accepted the request, the request is in progress
+ if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+ String camundaJSONResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
+ (RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (),
+ Status.IN_PROGRESS.toString (),
+ Constants.PROGRESS_REQUEST_IN_PROGRESS,
+ Constants.MODIFIED_BY_APIHANDLER);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody);
+ return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build ();
+ } else {
+ List<String> variables = new ArrayList<>();
+ variables.add(bpelStatus + "");
+ String camundaJSONResponseBody = respHandler.getResponseBody ();
+ if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ variables);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ variables);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+ }
+
+ //return Response.status (HttpStatus.SC_ACCEPTED).entity (serviceResponse).build ();
+ // return serviceResponse;
}
- private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
- RecipeLookupResult recipeLookupResult = null;
- //if the aLaCarte flag is set to TRUE, the API-H should choose the “VID_DEFAULT” recipe for the requested action
-
- msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag());
- // Query MSO Catalog DB
-
- if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) {
- recipeLookupResult = getServiceURI(db, msoRequest, action);
- }
- else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) ||
- msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup) || msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) {
-
- recipeLookupResult = getVnfOrVfModuleUri(db, msoRequest, action);
-
- }else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) {
-
- recipeLookupResult = getNetworkUri(db, msoRequest, action);
- }
-
- if (recipeLookupResult != null) {
- msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ()));
- }
- else {
- msoLogger.debug("No matching recipe record found");
- }
- return recipeLookupResult;
- }
-
-
- private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
- // SERVICE REQUEST
- // Construct the default service name
- // TODO need to make this a configurable property
- String sourceDefaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
- String defaultService = "*";
-
- Service serviceRecord = null;
- int serviceId;
- ServiceRecipe recipe = null;
-
- //if an aLaCarte flag was Not sent in the request, look first if there is a custom recipe for the specific model version
- if(!msoRequest.getALaCarteFlag()){
- serviceRecord = db.getServiceByVersionAndInvariantId(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion());
- if(serviceRecord !=null){
- serviceId = serviceRecord.getId();
- recipe = db.getServiceRecipe(serviceId, action.name());
- }
- }
-
- if (recipe == null) {
- //find source(initiator) default recipe
- recipe = db.getServiceRecipeByServiceNameAndAction(sourceDefaultServiceName, action.name());
- }
- if (recipe == null) {
- //find default recipe
- recipe = db.getServiceRecipeByServiceNameAndAction(defaultService, action.name());
- }
- if(recipe==null){
- return null;
- }
- return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
-
- }
-
-
- private RecipeLookupResult getVnfOrVfModuleUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
-
- String vnfComponentType = msoRequest.getModelInfo().getModelType().name();
-
- RelatedInstanceList[] instanceList = null;
- if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) {
- instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList();
- }
-
- String serviceModelName = null;
- String vnfModelName = null;
- String asdcServiceModelVersion = null;
- String modelVersion = msoRequest.getModelInfo().getModelVersion();
- Recipe recipe = null;
- String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
- String modelCustomizationId = msoRequest.getModelInfo().getModelCustomizationId();
- String vfModuleModelName = msoRequest.getModelInfo().getModelName();
- if (instanceList != null) {
-
- for(RelatedInstanceList relatedInstanceList : instanceList){
-
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo modelInfo = relatedInstance.getModelInfo();
- if(modelInfo.getModelType().equals(ModelType.service)){
- serviceModelName = modelInfo.getModelName();
- asdcServiceModelVersion = modelInfo.getModelVersion();
- }
-
- if(modelInfo.getModelType().equals(ModelType.vnf)){
- vnfModelName = modelInfo.getModelCustomizationName();
- if (null == vnfModelName || vnfModelName.trim().isEmpty()) {
- VnfResource vnfResource = db.getVnfResourceByModelCustomizationId(modelInfo.getModelCustomizationUuid(), modelInfo.getModelVersion());
- vnfModelName = vnfResource.getModelName();
- }
- }
- }
-
- if(msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) {
- String modelCustomizationName = msoRequest.getModelInfo().getModelCustomizationName();
-
- VnfResource vnfResource = null;
-
- // Validation for vnfResource
- if(modelCustomizationName!=null) {
- vnfResource = db.getVnfResource(serviceModelName + "/" + modelCustomizationName, asdcServiceModelVersion);
- }else{
- vnfResource = db.getVnfResourceByModelCustomizationId(modelCustomizationId, asdcServiceModelVersion);
- }
-
- if(vnfResource==null){
- throw new ValidationException("catalog entry");
- }
-
- VnfRecipe vnfRecipe = db.getVnfRecipe(defaultVnfType, action.name());
-
- if (vnfRecipe == null) {
- return null;
- }
-
- return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
- }else{
- String vnfType = serviceModelName + "/" + vnfModelName;
- String vfModuleType = vnfType + "::" + vfModuleModelName;
- List<VfModule> vfModule = db.getVfModule(vfModuleType, modelCustomizationId, asdcServiceModelVersion, modelVersion, action.name());
- if(vfModule==null || vfModule.isEmpty()){
- throw new ValidationException("catalog entry");
- }else{
- if(!msoRequest.getALaCarteFlag() && action != Action.deleteInstance){
- recipe = db.getVnfComponentsRecipeByVfModule(vfModule, action.name());
- }
- }
- if (recipe == null) {
- msoLogger.debug("recipe is null, getting default");
- recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name());
-
- if (recipe == null) {
- return null;
- }
- }
-
- }
- } else {
- msoLogger.debug("recipe is null, getting default");
-
- if(msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) {
- recipe = db.getVnfRecipe(defaultVnfType, action.name());
- if (recipe == null) {
- return null;
- }
- } else {
- recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name());
-
- if (recipe == null) {
- return null;
- }
- }
- }
-
- return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
- }
-
- private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
-
- String sourceDefaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
- String defaultNetworkType = "*";
-
- String modelName = msoRequest.getModelInfo().getModelName();
- Recipe recipe = null;
- //if an aLaCarte flag was Not sent in the request, look first if there is a custom recipe for the specific ModelCustomizationId
- if(!msoRequest.getALaCarteFlag()){
- String networkType = null;
-
- if(msoRequest.getModelInfo().getModelCustomizationId()!=null){
- NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(msoRequest.getModelInfo().getModelCustomizationId());
- if(networkResource!=null){
- networkType = networkResource.getNetworkType();
- }else{
- throw new ValidationException("no catalog entry found");
- }
- }else{
- //ok for version < 3
- networkType = modelName;
- }
-
- //find latest version Recipe for the given networkType and action
- recipe = db.getNetworkRecipe(networkType, action.name());
- }
-
- if(recipe == null){
- //find source(initiator) default recipe
- recipe = db.getNetworkRecipe(sourceDefaultNetworkType, action.name());
- }
- if(recipe == null){
- //find default recipe
- recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
- }
- if (recipe == null) {
- return null;
- }
- return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
- }
+ private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+ RecipeLookupResult recipeLookupResult = null;
+ //if the aLaCarte flag is set to TRUE, the API-H should choose the “VID_DEFAULT” recipe for the requested action
+
+ msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag());
+ // Query MSO Catalog DB
+
+ if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) {
+ recipeLookupResult = getServiceURI(db, msoRequest, action);
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) ||
+ msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup) || msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) {
+
+ recipeLookupResult = getVnfOrVfModuleUri(db, msoRequest, action);
+
+ }else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) {
+
+ recipeLookupResult = getNetworkUri(db, msoRequest, action);
+ }
+
+ if (recipeLookupResult != null) {
+ msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ()));
+ }
+ else {
+ msoLogger.debug("No matching recipe record found");
+ }
+ return recipeLookupResult;
+ }
+
+
+ private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+ // SERVICE REQUEST
+ // Construct the default service name
+ // TODO need to make this a configurable property
+ String defaultServiceModelName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ Service serviceRecord;
+ ModelInfo modelInfo = msoRequest.getModelInfo();
+ if(msoRequest.getALaCarteFlag()){
+ serviceRecord = db.getServiceByModelName(defaultServiceModelName);
+ }else{
+ serviceRecord = db.getServiceByModelUUID(modelInfo.getModelVersionId()); // ModelVersionId is not required in v3
+ if(serviceRecord == null) {
+ serviceRecord = db.getServiceByVersionAndInvariantId(modelInfo.getModelInvariantId(), modelInfo.getModelVersion());
+ }
+ }
+
+ ServiceRecipe recipe = null;
+ if(serviceRecord !=null){
+ recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
+ }
+ //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
+ RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters();
+ if(reqParam!=null && reqParam.isALaCarteSet() && recipe==null){
+ return null;
+ }else if (recipe == null) { //aLaCarte wasn't sent, so we'll try the default
+ serviceRecord = db.getServiceByModelName(defaultServiceModelName);
+ recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
+ }
+
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(serviceRecord.getModelUUID());
+ }
+ if(recipe==null){
+ return null;
+ }
+ return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+
+
+ private RecipeLookupResult getVnfOrVfModuleUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+
+ ModelInfo modelInfo = msoRequest.getModelInfo();
+ String vnfComponentType = modelInfo.getModelType().name();
+
+ RelatedInstanceList[] instanceList = null;
+ if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) {
+ instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList();
+ }
+
+ Recipe recipe = null;
+ String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+ String modelCustomizationId = modelInfo.getModelCustomizationId();
+ String modelCustomizationName = modelInfo.getModelCustomizationName();
+ String relatedInstanceModelVersionId = null;
+ String relatedInstanceModelInvariantId = null;
+ String relatedInstanceVersion = null;
+ String relatedInstanceModelCustomizationName = null;
+
+ if (instanceList != null) {
+
+ for(RelatedInstanceList relatedInstanceList : instanceList){
+
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+ if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)){
+ relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
+ relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
+ }
+
+ if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)){
+ relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
+ relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId();
+ relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
+ relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName();
+ }
+ }
+
+ if(modelInfo.getModelType().equals(ModelType.vnf)) {
+ // a. For a vnf request (only create, no update currently):
+ // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in vnf_resource_customization.model_customization_uuid.
+ // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or pre-v3), then modelInfo.modelCustomizationName must have
+ // been provided (else create request should be rejected). APIH should use the relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName
+ // to “join” service_to_resource_customizations with vnf_resource_customization to confirm a vnf_resource_customization.model_customization_uuid record exists.
+ // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId
+ // (MODEL_UUID) in SERVICE table.
+ // iii. Regardless of how the value was provided/obtained above, APIH must always populate vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated
+ // during 1707 data migration if VID did not provide it originally on request.
+ // iv. Note: continue to construct the “vnf-type” value and pass to BPMN (must still be populated in A&AI).
+ // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to look it up in our catalog to construct vnf-type value to pass to BPMN.
+
+ VnfResource vnfResource = null;
+ VnfResourceCustomization vrc;
+ // Validation for vnfResource
+
+ if(modelCustomizationId!=null) {
+ vnfResource = db.getVnfResourceByModelCustomizationId(modelCustomizationId);
+ } else {
+ Service service = db.getServiceByModelUUID(relatedInstanceModelVersionId);
+ if(service == null) {
+ service = db.getServiceByVersionAndInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+
+ if(service == null) {
+ throw new ValidationException("service in relatedInstance");
+ }
+
+ vrc = db.getVnfResourceCustomizationByModelCustomizationName(modelCustomizationName, service.getModelUUID());
+ if(vrc != null) {
+ vnfResource = vrc.getVnfResource();
+ modelInfo.setModelCustomizationId(vrc.getModelCustomizationUuid());
+ modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUuid());
+ }
+ }
+
+ if(vnfResource==null){
+ throw new ValidationException("catalog entry");
+ } else {
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vnfResource.getModelUuid());
+ }
+ }
+
+ VnfRecipe vnfRecipe = db.getVnfRecipe(defaultVnfType, action.name());
+
+ if (vnfRecipe == null) {
+ return null;
+ }
+
+ return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ } else {
+ // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or pre-v3), then modelInfo.modelCustomizationName must have
+ // been provided (else create request should be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId** + modelInfo[vnf].modelCustomizationName
+ // to “join” vnf_to_resource_customizations with vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record exists.
+ // **If relatedInstance.modelInfo[vnf].modelVersionId was not provided, use relatedInstance.modelInfo[vnf].modelInvariantId + modelVersion instead
+ // to lookup modelVersionId (MODEL_UUID) in vnf_resource table. Once the vnf’s model_customization_uuid has been obtained, use it to find all vfModule customizations
+ // for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. For each vf_module_cust_model_customization_uuid value returned,
+ // use that UUID to query vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId** to confirm record matches request data
+ // (and to identify the modelCustomizationId associated with the vfModule in the request). **If modelInfo[vfModule|volumeGroup].modelVersionId was not
+ // provided (potentially in v2/v3), use modelInfo[vfModule|volumeGroup].modelInvariantId + modelVersion instead. This means taking each record found
+ // in vf_module_customization and looking up in vf_module (using vf_module_customization’s FK into vf_module) to find a match on MODEL_INVARIANT_UUID (modelInvariantId)
+ // and MODEL_VERSION (modelVersion).
+
+ if(!msoRequest.getALaCarteFlag()) {
+ VfModuleCustomization vfmc = null;
+ VnfResourceCustomization vnfrc;
+ VfModule vfModule = null;
+
+ if( modelInfo.getModelCustomizationId() != null) {
+ vfmc = db.getVfModuleCustomizationByModelCustomizationId(modelInfo.getModelCustomizationId());
+ } else {
+ vnfrc =db.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(relatedInstanceModelCustomizationName, relatedInstanceModelVersionId);
+ if(vnfrc == null) {
+ vnfrc = db.getVnfResourceCustomizationByModelInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion, relatedInstanceModelCustomizationName);
+ }
+
+ List<VfModuleCustomization> list = db.getVfModuleCustomizationByVnfModuleCustomizationUuid(vnfrc.getModelCustomizationUuid());
+
+ String vfModuleModelUUID = modelInfo.getModelVersionId();
+ for(VfModuleCustomization vf : list) {
+ if(vfModuleModelUUID != null) {
+ vfModule = db.getVfModuleByModelCustomizationIdAndVersion(vf.getModelCustomizationUuid(), vfModuleModelUUID);
+ } else {
+ vfModule = db.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(vf.getModelCustomizationUuid(), modelInfo.getModelVersion(), modelInfo.getModelInvariantId());
+ }
+
+ if(vfModule != null) {
+ modelInfo.setModelCustomizationId(vf.getModelCustomizationUuid());
+ modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUuid());
+ break;
+ }
+ }
+ }
+
+ if(vfmc == null && vfModule == null) {
+ throw new ValidationException("no catalog entry found");
+ } else if (vfModule == null && vfmc != null) {
+ vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in VfModuleCustomization table
+ }
+
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vfModule.getModelUUID());
+ }
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(vfModule.getModelUUID(), vnfComponentType, action.name());
+ }
+
+ if(recipe == null) {
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultVnfType, vnfComponentType, action.name());
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("*", vnfComponentType, action.name());
+ }
+
+ if(recipe == null) {
+ return null;
+ }
+ }
+ }
+ } else {
+ msoLogger.debug("recipe is null, getting default");
+
+ if(modelInfo.getModelType().equals(ModelType.vnf)) {
+ recipe = db.getVnfRecipe(defaultVnfType, action.name());
+ if (recipe == null) {
+ return null;
+ }
+ } else {
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("VID_DEFAULT", vnfComponentType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ }
+
+ return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+
+ private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+
+ String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ ModelInfo modelInfo = msoRequest.getModelInfo();
+ String modelName = modelInfo.getModelName();
+ Recipe recipe;
+ if(msoRequest.getALaCarteFlag()){
+ recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
+ }else{
+ if(modelInfo.getModelCustomizationId()!=null){
+ NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(modelInfo.getModelCustomizationId());
+ if(networkResource!=null){
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(networkResource.getModelUUID());
+ }
+ recipe = db.getNetworkRecipe(networkResource.getModelName(), action.name());
+ }else{
+ throw new ValidationException("no catalog entry found");
+ }
+ }else{
+ //ok for version < 3 and action delete
+ recipe = db.getNetworkRecipe(modelName, action.name());
+ }
+ if(recipe == null){
+ recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
+ }
+ }
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
index fdd19bda26..6ddb03a554 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
new file mode 100644
index 0000000000..1e8bea0c55
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
@@ -0,0 +1,328 @@
+/*-
+ * #%L
+ * MSO
+ * %%
+ * Copyright (C) 2016 OPENECOMP - MSO
+ * %%
+ * 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.
+ * #L%
+ */
+
+package org.openecomp.mso.apihandlerinfra;
+
+import org.openecomp.mso.apihandlerinfra.tasksbeans.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.ResponseHandler;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/tasks")
+@Api(value="/tasks/{version: [vV]1}",description="Queries of Manual Tasks")
+public class TasksHandler {
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ public final static String requestUrl = "mso/task/";
+
+ @Path("/{version:[vV]1}")
+ @GET
+ @ApiOperation(value="Finds Manual Tasks",response=Response.class)
+ public Response queryFilters (@QueryParam("taskId") String taskId,
+ @QueryParam("originalRequestId") String originalRequestId,
+ @QueryParam("subscriptionServiceType") String subscriptionServiceType,
+ @QueryParam("nfRole") String nfRole,
+ @QueryParam("buildingBlockName") String buildingBlockName,
+ @QueryParam("originalRequestDate") String originalRequestDate,
+ @QueryParam("originalRequestorId") String originalRequestorId,
+ @PathParam("version") String version) {
+ Response responseBack = null;
+ long startTime = System.currentTimeMillis ();
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ MsoLogger.setServiceName ("ManualTasksQuery");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for queryFilter with taskId:" + taskId
+ + " originalRequestId:" + originalRequestId
+ + " subscriptionServiceType:" + subscriptionServiceType
+ + " nfRole:" + nfRole
+ + " buildingBlockName:" + buildingBlockName
+ + " originalRequestDate:" + originalRequestDate
+ + " originalRequestorId: " + originalRequestorId);
+
+ // Prepare the query string to /task interface
+ TaskVariables tv = new TaskVariables();
+
+ List<TaskVariableValue> tvvList = new ArrayList<TaskVariableValue>();
+
+ if (originalRequestId != null) {
+ TaskVariableValue tvv = new TaskVariableValue();
+ tvv.setName("originalRequestId");
+ tvv.setValue(originalRequestId);
+ tvv.setOperator("eq");
+ tvvList.add(tvv);
+ }
+ if (subscriptionServiceType != null) {
+ TaskVariableValue tvv = new TaskVariableValue();
+ tvv.setName("subscriptionServiceType");
+ tvv.setValue(subscriptionServiceType);
+ tvv.setOperator("eq");
+ tvvList.add(tvv);
+ }
+ if (nfRole != null) {
+ TaskVariableValue tvv = new TaskVariableValue();
+ tvv.setName("nfRole");
+ tvv.setValue(nfRole);
+ tvv.setOperator("eq");
+ tvvList.add(tvv);
+ }
+ if (buildingBlockName != null) {
+ TaskVariableValue tvv = new TaskVariableValue();
+ tvv.setName("buildingBlockName");
+ tvv.setValue(buildingBlockName);
+ tvv.setOperator("eq");
+ tvvList.add(tvv);
+ }
+ if (originalRequestDate != null) {
+ TaskVariableValue tvv = new TaskVariableValue();
+ tvv.setName("originalRequestDate");
+ tvv.setValue(originalRequestDate);
+ tvv.setOperator("eq");
+ tvvList.add(tvv);
+ }
+ if (originalRequestorId != null) {
+ TaskVariableValue tvv = new TaskVariableValue();
+ tvv.setName("originalRequestorId");
+ tvv.setValue(originalRequestorId);
+ tvv.setOperator("eq");
+ tvvList.add(tvv);
+ }
+
+ tv.setTaskVariables(tvvList);
+
+ RequestClient requestClient = null;
+ MsoRequest msoRequest = new MsoRequest(requestId);
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient (requestUrl, MsoPropertiesUtils.loadMsoProperties ());
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Post call to Camunda engine for url: " + requestClient.getUrl ());
+
+ System.out.println("URL : " + requestClient.getUrl ());
+ ObjectMapper mapper = new ObjectMapper();
+ String camundaJsonReq = mapper.writeValueAsString(tv);
+ msoLogger.debug("Camunda Json Request: " + camundaJsonReq);
+ response = requestClient.post(camundaJsonReq);
+
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
+ return resp;
+ }
+ TasksGetResponse trr = new TasksGetResponse();
+ List<TaskList> taskList = new ArrayList<TaskList>();
+
+ ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+ if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
+ msoLogger.debug ("Received good response from Camunda");
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
+ String respBody = respHandler.getResponseBody();
+ if (respBody != null) {
+ JSONArray data = new JSONArray(respBody);
+
+ for (int i=0; i<data.length();i++) {
+ JSONObject taskEntry = data.getJSONObject(i);
+ String id = taskEntry.getString("id");
+ msoLogger.debug("taskId is: " + id);
+ if (taskId != null && !taskId.equals(id)) {
+ continue;
+ }
+ // Get variables info for each task ID
+ TaskList taskListEntry = null;
+ try {
+ taskListEntry = getTaskInfo(id);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
+ return resp;
+ }
+ taskList.add(taskListEntry);
+
+ }
+ trr.setTaskList(taskList);
+ }
+
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+
+ String jsonResponse = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ jsonResponse = mapper.writeValueAsString(trr);
+ }
+ catch (Exception e) {
+ msoLogger.debug("Unable to format response",e);
+ Response resp = msoRequest.buildServiceErrorResponse(500,
+ MsoException.ServiceException,
+ "Request Failed due to bad response format" ,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Bad response format");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Bad response format");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ responseBack = Response.status (HttpStatus.SC_ACCEPTED).entity (jsonResponse).build ();
+ // msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return responseBack;
+
+ }
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+ // Makes a GET call to Camunda to get variables for this task
+ private TaskList getTaskInfo(String taskId) throws Exception {
+ TaskList taskList = null;
+ String getRequestUrl = requestUrl + taskId + "/variables";
+ HttpResponse getResponse = null;
+ long subStartTime = System.currentTimeMillis();
+
+ RequestClient requestClient = RequestClientFactory.getRequestClient (getRequestUrl, MsoPropertiesUtils.loadMsoProperties ());
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Get call to Camunda engine for url: " + requestClient.getUrl ());
+ getResponse = requestClient.get();
+
+ ResponseHandler respHandler = new ResponseHandler (getResponse, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+ if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+ msoLogger.debug ("Received good response from Camunda");
+
+ msoLogger.recordAuditEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
+ String respBody = respHandler.getResponseBody();
+ if (respBody != null) {
+ taskList = buildTaskList(taskId, respBody);
+ }
+ else {
+ throw new Exception("Null task info from Camunda");
+ }
+
+ }
+ else {
+ throw new Exception ("Bad GET response from Camunda. Status is " + bpelStatus);
+ }
+
+ return taskList;
+
+ }
+
+ private TaskList buildTaskList(String taskId, String respBody) {
+ TaskList taskList = new TaskList();
+ JSONObject variables = new JSONObject(respBody);
+
+ taskList.setTaskId(taskId);
+ taskList.setType(getOptVariableValue(variables, "type"));
+ taskList.setNfRole(getOptVariableValue(variables, "nfRole"));
+ taskList.setSubscriptionServiceType(getOptVariableValue(variables, "subscriptionServiceType"));
+ taskList.setOriginalRequestId(getOptVariableValue(variables, "originalRequestId"));
+ taskList.setOriginalRequestorId(getOptVariableValue(variables, "originalRequestorId"));
+ taskList.setErrorSource(getOptVariableValue(variables, "errorSource"));
+ taskList.setErrorCode(getOptVariableValue(variables, "errorCode"));
+ taskList.setErrorMessage(getOptVariableValue(variables, "errorMessage"));
+ taskList.setBuildingBlockName(getOptVariableValue(variables, "buildingBlockName"));
+ taskList.setBuildingBlockStep(getOptVariableValue(variables, "buildingBlockStep"));
+ taskList.setValidResponses(new JSONArray("[" + getOptVariableValue(variables, "validResponses").toLowerCase() + "]"));
+
+ return taskList;
+ }
+
+ private String getOptVariableValue(JSONObject variables, String name) {
+ String variableEntry = variables.optString(name);
+ String value = "";
+ if (!variableEntry.isEmpty()) {
+ JSONObject variableEntryJson = new JSONObject(variableEntry);
+ value = variableEntryJson.optString("value");
+ }
+ return value;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
index 07d70e9982..a1fa8206a8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -26,21 +26,24 @@ import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.apache.http.HttpStatus;
-
import org.openecomp.mso.apihandlerinfra.vnfbeans.VfModuleModelName;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VfModuleModelNames;
import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.VfModule;
import org.openecomp.mso.logger.MsoLogger;
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
@Path(Constants.VF_MODULE_MODEL_NAMES_PATH)
+@Api(value="/{version: v2|v3}/vf-module-model-names",description="API Requests to find Vf Module model names")
public class VfModuleModelNamesHandler {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@@ -48,13 +51,14 @@ public class VfModuleModelNamesHandler {
private static final String LOG_REPLY_NAME = "MSO-APIH:InfrastructurePortal.";
@GET
- public Response getVfModuleModelNames () {
+ @ApiOperation(value="Finds Vf Module Model Names",response=Response.class)
+ public Response getVfModuleModelNames (@PathParam("version") String version) {
long startTime = System.currentTimeMillis ();
String methodName = "getVfModuleModelNames";
MsoLogger.setServiceName (LOG_SERVICE_NAME + methodName);
msoLogger.debug ("Incoming request received for vfModuleModelNames");
List <VfModule> vfModules = null;
- try (CatalogDatabase db = new CatalogDatabase()){
+ try (CatalogDatabase db = CatalogDatabase.getInstance()){
vfModules = db.getAllVfModules ();
} catch (Exception e) {
msoLogger.debug ("No connection to catalog DB", e);
@@ -79,7 +83,7 @@ public class VfModuleModelNamesHandler {
vfModuleModelName.setModelInvariantUuid (vm.getModelInvariantUuid ());
vfModuleModelName.setIsBase(vm.isBase());
vfModuleModelName.setDescription (vm.getDescription ());
- vfModuleModelName.setId (String.valueOf (vm.getId ()));
+ vfModuleModelName.setId (String.valueOf (vm.getModelUUID()));
vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion ());
vfModuleModelNames.getVfModuleModelName ().add (vfModuleModelName);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
index 7494747879..c87d450cef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
@@ -31,18 +31,13 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
-
-import org.apache.http.HttpStatus;
-
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.sax.SAXSource;
-import org.xml.sax.InputSource;
-
+import org.apache.http.HttpStatus;
import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType;
import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
@@ -53,12 +48,17 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfOutputs;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequests;
import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
+import org.xml.sax.InputSource;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
@Path("/{version: v1|v2|v3}/vnf-request")
+@Api(value="/{version: v1|v2|v3}/vnf-request",description="API Requests of vnfRequest")
public class VnfInfoHandler {
protected ObjectFactory beansObjectFactory = new ObjectFactory ();
@@ -67,6 +67,7 @@ public class VnfInfoHandler {
@GET
+ @ApiOperation(value="Finds Volume Requests",response=Response.class)
public Response queryFilters (@QueryParam("vnf-type") String vnfType,
@QueryParam("service-type") String serviceType,
@QueryParam("aic-node-clli") String aicNodeClli,
@@ -99,6 +100,7 @@ public class VnfInfoHandler {
@GET
@Path(Constants.REQUEST_ID_PATH)
+ @ApiOperation(value="Add a Vnf Outputs from requestId and version",response=Response.class)
public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
// Check INFRA_ACTIVE_REQUESTS table to find info
// on this request
@@ -253,7 +255,7 @@ public class VnfInfoHandler {
String responseString = null;
- InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, getRequestType ());
+ InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, getRequestType ());
if (activeReq != null) {
// build response for active
responseString = infraRequestsResponse (activeReq, version);
@@ -270,7 +272,7 @@ public class VnfInfoHandler {
getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
- List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ List <InfraActiveRequests> activeReqList = (RequestsDatabase.getInstance()).getRequestListFromInfraActive (queryAttribute,
queryValue,
getRequestType ());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
index bfcbe0d4d5..80d0c48a5e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -59,10 +59,10 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.db.HibernateUtils;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
public class VnfMsoInfraRequest {
@@ -84,7 +84,7 @@ public class VnfMsoInfraRequest {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static final String NOT_PROVIDED = "not provided";
- protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb ();
+ protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
VnfMsoInfraRequest (String requestId) {
this.requestId = requestId;
@@ -279,7 +279,7 @@ public class VnfMsoInfraRequest {
Session session = null;
try {
- session = hibernateUtils.getSessionFactory ().openSession ();
+ session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
session.beginTransaction ();
InfraActiveRequests aq = new InfraActiveRequests ();
@@ -399,7 +399,7 @@ public class VnfMsoInfraRequest {
public void updateFinalStatus (Status status) {
int result = 0;
try {
- result = RequestsDatabase.updateInfraFinalStatus (requestId,
+ result = (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId,
status.toString (),
this.errorMessage,
this.progress,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
index 617172be08..a61ca5fb30 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -97,7 +97,8 @@ public class VnfRequestHandler {
private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
.entity (NOT_FOUND)
.build ();
-
+ private RequestsDatabase requestDB = RequestsDatabase.getInstance();
+
@GET
public Response queryFilters (@QueryParam("vnf-type") String vnfType,
@QueryParam("service-type") String serviceType,
@@ -285,7 +286,7 @@ public class VnfRequestHandler {
String responseString = null;
- InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, getRequestType ());
+ InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId, getRequestType ());
if (activeReq != null) {
// build response for active
responseString = infraRequestsResponse (activeReq, version);
@@ -302,7 +303,7 @@ public class VnfRequestHandler {
getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
- List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ List <InfraActiveRequests> activeReqList = requestDB.getRequestListFromInfraActive (queryAttribute,
queryValue,
getRequestType ());
@@ -471,7 +472,7 @@ public class VnfRequestHandler {
msoLogger.debug ("Checking for a duplicate with the same vnf-name");
InfraActiveRequests dup = null;
try {
- dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (),
+ dup = requestDB.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (),
msoRequest.getRequestInfo ().getAction ().value (),
"VNF");
@@ -508,7 +509,7 @@ public class VnfRequestHandler {
InfraActiveRequests dup = null;
msoLogger.debug ("Checking for a duplicate with the same vnf-id");
try {
- dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (),
+ dup = requestDB.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (),
msoRequest.getRequestInfo ().getAction ().value (),
"VNF");
@@ -548,7 +549,7 @@ public class VnfRequestHandler {
String orchestrationURI = "";
// Query MSO Catalog DB
- try (CatalogDatabase db = new CatalogDatabase()){
+ try (CatalogDatabase db = CatalogDatabase.getInstance()){
Recipe recipe = null;
@@ -755,7 +756,7 @@ public class VnfRequestHandler {
String bpelXMLResponseBody = respHandler.getResponseBody ();
msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
- RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ requestDB.updateInfraStatus (msoRequest.getRequestId (),
Status.IN_PROGRESS.toString (),
Constants.PROGRESS_REQUEST_IN_PROGRESS,
Constants.MODIFIED_BY_APIHANDLER);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java
index e8023b8bf9..7f1f6b531c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
index 0b595855df..44cf038ef8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -27,27 +27,35 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfTypes;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.VnfResource;
import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
import org.apache.http.HttpStatus;
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
import javax.ws.rs.GET;
import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
+
import java.io.StringWriter;
import java.util.List;
@Path(Constants.VNF_TYPES_PATH)
+@Api(value="/{version: v1|v2|v3}/vnf-types",description="API Requests of vnfTypes")
public class VnfTypesHandler {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@GET
- public Response getVnfTypes (@QueryParam("vnf-role") String vnfRole) {
+ @ApiOperation(value="Finds Vnf Types",response=Response.class)
+ public Response getVnfTypes (@QueryParam("vnf-role") String vnfRole, @PathParam("version") String version) {
long startTime = System.currentTimeMillis ();
MsoLogger.setServiceName ("GetVnfTypes");
@@ -56,7 +64,7 @@ public class VnfTypesHandler {
msoLogger.debug ("Incoming request received for getVnfTypes with vnf-role:" + vnfRole);
List <VnfResource> vnfResources = null;
- try(CatalogDatabase db = new CatalogDatabase ()) {
+ try(CatalogDatabase db = CatalogDatabase.getInstance()) {
if (vnfRole != null) {
vnfResources = db.getVnfResourcesByRole (vnfRole);
} else {
@@ -80,9 +88,8 @@ public class VnfTypesHandler {
for (int i = 0; i < vnfResources.size (); i++) {
VnfType vnfType = beansObjectFactory.createVnfType ();
VnfResource vr = vnfResources.get (i);
- vnfType.setType (vr.getVnfType ());
vnfType.setDescription (vr.getDescription ());
- vnfType.setId (String.valueOf (vr.getId ()));
+ vnfType.setId (String.valueOf (vr.getModelUuid()));
vnfTypes.getVnfType ().add (vnfType);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
index 3190fc507e..1891c00521 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
@@ -31,18 +31,13 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
-
-import org.apache.http.HttpStatus;
-
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.sax.SAXSource;
-import org.xml.sax.InputSource;
-
+import org.apache.http.HttpStatus;
import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType;
import org.openecomp.mso.apihandlerinfra.volumebeans.ObjectFactory;
@@ -53,12 +48,17 @@ import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeOutputs;
import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest;
import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequests;
import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
+import org.xml.sax.InputSource;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
@Path("/{version: v1|v2|v3}/volume-request")
+@Api(value="/{version: v1|v2|v3}/volume-request",description="API Requests for volumeRequest")
public class VolumeInfoHandler {
protected ObjectFactory beansObjectFactory = new ObjectFactory ();
@@ -66,6 +66,7 @@ public class VolumeInfoHandler {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
@GET
+ @ApiOperation(value="Finds Volume Requests",response=Response.class)
public Response queryFilters (@QueryParam("vnf-type") String vnfType,
@QueryParam("service-type") String serviceType,
@QueryParam("aic-node-clli") String aicNodeClli,
@@ -96,6 +97,7 @@ public class VolumeInfoHandler {
@GET
@Path(Constants.REQUEST_ID_PATH)
+ @ApiOperation(value="Find Volume Outputs by requestId and verison",response=Response.class)
public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
// Check INFRA_ACTIVE_REQUESTS table to find info
@@ -233,7 +235,7 @@ public class VolumeInfoHandler {
String responseString = null;
- InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId,
+ InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId,
"VOLUME");
if (activeReq != null) {
// build response for active
@@ -251,7 +253,7 @@ public class VolumeInfoHandler {
getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
- List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ List <InfraActiveRequests> activeReqList = (RequestsDatabase.getInstance()).getRequestListFromInfraActive (queryAttribute,
queryValue,
"VOLUME");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
index 911ac48d03..0524a85bf3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -54,11 +54,11 @@ import org.openecomp.mso.apihandlerinfra.volumebeans.ObjectFactory;
import org.openecomp.mso.apihandlerinfra.volumebeans.RequestInfo;
import org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType;
import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest;
-import org.openecomp.mso.db.HibernateUtils;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
@@ -78,7 +78,7 @@ public class VolumeMsoInfraRequest {
private long startTime;
private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
- protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb ();
+ protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static final String NOT_PROVIDED = "not provided";
@@ -282,7 +282,7 @@ public class VolumeMsoInfraRequest {
Session session = null;
try {
- session = hibernateUtils.getSessionFactory ().openSession ();
+ session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
session.beginTransaction ();
InfraActiveRequests aq = new InfraActiveRequests ();
@@ -376,7 +376,7 @@ public class VolumeMsoInfraRequest {
public void updateFinalStatus (Status status) {
int result = 0;
try {
- result = RequestsDatabase.updateInfraFinalStatus(requestId, status.toString (),
+ result = (RequestsDatabase.getInstance()).updateInfraFinalStatus(requestId, status.toString (),
this.errorMessage, this.progress, this.responseBody, Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception in updateFinalStatus");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
index 7c1b74c684..9a8bf35e5c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -97,6 +97,8 @@ public class VolumeRequestHandler {
.entity (NOT_FOUND)
.build ();
+ private RequestsDatabase requestDB = RequestsDatabase.getInstance();
+
@GET
public Response queryFilters (@QueryParam("vnf-type") String vnfType,
@QueryParam("service-type") String serviceType,
@@ -265,7 +267,7 @@ public class VolumeRequestHandler {
String responseString = null;
- InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId,
+ InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId,
"VOLUME");
if (activeReq != null) {
// build response for active
@@ -283,7 +285,7 @@ public class VolumeRequestHandler {
getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
- List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ List <InfraActiveRequests> activeReqList = requestDB.getRequestListFromInfraActive (queryAttribute,
queryValue,
"VOLUME");
@@ -468,7 +470,7 @@ public class VolumeRequestHandler {
InfraActiveRequests dup = null;
try {
- dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (),
+ dup = requestDB.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (),
msoRequest.getRequestInfo ().getAction ().value (),
"VOLUME");
@@ -506,7 +508,7 @@ public class VolumeRequestHandler {
InfraActiveRequests dup = null;
msoLogger.debug ("Checking for a duplicate with the same volume-group-id");
try {
- dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (),
+ dup = requestDB.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (),
msoRequest.getRequestInfo ().getAction ().value (),
"VOLUME");
@@ -545,7 +547,7 @@ public class VolumeRequestHandler {
String orchestrationURI = "";
// Query MSO Catalog DB
- try(CatalogDatabase db = new CatalogDatabase ()) {
+ try(CatalogDatabase db = CatalogDatabase.getInstance()) {
Recipe recipe = null;
if (version.equals(Constants.SCHEMA_VERSION_V1)) {
@@ -597,7 +599,7 @@ public class VolumeRequestHandler {
// If no recipe for the vnf type is found, look for generic recipe with "*" in vf module id
if (recipe == null) {
- recipe = db.getVnfComponentsRecipeByVfModuleId (Constants.VNF_TYPE_WILDCARD,
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId (Constants.VNF_TYPE_WILDCARD,
Constants.VOLUME_GROUP_COMPONENT_TYPE,
msoRequest.getRequestInfo ().getAction ().value ());
}
@@ -695,7 +697,7 @@ public class VolumeRequestHandler {
String bpelXMLResponseBody = respHandler.getResponseBody ();
msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.IN_PROGRESS);
- RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ requestDB.updateInfraStatus (msoRequest.getRequestId (),
Status.IN_PROGRESS.toString (),
Constants.PROGRESS_REQUEST_IN_PROGRESS,
Constants.MODIFIED_BY_APIHANDLER);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java
new file mode 100644
index 0000000000..0e2067e448
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java
@@ -0,0 +1,110 @@
+/*-
+ * ============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.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties({ "additionalProperties" })
+public class E2EParameters {
+
+ @JsonProperty("domainHost")
+ private String domainHost;
+
+ @JsonProperty("nodeTemplateName")
+ private String nodeTemplateName;
+
+ @JsonProperty("nodeType")
+ private String nodeType;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriberName")
+ private String subscriberName;
+
+ @JsonProperty("requestParameters")
+ private E2ERequestParameters requestParameters;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getDomainHost() {
+ return domainHost;
+ }
+
+ public void setDomainHost(String domainHost) {
+ this.domainHost = domainHost;
+ }
+
+ public String getNodeTemplateName() {
+ return nodeTemplateName;
+ }
+
+ public void setNodeTemplateName(String nodeTemplateName) {
+ this.nodeTemplateName = nodeTemplateName;
+ }
+
+ public String getNodeType() {
+ return nodeType;
+ }
+
+ public void setNodeType(String nodeType) {
+ this.nodeType = nodeType;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+ public E2ERequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ public void setRequestParameters(E2ERequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestParameters.java
new file mode 100644
index 0000000000..ae8fe808f2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestParameters.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class E2ERequestParameters {
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("userParams")
+ private List<E2EUserParam> userParams = null;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public List<E2EUserParam> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<E2EUserParam> userParams) {
+ this.userParams = userParams;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
new file mode 100644
index 0000000000..2d9ceb0a42
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
@@ -0,0 +1,99 @@
+/*-
+ * ============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.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties({ "additionalProperties" })
+public class E2EService {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("description")
+ private String description;
+
+ @JsonProperty("serviceDefId")
+ private String serviceDefId;
+
+ @JsonProperty("templateId")
+ private String templateId;
+
+ @JsonProperty("parameters")
+ private E2EParameters parameters;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getServiceDefId() {
+ return serviceDefId;
+ }
+
+ public void setServiceDefId(String serviceDefId) {
+ this.serviceDefId = serviceDefId;
+ }
+
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId;
+ }
+
+ public E2EParameters getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(E2EParameters parameters) {
+ this.parameters = parameters;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java
new file mode 100644
index 0000000000..d019a2d5db
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties({ "additionalProperties" })
+public class E2EServiceInstanceRequest {
+
+ @JsonProperty("service")
+ private E2EService service;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public E2EService getService() {
+ return service;
+ }
+
+ public void setService(E2EService service) {
+ this.service = service;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java
new file mode 100644
index 0000000000..94c9c6a483
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class E2EUserParam {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("value")
+ private String value;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java
index d5e9629ce1..b3fc70ad91 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java
index f2bf59e298..d9a3323ee8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java
index 683b76452b..aedac6f00d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java
index b843784776..a325e54c08 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
index f77d5e3cc4..036694b9ae 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java
index a92fd33234..7d435862e9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
index a7e3ae03ba..0c0b622dd5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
index 6099d37918..3655643507 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java
index 35c8d30d6f..7f30a8a33c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java
index 50d6daae7e..ef18284475 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java
index b1121919ec..5ffba93303 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java
index 1d58fb8b83..2fd36547d2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java
index c877751205..ad04befd64 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java
index aa596ef372..e4faf72016 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java
index 6df45c7a0f..df2e065152 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java
index 87aa15717e..0af030136d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java
index 8f453c832d..d8f8d8bb70 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java
index 5f1ea28308..41c9dcafda 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java
index 5aed50ee5f..af026e5ed1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java
index 90275f67c6..5a7699b14e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
index 2ae5dc8989..de08c0384a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java
index 7a88c2dd94..04d252db33 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
index 512b061c59..f3b88ee3bf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
index db2f1654a1..b9450552a6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
index 69c0dfc53d..ba017fe27d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java
index dba82a80fc..3129aed7b0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
index dee0649184..a2acc3c3e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -21,7 +21,6 @@
package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -29,8 +28,6 @@ import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
-import org.openecomp.mso.apihandlerinfra.MsoRequest;
-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class RequestParameters {
@@ -44,6 +41,10 @@ public class RequestParameters {
private boolean autoBuildVfModules = false;
@JsonSerialize(include=Inclusion.ALWAYS)
private boolean cascadeDelete = false;
+ @JsonSerialize(include=Inclusion.ALWAYS)
+ private boolean usePreload=true; // usePreload would always be true for Update
+ @JsonSerialize(include=Inclusion.ALWAYS)
+ private boolean rebuildVolumeGroups = false;
public String getSubscriptionServiceType() {
@@ -107,12 +108,30 @@ public class RequestParameters {
this.cascadeDelete = cascadeDelete;
}
+ public boolean isUsePreload() {
+ return usePreload;
+ }
+
+ public void setUsePreload(boolean usePreload) {
+ this.usePreload = usePreload;
+ }
+
+ public boolean rebuildVolumeGroups() {
+ return rebuildVolumeGroups;
+ }
+
+ public void setRebuildVolumeGroups(boolean rebuildVolumeGroups) {
+ this.rebuildVolumeGroups = rebuildVolumeGroups;
+ }
+
@Override
public String toString() {
return "RequestParameters [subscriptionServiceType="
+ subscriptionServiceType + ", userParams=" + userParams
+ ", aLaCarte=" + aLaCarte + ", autoBuildVfModules="
- + autoBuildVfModules + "]";
+ + autoBuildVfModules + ", usePreload="
+ + usePreload + ", rebuildVolumeGroups="
+ + rebuildVolumeGroups +"]";
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java
index c2e3ecfbbd..22f7cf09cd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
index 02ad6e20ce..6776bedbda 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
index b3c01d0d0e..e17e664f97 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
index 2281f2ee72..c5338d4f2d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java
index b5be488367..9629019c5f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
index e81f1028fb..7b40b4af22 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java
new file mode 100644
index 0000000000..92612ef029
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonRootName(value = "requestDetails")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestDetails {
+
+ protected RequestInfo requestInfo;
+ /**
+ * Gets the value of the requestInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestInfo }
+ *
+ */
+ public RequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ /**
+ * Sets the value of the requestInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestInfo }
+ *
+ */
+ public void setRequestInfo(RequestInfo value) {
+ this.requestInfo = value;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java
new file mode 100644
index 0000000000..252cca4904
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java
@@ -0,0 +1,74 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestInfo {
+
+ protected String source;
+ protected ValidResponses responseValue;
+ protected String requestorId;
+
+ /**
+ * Gets the value of the source property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSource(String value) {
+ this.source = value;
+ }
+
+ public ValidResponses getResponseValue() {
+ return responseValue;
+ }
+
+ public void setResponseValue(ValidResponses responseValue) {
+ this.responseValue = responseValue;
+ }
+
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java
new file mode 100644
index 0000000000..aca5455ea6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java
@@ -0,0 +1,334 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+import org.json.JSONArray;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskList {
+ protected String taskId;
+ protected String type;
+ protected String nfRole;
+ protected String subscriptionServiceType;
+ protected String originalRequestId;
+ protected String originalRequestorId;
+ protected String errorSource;
+ protected String errorCode;
+ protected String errorMessage;
+ protected String buildingBlockName;
+ protected String buildingBlockStep;
+ protected JSONArray validResponses;
+
+ /**
+ * Gets the value of the taskId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTaskId() {
+ return taskId;
+ }
+
+ /**
+ * Sets the value of the taskId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTaskId(String value) {
+ this.taskId = value;
+ }
+
+ /**
+ * Gets the value of the type property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the value of the type property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setType(String value) {
+ this.type = value;
+ }
+
+ /**
+ * Gets the value of the nfRole property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ /**
+ * Sets the value of the nfRole property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNfRole(String value) {
+ this.nfRole = value;
+ }
+
+ /**
+ * Gets the value of the subscriptionServiceType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ /**
+ * Sets the value of the subscriptionServiceType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSubscriptionServiceType(String value) {
+ this.subscriptionServiceType = value;
+ }
+
+ /**
+ * Gets the value of the originalRequestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOriginalRequestId() {
+ return originalRequestId;
+ }
+
+ /**
+ * Sets the value of the originalRequestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOriginalRequestId(String value) {
+ this.originalRequestId = value;
+ }
+
+ /**
+ * Gets the value of the originalRequestorId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOriginalRequestorId() {
+ return originalRequestorId;
+ }
+
+ /**
+ * Sets the value of the originalRequestorId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOriginalRequestorId(String value) {
+ this.originalRequestorId = value;
+ }
+
+ /**
+ * Gets the value of the errorSource property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorSource() {
+ return errorSource;
+ }
+
+ /**
+ * Sets the value of the errorSource property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorSource(String value) {
+ this.errorSource = value;
+ }
+
+ /**
+ * Gets the value of the errorCode property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ /**
+ * Sets the value of the errorCode property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorCode(String value) {
+ this.errorCode = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Gets the value of the buildingBlockName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getBuildingBlockName() {
+ return buildingBlockName;
+ }
+
+ /**
+ * Sets the value of the buildingBlockName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setBuildingBlockName(String value) {
+ this.buildingBlockName = value;
+ }
+
+ /**
+ * Gets the value of the buildingBlockStep property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getBuildingBlockStep() {
+ return buildingBlockStep;
+ }
+
+ /**
+ * Sets the value of the buildingBlockStep property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setBuildingBlockStep(String value) {
+ this.buildingBlockStep = value;
+ }
+
+ /**
+ * Gets the value of the validResponses property.
+ *
+ * @return
+ * possible object is
+ * {@link ValidResponses }
+ *
+ */
+ public JSONArray getValidResponses() {
+ return validResponses;
+ }
+
+ /**
+ * Sets the value of the validResponses property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ValidResponses }
+ *
+ */
+ public void setValidResponses(JSONArray value) {
+ this.validResponses = value;
+ }
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java
new file mode 100644
index 0000000000..de04bed8e2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java
@@ -0,0 +1,57 @@
+/* ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+@JsonRootName(value = "taskRequestReference")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskRequestReference {
+
+ protected String taskId;
+
+ /**
+ * Gets the value of the taskId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTaskId() {
+ return taskId;
+ }
+
+ /**
+ * Sets the value of the taskId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTaskId(String value) {
+ this.taskId = value;
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java
new file mode 100644
index 0000000000..3dfdf029b1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java
@@ -0,0 +1,108 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskVariableValue {
+
+ protected String name;
+ protected String value;
+ protected String operator;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the operator property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOperator() {
+ return operator;
+ }
+
+ /**
+ * Sets the value of the operator property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOperator(String value) {
+ this.operator = value;
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java
new file mode 100644
index 0000000000..2e069dc02a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import java.util.List;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskVariables {
+
+ private List<TaskVariableValue> taskVariables;
+
+ public List<TaskVariableValue> getTaskVariables() {
+ return taskVariables;
+ }
+
+ public void setTaskVariables(List<TaskVariableValue> taskVariables) {
+ this.taskVariables = taskVariables;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java
new file mode 100644
index 0000000000..c21792acc1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import java.util.List;
+
+public class TasksGetResponse {
+
+ private List<TaskList> taskList;
+
+ public List<TaskList> getTaskList() {
+ return taskList;
+ }
+
+ public void setTaskList(List<TaskList> taskList) {
+ this.taskList = taskList;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java
new file mode 100644
index 0000000000..9f65aa07a5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+public class TasksRequest {
+
+ private RequestDetails requestDetails;
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java
new file mode 100644
index 0000000000..2eda3d2e80
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2015.09.03 at 02:02:13 PM EDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+
+public enum ValidResponses {
+
+ rollback,
+ abort,
+ skip,
+ retry
+ ;
+
+ public String value() {
+ return name();
+ }
+
+ public static ValidResponses fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java
new file mode 100644
index 0000000000..fbbaeda657
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class Value {
+
+ protected String value;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java
new file mode 100644
index 0000000000..11d1921527
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.openecomp.mso.apihandlerinfra.tasksbeans;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+@JsonRootName(value = "variables")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class Variables {
+
+ protected Value source;
+ protected Value responseValue;
+ protected Value requestorId;
+
+ /**
+ * Gets the value of the source property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public Value getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSource(Value value) {
+ this.source = value;
+ }
+
+ public Value getResponseValue() {
+ return responseValue;
+ }
+
+ public void setResponseValue(Value responseValue) {
+ this.responseValue = responseValue;
+ }
+
+
+ public Value getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(Value requestorId) {
+ this.requestorId = requestorId;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java
index 3062dfcb96..2a43658a65 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
index e86d2bb84a..cfd49d296b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
index e9f88ab190..b80ea85dc8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java
index a8fa78b87f..1e4cdddc4a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java
index c9876487d6..a18ef86b58 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
index 099a33d0a4..c3f6ec7d19 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java
index bfc0d84e43..58f8a5341e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java
index acb2a0a290..3cd5474182 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java
index 8d0fdcc67d..e989ad257c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
index 1ae229720c..336cad5210 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java
index 9ddd4ca6db..e303c4e081 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
index 9b966cd2bf..eebb1d9879 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java
index aa609615ab..eb073e2fd0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java
index 9e2c3ac525..41f95e650e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
index 3344d8d840..48cca8f1c2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java
index 4dfa4a6f3d..f69692c24f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java
index dfa36894a7..c14e3e2587 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java
index 55acf3270e..bd97060cd4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java
index be0d844d0a..3b8fab6552 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java
index d67d8c9202..69e0ca232c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
index 432df99d78..00c88a0fd7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java
index da9b178bd4..4224f657d6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd
new file mode 100644
index 0000000000..e8c67dddd7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd
@@ -0,0 +1,48 @@
+<xs:schema targetNamespace="org.openecomp.mso/humantasks" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="org.openecomp.mso/humantasks">
+ <xs:element name="taskList">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ <xs:element type="xs:string" name="type"/>
+ <xs:element type="xs:string" name="nfRole"/>
+ <xs:element type="xs:string" name="subscriptionServiceType"/>
+ <xs:element type="xs:string" name="originalRequestId"/>
+ <xs:element type="xs:string" name="originalRequestorId"/>
+ <xs:element type="xs:string" name="errorSource"/>
+ <xs:element type="xs:string" name="errorCode"/>
+ <xs:element type="xs:string" name="errorMessage"/>
+ <xs:element type="xs:string" name="buildingBlockName"/>
+ <xs:element type="xs:string" name="buildingBlockStep"/>
+ <xs:element name="validResponses">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="action" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="requestDetails">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="requestInfo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="source"/>
+ <xs:element type="xs:string" name="responseValue"/>
+ <xs:element type="xs:string" name="requestorId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name ="taskRequestReference">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd b/mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd
new file mode 100644
index 0000000000..e8c67dddd7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd
@@ -0,0 +1,48 @@
+<xs:schema targetNamespace="org.openecomp.mso/humantasks" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="org.openecomp.mso/humantasks">
+ <xs:element name="taskList">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ <xs:element type="xs:string" name="type"/>
+ <xs:element type="xs:string" name="nfRole"/>
+ <xs:element type="xs:string" name="subscriptionServiceType"/>
+ <xs:element type="xs:string" name="originalRequestId"/>
+ <xs:element type="xs:string" name="originalRequestorId"/>
+ <xs:element type="xs:string" name="errorSource"/>
+ <xs:element type="xs:string" name="errorCode"/>
+ <xs:element type="xs:string" name="errorMessage"/>
+ <xs:element type="xs:string" name="buildingBlockName"/>
+ <xs:element type="xs:string" name="buildingBlockStep"/>
+ <xs:element name="validResponses">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="action" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="requestDetails">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="requestInfo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="source"/>
+ <xs:element type="xs:string" name="responseValue"/>
+ <xs:element type="xs:string" name="requestorId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name ="taskRequestReference">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="taskId"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
new file mode 100644
index 0000000000..325d2f8bdd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -0,0 +1,469 @@
+/*-
+ * ============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.apihandlerinfra;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.junit.Test;
+import org.openecomp.mso.apihandler.common.CamundaClient;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class E2EServiceInstancesTest {
+
+
+ @Test
+ public void createE2EServiceInstanceTestSuccess(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 0;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,202, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ assertTrue(resp.getStatus() == 202);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPException(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 0;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 0;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBPELResponse(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("bpelResponse is null") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBPMNNullREsponse(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action){
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
+ /* E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Failed calling bpmn null") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBpmn(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Failed calling bpmn properties is null") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullReceipe(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullDBResponse(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestInvalidRequest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ List<InfraActiveRequests> activeReqlist = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("39493992");
+
+ activeReqlist.add(req);
+ return activeReqlist;
+ }
+ };
+ /* E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestEmptyDBQuery(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return Collections.EMPTY_LIST;
+ }
+ };
+ /* E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestDBQueryFail(){
+ /* E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);*/
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestForEmptyRequest(){
+ /*E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);*/
+ }
+
+ @Test
+ public void deleteE2EServiceInstanceTestNormal(){
+ /* E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.deleteE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);*/
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
index dde7ecf20b..d20357d4be 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -19,18 +19,24 @@
*/
package org.openecomp.mso.apihandlerinfra;
-import org.openecomp.mso.apihandler.common.ValidationException;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
import org.apache.commons.io.IOUtils;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.util.HashMap;
-import static org.junit.Assert.*;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
public class MsoRequestTest {
@@ -232,4 +238,64 @@ public class MsoRequestTest {
}
+ @Test
+ public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModule.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+
+
+
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleNoCustomizationId.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+
+ mapper = new ObjectMapper();
+ instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleMissingModelCustomizationId.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
new file mode 100644
index 0000000000..ee789a60ca
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -0,0 +1,491 @@
+package org.openecomp.mso.apihandlerinfra;
+
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.junit.Test;
+
+import javax.ws.rs.core.Response;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class ServiceInstanceTest {
+
+ /*** Create Service Instance Test Cases ***/
+
+ @Test
+ public void createServiceInstanceInvalidModelInfo(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNormalNullDBFatch(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return Collections.EMPTY_LIST;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
+ }
+
+
+ @Test
+ public void createServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullInstanceName(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid instanceName is specified") != -1);
+ }
+
+
+ @Test
+ public void createServiceInstanceNullModelInfo(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceInvalidModelInvariantId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"1234\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullModelVersion(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ }
+
+
+ @Test
+ public void createServiceInstanceNullModelType(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceInvalidModelType(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"testmodel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Mapping of request to JSON object failed.") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullModelName(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelName is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceInvalidVersionForAutoBuildVfModules(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. AutoBuildVfModule is not valid in the v2 version") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullRequestParameter(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullSubscriptionType(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ /*** Activate Service Instance Test Cases ***/
+
+ @Test
+ public void activateServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ @Test
+ public void activateServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ }
+
+ @Test
+ public void activateServiceInstanceInvalidServiceInstanceId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ }
+
+ @Test
+ public void activateServiceInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Deactivate Service Instance Test Cases ***/
+
+ @Test
+ public void deactivateServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ @Test
+ public void deactivateServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ }
+
+ @Test
+ public void deactivateServiceInstanceInvalidServiceInstanceId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ }
+
+ @Test
+ public void deactivateServiceInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Delete Service Instance Test Cases ***/
+
+ @Test
+ public void deleteServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ @Test
+ public void deleteServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ }
+
+ @Test
+ public void deleteServiceInstanceInvalidServiceInstanceId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ }
+
+ @Test
+ public void deleteServiceInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Create Vnf Instance Test Cases ***/
+
+ @Test
+ public void createVNFInstanceTestInvalidCloudConfiguration(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid cloudConfiguration is specified") != -1);
+ }
+
+ @Test
+ public void createVNFInstanceTestInvalidIcpCloudRegionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid lcpCloudRegionId is specified") != -1);
+ }
+
+ @Test
+ public void createVNFInstanceTestInvalidTenantId(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid tenantId is specified") != -1);
+ }
+
+ @Test
+ public void createVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Replace Vnf Instance Test Cases ***/
+ @Test
+ public void replaceVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.replaceVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Update Vnf Instance Test Cases ***/
+
+ @Test
+ public void updateVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.updateVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Update Vnf Instance Test Cases ***/
+
+ @Test
+ public void deleteVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.deleteVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json
new file mode 100644
index 0000000000..eb39ef12b9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json
@@ -0,0 +1,62 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelCustomizationId": "856f9806-b01a-11e6-80f5-76304dec7eb7",
+ "modelName": "Test",
+ "modelVersion": "1"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "MSOTEST103a-vSAMP12_base_module-0",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c",
+ "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol",
+ "modelInfo": {
+ "modelType": "volumeGroup"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vSAMP12 1"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "usePreload": true,
+ "userParams": []
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json
new file mode 100644
index 0000000000..2fd0e03ad3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json
@@ -0,0 +1,61 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "MSOTEST103a-vSAMP12_base_module-0",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c",
+ "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol",
+ "modelInfo": {
+ "modelType": "volumeGroup"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vSAMP12 1"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "usePreload": false,
+ "userParams": []
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json
new file mode 100644
index 0000000000..9c892a4fc0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json
@@ -0,0 +1,61 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "MSOTEST103a-vSAMP12_base_module-0",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c",
+ "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol",
+ "modelInfo": {
+ "modelType": "volumeGroup"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vSAMP12 1"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "usePreload": true,
+ "userParams": []
+ }
+ }
+}