aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java31
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java112
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java850
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java333
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java619
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java667
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java101
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java251
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java52
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java2102
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java734
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java104
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java373
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java714
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java804
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java107
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java367
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java644
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java746
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java74
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java378
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java120
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java179
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java148
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java129
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java286
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java90
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java156
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java103
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java85
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java165
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java118
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java191
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java38
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java43
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java79
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java150
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java286
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java261
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java689
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java291
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java179
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java148
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java115
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java286
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java435
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java233
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java179
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java99
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties27
84 files changed, 17442 insertions, 0 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
new file mode 100644
index 0000000000..8df4c87898
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Action {
+ createInstance,
+ updateInstance,
+ deleteInstance,
+ configureInstance
+}
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
new file mode 100644
index 0000000000..34d739b310
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+public class Constants {
+
+ public static final String VNF_TYPES_PATH = "/{version: v1|v2|v3}/vnf-types";
+ public static final String NETWORK_TYPES_PATH = "/{version: v1|v2|v3}/network-types";
+ public static final String VF_MODULE_MODEL_NAMES_PATH = "/{version: v2|v3}/vf-module-model-names";
+ public static final String REQUEST_ID_PATH = "/{request-id}";
+
+ public static final String STATUS_SUCCESS = "SUCCESS";
+
+ public static final String MODIFIED_BY_APIHANDLER = "APIH";
+
+ public static final String SCHEMA_VERSION_V1 = "v1";
+ public static final String SCHEMA_VERSION_V2 = "v2";
+ public static final String SCHEMA_VERSION_V3 = "v3";
+
+ public static final long PROGRESS_REQUEST_COMPLETED = 100L;
+ public static final long PROGRESS_REQUEST_RECEIVED = 0L;
+ public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L;
+
+ public static final String VNF_TYPE_WILDCARD = "*";
+
+ public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP";
+
+ public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9_-]*$";
+
+}
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
new file mode 100644
index 0000000000..0ae1695516
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+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.DefaultValue;
+import javax.ws.rs.core.Response;
+import org.openecomp.mso.HealthCheckUtils;
+
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/")
+public class HealthcheckHandler {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @HEAD
+ @GET
+ @Path("/healthcheck")
+ @Produces("text/html")
+ public Response healthcheck (@QueryParam("requestId") String requestId) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("Healthcheck");
+ UUIDChecker.verifyOldUUID(requestId, msoLogger);
+ HealthCheckUtils healthCheck = new HealthCheckUtils ();
+ if (!healthCheck.siteStatusCheck(msoLogger, startTime)) {
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+
+ if (!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_APIHANDLER_INFRA)) {
+ return HealthCheckUtils.NOT_STARTED_RESPONSE;
+ }
+
+ if (!healthCheck.requestDBCheck (msoLogger, startTime)) {
+ return HealthCheckUtils.NOT_STARTED_RESPONSE;
+ }
+ 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
new file mode 100644
index 0000000000..37cbb4de66
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+public class InfraUtils {
+ public static boolean isActionAllowed(MsoJavaProperties props, String requestType, String version, String action) {
+ // Check for allowable actions
+ String actionsPropertyName = requestType + "." + version + ".ApiAllowableActions";
+ String allowableActions = props.getProperty(actionsPropertyName, null);
+ boolean actionAllowed = false;
+ if (allowableActions != null) {
+ String allowableActionsList[] = allowableActions.split(",");
+ for (int i=0; i<allowableActionsList.length; i++) {
+ if (action.equals (allowableActionsList[i])) {
+ actionAllowed = true;
+ break;
+ }
+ }
+ }
+ else {
+ actionAllowed = true;
+ }
+ return actionAllowed;
+ }
+
+ // Checks if the name is acceptable for heat stack
+ public static boolean isValidHeatName(String name) {
+ if (name.matches("^[a-zA-Z][a-zA-Z0-9_\\.-]*$"))
+ return true;
+ return false;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..cdccaf27e3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+
+public class Messages {
+
+ public static final Map<String,String> errors = new HashMap<String,String>();
+ static {
+ errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s");
+ errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s");
+ errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s");
+ errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s");
+
+ errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name.");
+ errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id.");
+ errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing");
+ errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s");
+ errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s");
+ errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s");
+ errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s");
+ }
+}
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
new file mode 100644
index 0000000000..2f01c4fcdb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum ModelType {
+ service,
+ vnf,
+ vfModule,
+ volumeGroup,
+ network
+}
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
new file mode 100644
index 0000000000..2ef1e4a0ec
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+public enum MsoException {
+ ServiceException,
+ PolicyException,
+}
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
new file mode 100644
index 0000000000..0dd9a03c90
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+public class MsoPropertiesUtils {
+
+ private final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory ();
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ private static boolean noProperties = true;
+
+ public synchronized static MsoJavaProperties loadMsoProperties () {
+ MsoJavaProperties msoProperties;
+ try {
+ msoProperties = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_APIHANDLER_INFRA);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO Properties", e);
+ return null;
+ }
+
+ if (msoProperties != null && msoProperties.size () > 0) {
+ noProperties = false;
+ msoLogger.info (MessageEnum.APIH_PROPERTY_LOAD_SUC, "", "");
+ return msoProperties;
+ } else {
+ msoLogger.error (MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No MSO APIH_INFRA Properties found");
+ return null;
+ }
+ }
+
+ public synchronized static final boolean getNoPropertiesState() {
+ return noProperties;
+ }
+}
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
new file mode 100644
index 0000000000..55c12eb6ff
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -0,0 +1,850 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+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.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+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.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig.Feature;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hibernate.Session;
+import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.CloudConfiguration;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.PolicyException;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestError;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceException;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
+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.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.HibernateUtil;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+public class MsoRequest {
+
+ private String requestId;
+ private String requestXML;
+ private String requestJSON;
+ private String requestUri;
+ private VnfRequest vnfReq;
+ private RequestInfo requestInfo;
+ private ModelInfo modelInfo;
+ private CloudConfiguration cloudConfiguration ;
+ private VnfInputs vnfInputs;
+ private String vnfParams;
+ private Action action;
+ private String errorMessage;
+ private String errorCode;
+ private String httpResponse;
+ private String responseBody;
+ private RequestStatusType status;
+ private ServiceInstancesRequest sir;
+ private long startTime;
+ private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
+ private String serviceInstanceType;
+ private String vnfType;
+ private String vfModuleType;
+ private String vfModuleModelName;
+ private String networkType;
+ private String asdcServiceModelVersion;
+ private String requestScope;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static final String NOT_PROVIDED = "not provided";
+
+ MsoRequest (String requestId) {
+ this.requestId = requestId;
+ Calendar startTimeCalendar = Calendar.getInstance ();
+ this.startTime = startTimeCalendar.getTimeInMillis ();
+ MsoLogger.setLogContext (requestId, null);
+
+ }
+
+ MsoRequest () {
+
+ Calendar startTimeCalendar = Calendar.getInstance ();
+ this.startTime = startTimeCalendar.getTimeInMillis ();
+ MsoLogger.setLogContext (requestId, null);
+
+ }
+
+
+ public Response buildServiceErrorResponse (int httpResponseCode,
+ MsoException exceptionType,
+ String text,
+ String messageId,
+ List<String> variables) {
+
+ this.errorCode = messageId;
+
+ if (text != null) {
+ this.errorMessage = text;
+ }
+ else {
+ this.errorMessage = "";
+ }
+ this.httpResponse = Integer.toString(httpResponseCode);
+ if(errorMessage.length() > 1999){
+ errorMessage = errorMessage.substring(0, 1999);
+ }
+
+ RequestError re = new RequestError();
+
+ if(exceptionType.name().equals("PolicyException")){
+
+ PolicyException pe = new PolicyException();
+ pe.setMessageId(messageId);
+ pe.setText(text);
+ if(variables != null){
+ for(String variable: variables){
+ pe.getVariables().add(variable);
+ }
+ }
+ re.setPolicyException(pe);
+
+ } else {
+
+ ServiceException se = new ServiceException();
+ se.setMessageId(messageId);
+ se.setText(text);
+ if(variables != null){
+ if(variables != null){
+ for(String variable: variables){
+ se.getVariables().add(variable);
+ }
+ }
+ }
+ re.setServiceException(se);
+ }
+
+ String requestErrorStr = null;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
+ requestErrorStr = mapper.writeValueAsString(re);
+ }catch(Exception e){
+ msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
+ }
+
+
+ return Response.status (httpResponseCode).entity(requestErrorStr).build ();
+
+ }
+
+
+ // Parse request JSON
+ void parse (ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap, Action action) throws ValidationException {
+
+ msoLogger.debug ("Validating the Service Instance request");
+
+ this.sir = sir;
+ this.action = action;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+ requestJSON = mapper.writeValueAsString(sir.getRequestDetails());
+
+ } catch(Exception e){
+ throw new ValidationException ("Parse ServiceInstanceRequest to JSON string");
+ }
+
+ if(instanceIdMap != null){
+ if(instanceIdMap.get("serviceInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("serviceInstanceId"))) {
+ throw new ValidationException ("serviceInstanceId");
+ }
+ this.sir.setServiceInstanceId(instanceIdMap.get("serviceInstanceId"));
+ }
+
+ if(instanceIdMap.get("vnfInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vnfInstanceId"))) {
+ throw new ValidationException ("vnfInstanceId");
+ }
+ this.sir.setVnfInstanceId(instanceIdMap.get("vnfInstanceId"));
+ }
+
+ if(instanceIdMap.get("vfModuleInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vfModuleInstanceId"))) {
+ throw new ValidationException ("vfModuleInstanceId");
+ }
+ this.sir.setVfModuleInstanceId(instanceIdMap.get("vfModuleInstanceId"));
+ }
+
+ if(instanceIdMap.get("volumeGroupInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("volumeGroupInstanceId"))) {
+ throw new ValidationException ("volumeGroupInstanceId");
+ }
+ this.sir.setVolumeGroupInstanceId(instanceIdMap.get("volumeGroupInstanceId"));
+ }
+
+ if(instanceIdMap.get("networkInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("networkInstanceId"))) {
+ throw new ValidationException ("networkInstanceId");
+ }
+ this.sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId"));
+ }
+ }
+
+ this.modelInfo = sir.getRequestDetails().getModelInfo();
+
+ if (this.modelInfo == null) {
+ throw new ValidationException ("model-info");
+ }
+
+ this.requestInfo = sir.getRequestDetails().getRequestInfo();
+
+ if (this.requestInfo == null) {
+ throw new ValidationException ("requestInfo");
+ }
+
+ if (modelInfo.getModelType () == null) {
+ throw new ValidationException ("modelType");
+ }
+
+ this.requestScope = modelInfo.getModelType().name();
+
+ if (empty (modelInfo.getModelInvariantId ()) && !(requestScope.equalsIgnoreCase (ModelType.network.name ()) &&
+ (action == Action.createInstance || action == Action.updateInstance))) {
+ throw new ValidationException ("modelInvariantId");
+ }
+
+ if (!empty (modelInfo.getModelInvariantId ()) && !UUIDChecker.isValidUUID (modelInfo.getModelInvariantId ())) {
+ throw new ValidationException ("modelInvariantId format");
+ }
+
+ if (empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || (action == Action.deleteInstance &&
+ (requestScope.equalsIgnoreCase (ModelType.network.name ()) || requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))) {
+ throw new ValidationException ("modelName");
+ }
+
+ if (empty (modelInfo.getModelVersion ()) && !(requestScope.equalsIgnoreCase (ModelType.network.name ()) &&
+ (action == Action.createInstance || action == Action.updateInstance))) {
+ throw new ValidationException ("modelVersion");
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) {
+ throw new ValidationException ("modelCustomizationName");
+ }
+
+ this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration ();
+ if (!requestScope.equalsIgnoreCase (ModelType.service.name ()) && cloudConfiguration == null) {
+ throw new ValidationException ("cloudConfiguration");
+ }
+
+ if (cloudConfiguration != null) {
+ if (empty (cloudConfiguration.getLcpCloudRegionId ())) {
+ throw new ValidationException ("lcpCloudRegionId");
+ }
+ if (empty (cloudConfiguration.getTenantId ())) {
+ throw new ValidationException ("tenantId");
+ }
+ }
+
+ if (requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) {
+ if (sir.getRequestDetails ().getRequestParameters () == null) {
+ throw new ValidationException ("requestParameters");
+ }
+ if (empty (sir.getRequestDetails ().getRequestParameters ().getSubscriptionServiceType ())) {
+ throw new ValidationException ("subscriptionServiceType");
+ }
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.service.name())){
+ this.serviceInstanceType = modelInfo.getModelName();
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.network.name())){
+ this.networkType = modelInfo.getModelName();
+ }
+
+ // Verify instanceName existence and format
+ if (empty (requestInfo.getInstanceName ()) && action == Action.createInstance) {
+ throw new ValidationException ("instanceName");
+ }
+
+ if (!empty (requestInfo.getInstanceName ()) && !requestInfo.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) {
+ throw new ValidationException ("instanceName format");
+ }
+
+ if (empty (requestInfo.getProductFamilyId ()) && ((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) ||
+ (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)))) {
+ throw new ValidationException ("productFamilyId");
+ }
+
+ if (empty (requestInfo.getSource ())) {
+ throw new ValidationException ("source");
+ }
+
+
+ RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
+
+ String serviceModelName = null;
+ String vnfModelName = null;
+ String asdcServiceModelVersion = null;
+ String volumeGroupId = null;
+ boolean isRelatedServiceInstancePresent = false;
+ boolean isRelatedVnfInstancePresent = false;
+
+ if (instanceList != null) {
+ for(RelatedInstanceList relatedInstanceList : instanceList){
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+
+ if (!empty (relatedInstance.getInstanceName ()) && !relatedInstance.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) {
+ throw new ValidationException ("instanceName format in relatedInstance");
+ }
+
+ if (empty (relatedInstance.getInstanceId ())) {
+ throw new ValidationException ("instanceId in relatedInstance");
+ }
+
+ if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) {
+ throw new ValidationException ("instanceId format in relatedInstance");
+ }
+
+ if (relatedInstance.getModelInfo () == null) {
+ throw new ValidationException ("modelInfo in relatedInstance");
+ }
+
+ if (relatedInstance.getModelInfo ().getModelType () == null) {
+ throw new ValidationException ("modelType in relatedInstance");
+ }
+
+ if (action != Action.deleteInstance) {
+
+ if (empty (relatedInstance.getModelInfo ().getModelInvariantId ()) &&
+ !(requestScope.equalsIgnoreCase (ModelType.vfModule.name ()) && action == Action.createInstance &&
+ relatedInstance.getModelInfo ().getModelType ().equals(ModelType.volumeGroup))) {
+ throw new ValidationException ("modelInvariantId in relatedInstance");
+ }
+
+ if (!empty (relatedInstance.getModelInfo ().getModelInvariantId ()) &&
+ !UUIDChecker.isValidUUID (relatedInstance.getModelInfo ().getModelInvariantId ())) {
+ throw new ValidationException ("modelInvariantId format in relatedInstance");
+ }
+
+ if (empty(relatedInstance.getModelInfo ().getModelName ()) &&
+ !(requestScope.equalsIgnoreCase (ModelType.vfModule.name ()) && action == Action.createInstance &&
+ relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) {
+ throw new ValidationException ("modelName in relatedInstance");
+ }
+
+ if (empty (relatedInstance.getModelInfo ().getModelVersion ()) &&
+ !(requestScope.equalsIgnoreCase (ModelType.vfModule.name ()) && action == Action.createInstance &&
+ relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) {
+ throw new ValidationException ("modelVersion 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)) {
+ 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)) {
+ 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)) {
+ volumeGroupId = relatedInstance.getInstanceId ();
+ }
+ }
+
+
+ if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) {
+ if (!isRelatedServiceInstancePresent) {
+ throw new ValidationException ("related service instance for volumeGroup request");
+ }
+ if (!isRelatedVnfInstancePresent) {
+ throw new ValidationException ("related vnf instance for volumeGroup request");
+ }
+ this.serviceInstanceType = serviceModelName;
+ this.vnfType = serviceModelName + "/" + vnfModelName;
+ this.asdcServiceModelVersion = asdcServiceModelVersion;
+ }
+ else if(requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) {
+ if (!isRelatedServiceInstancePresent) {
+ throw new ValidationException ("related service instance for vfModule request");
+ }
+ if (!isRelatedVnfInstancePresent) {
+ throw new ValidationException ("related vnf instance for vfModule request");
+ }
+ String vfModuleModelName = modelInfo.getModelName ();
+ this.vfModuleModelName = vfModuleModelName;
+ this.serviceInstanceType = serviceModelName;
+ this.vnfType = serviceModelName + "/" + vnfModelName;
+ this.asdcServiceModelVersion = asdcServiceModelVersion;
+ this.vfModuleType = vnfType + "::" + vfModuleModelName;
+ this.sir.setVolumeGroupInstanceId (volumeGroupId);
+ }
+ else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ())) {
+ if (!isRelatedServiceInstancePresent) {
+ throw new ValidationException ("related service instance for vnf request");
+ }
+ this.vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
+ }
+ }
+ else if (action != Action.deleteInstance && !requestScope.equalsIgnoreCase(ModelType.service.name ()) &&
+ !requestScope.equalsIgnoreCase(ModelType.network.name ())) {
+ throw new ValidationException ("related instances");
+ }
+
+ }
+
+ public Map<String, List<String>> getOrchestrationFilters (MultivaluedMap<String, String> queryParams) throws ValidationException {
+
+ String queryParam = null;
+ Map<String, List<String>> orchestrationFilterParams = new HashMap<String, List<String>>();
+
+
+ for (Entry<String,List<String>> entry : queryParams.entrySet()) {
+ queryParam = entry.getKey();
+
+ 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);
+ }
+
+ }catch(Exception e){
+ //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e);
+ throw new ValidationException ("QueryParam ServiceInfo", e);
+
+ }
+
+ }
+
+
+ return orchestrationFilterParams;
+ }
+
+ public void createRequestRecord (Status status, Action action) {
+
+ Session session = null;
+ try {
+
+ session = HibernateUtil.getSessionFactory ().openSession ();
+ session.beginTransaction ();
+
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ aq.setRequestId (requestId);
+
+ aq.setRequestAction(action.name());
+ aq.setAction(action.name());
+
+ Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+
+ aq.setStartTime (startTimeStamp);
+
+ if (requestInfo != null) {
+
+ if(requestInfo.getSource() != null){
+ aq.setSource(requestInfo.getSource());
+ }
+ if(requestInfo.getCallbackUrl() != null){
+ aq.setCallBackUrl(requestInfo.getCallbackUrl());
+ }
+ if(requestInfo.getCorrelator() != null){
+ aq.setCorrelator(requestInfo.getCorrelator());
+ }
+
+ }
+
+ if (modelInfo != null) {
+ aq.setRequestScope(requestScope);
+ }
+
+ if (cloudConfiguration != null) {
+ if(cloudConfiguration.getLcpCloudRegionId() != null) {
+ aq.setAicCloudRegion(cloudConfiguration.getLcpCloudRegionId());
+ }
+
+ if(cloudConfiguration.getTenantId() != null) {
+ aq.setTenantId(cloudConfiguration.getTenantId());
+ }
+
+ }
+
+ if(sir.getServiceInstanceId() != null){
+ aq.setServiceInstanceId(sir.getServiceInstanceId());
+ }
+
+ if(sir.getVnfInstanceId() != null){
+ aq.setVnfId(sir.getVnfInstanceId());
+ }
+
+
+ if(requestScope.equalsIgnoreCase(ModelType.service.name())){
+ if(requestInfo.getInstanceName() != null){
+ aq.setServiceInstanceName(requestInfo.getInstanceName());
+ }
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.network.name())){
+ aq.setNetworkName(requestInfo.getInstanceName());
+ aq.setNetworkType(networkType);
+ aq.setNetworkId(sir.getNetworkInstanceId());
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())){
+ aq.setVolumeGroupId(sir.getVolumeGroupInstanceId());
+ aq.setVolumeGroupName(requestInfo.getInstanceName());
+ aq.setVnfType(vnfType);
+
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.vfModule.name())){
+ aq.setVfModuleName(requestInfo.getInstanceName());
+ aq.setVfModuleModelName(modelInfo.getModelName());
+ aq.setVfModuleId(sir.getVfModuleInstanceId());
+ aq.setVolumeGroupId(sir.getVolumeGroupInstanceId());
+ aq.setVnfType(vnfType);
+
+ }
+
+ if(requestScope.equalsIgnoreCase(ModelType.vnf.name())){
+ aq.setVnfName(requestInfo.getInstanceName());
+ RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
+
+ if (instanceList != null) {
+
+ for(RelatedInstanceList relatedInstanceList : instanceList){
+
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){
+ aq.setVnfType(vnfType);
+ }
+ }
+ }
+ //aq.setVnfType(sir.getRequestDetails().getRelatedInstanceList());
+
+ }
+
+ aq.setRequestBody (this.requestJSON);
+
+
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+
+ if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
+ aq.setStatusMessage (this.errorMessage);
+ aq.setResponseBody (this.responseBody);
+ aq.setProgress(new Long(100));
+
+ Calendar endTime = Calendar.getInstance ();
+ Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ aq.setEndTime (endTimeStamp);
+ }
+
+ msoLogger.debug ("About to insert a record");
+
+ session.save (aq);
+ session.getTransaction ().commit ();
+ session.close ();
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e);
+ if (session != null) {
+ session.close ();
+ }
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ }
+
+ public void updateFinalStatus (Status status) {
+ int result = 0;
+ try {
+ result = RequestsDatabase.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 when updating record in DB");
+ msoLogger.debug ("Exception: ", e);
+ }
+ }
+
+ public Response buildResponse (int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
+ return buildResponseWithError (httpResponseCode, errorCode, inProgress, null);
+ }
+
+ public Response buildResponseWithError (int httpResponseCode,
+ String errorCode,
+ InfraActiveRequests inProgress,
+ String errorString) {
+
+
+
+ // Log the failed request into the MSO Requests database
+
+ return Response.status (httpResponseCode).entity (null).build ();
+
+ }
+
+ public Response buildResponseFailedValidation (int httpResponseCode, String exceptionMessage) {
+
+
+
+ return Response.status (httpResponseCode).entity (null).build ();
+ }
+
+ public String getRequestUri () {
+ return requestUri;
+ }
+
+ public void setRequestUri (String requestUri) {
+ this.requestUri = requestUri;
+ }
+
+ public VnfInputs getVnfInputs () {
+ return vnfInputs;
+ }
+
+ public RequestInfo getRequestInfo () {
+ return requestInfo;
+ }
+
+ public String getResponseBody () {
+ return responseBody;
+ }
+
+ public void setResponseBody (String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+ public String getHttpResponse () {
+ return httpResponse;
+ }
+
+ public void setHttpResponse (String httpResponse) {
+ this.httpResponse = httpResponse;
+ }
+
+ public String getRequestId () {
+ return requestId;
+ }
+
+ public String getRequestXML () {
+ return requestXML;
+ }
+
+ public void setRequestXML (String requestXML) {
+ this.requestXML = requestXML;
+ }
+
+ public RequestStatusType getStatus () {
+ return status;
+ }
+
+ public String getServiceType () {
+ if (this.vnfInputs.getServiceType () != null)
+ return this.vnfInputs.getServiceType ();
+ if (this.vnfInputs.getServiceId () != null)
+ return this.vnfInputs.getServiceId ();
+ return null;
+ }
+
+ public void setStatus (RequestStatusType status) {
+ this.status = status;
+ switch (status) {
+ case FAILED:
+ case COMPLETE:
+ this.progress = Constants.PROGRESS_REQUEST_COMPLETED;
+ break;
+ case IN_PROGRESS:
+ this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS;
+ break;
+ }
+ }
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public ServiceInstancesRequest getServiceInstancesRequest() {
+ return sir;
+ }
+
+ public String getServiceInstanceType () {
+ return serviceInstanceType;
+ }
+
+ public String getNetworkType () {
+ return networkType;
+ }
+
+ public String getVnfType () {
+ return vnfType;
+ }
+
+ public String getVfModuleModelName () {
+ return vfModuleModelName;
+ }
+
+ public String getVfModuleType () {
+ return vfModuleType;
+ }
+
+ public String getAsdcServiceModelVersion () {
+ return asdcServiceModelVersion;
+ }
+
+ public static String domToStr (Document doc) {
+ if (doc == null) {
+ return null;
+ }
+
+ try {
+ StringWriter sw = new StringWriter ();
+ StreamResult sr = new StreamResult (sw);
+ TransformerFactory tf = TransformerFactory.newInstance ();
+ Transformer t = tf.newTransformer ();
+ t.setOutputProperty (OutputKeys.STANDALONE, "yes");
+ NodeList nl = doc.getDocumentElement ().getChildNodes ();
+ DOMSource source = null;
+ for (int x = 0; x < nl.getLength (); x++) {
+ Node e = nl.item (x);
+ if (e instanceof Element) {
+ source = new DOMSource (e);
+ break;
+ }
+ }
+ if (source != null) {
+ t.transform (source, sr);
+
+ String s = sw.toString ();
+ return s;
+ }
+
+ return null;
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in domToStr", e);
+ }
+ return null;
+ }
+
+ public void addBPMNSpecificInputs(String personaModelId, String personaModelVersion, Boolean isBaseVfModule,
+ String vnfPersonaModelId, String vnfPersonaModelVersion) {
+ vnfInputs.setPersonaModelId(personaModelId);
+ vnfInputs.setPersonaModelVersion(personaModelVersion);
+ vnfInputs.setIsBaseVfModule(isBaseVfModule);
+ vnfInputs.setVnfPersonaModelId(vnfPersonaModelId);
+ vnfInputs.setVnfPersonaModelVersion(vnfPersonaModelVersion);
+
+ this.vnfReq.setVnfInputs(vnfInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (this.vnfReq, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ this.requestXML = stringWriter.toString ();
+ msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML);
+
+
+ }
+
+ 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/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
new file mode 100644
index 0000000000..59b93eadde
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
@@ -0,0 +1,333 @@
+
+package org.openecomp.mso.apihandlerinfra;
+
+/*-
+ * #%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%
+ */
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+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 javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+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;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkOutputs;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequests;
+import org.openecomp.mso.apihandlerinfra.networkbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.networkbeans.RequestInfo;
+import org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.InfraRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/{version: v1|v2|v3}/network-request")
+public class NetworkInfoHandler {
+
+ protected ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @GET
+ public Response queryFilters (@QueryParam("network-type") String networkType,
+ @QueryParam("service-type") String serviceType,
+ @QueryParam("aic-node-clli") String aicNodeClli,
+ @QueryParam("tenant-id") String tenantId,
+ @PathParam("version") String version) {
+ MsoLogger.setServiceName ("QueryFilters");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+
+ msoLogger.debug ("Incoming request received for query filters with Network type " + networkType
+ + " - service type "
+ + serviceType
+ + " - aicNodeClli "
+ + aicNodeClli
+ + " - tenant id "
+ + tenantId);
+ Response response = null;
+ if (networkType != null) {
+ response = this.getRequestList ("vnfType", networkType, version);
+ } else {
+ response = queryGenericFilters (serviceType, aicNodeClli, tenantId, version);
+ }
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ @GET
+ @Path(Constants.REQUEST_ID_PATH)
+ public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+ MsoLogger.setServiceName ("GetRequest");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getRequest with requestId=" + requestId + ", version = " + version);
+ long startTime = System.currentTimeMillis ();
+
+ Response response = getRequestGeneric (requestId, version);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+ protected void fillNetworkRequest (NetworkRequest qr, InfraRequests ar, String version) {
+ NetworkInputs vi = beansObjectFactory.createNetworkInputs ();
+
+ if (ar.getVnfId () != null) {
+ vi.setNetworkId (ar.getVnfId ());
+ }
+ if (ar.getVnfName () != null) {
+ vi.setNetworkName (ar.getVnfName ());
+ }
+ if (ar.getVnfType () != null) {
+ vi.setNetworkType (ar.getVnfType ());
+ }
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (ar.getServiceType () != null) {
+ vi.setServiceType (ar.getServiceType ());
+ }
+ if (ar.getAicNodeClli () != null) {
+ vi.setAicNodeClli (ar.getAicNodeClli ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getServiceInstanceId () != null) {
+ vi.setServiceInstanceId (ar.getServiceInstanceId ());
+ }
+
+ }
+
+ if (ar.getTenantId () != null) {
+ vi.setTenantId (ar.getTenantId ());
+ }
+ if (ar.getProvStatus () != null) {
+ vi.setProvStatus (ar.getProvStatus ());
+ }
+ qr.setNetworkInputs (vi);
+
+ qr.setNetworkParams (ar.getVnfParams ());
+
+ try {
+ String networkoutputs = ar.getVnfOutputs ();
+ if (networkoutputs != null && networkoutputs.length () > 0) {
+ msoLogger.debug ("Read NETWORK outputs: " + networkoutputs);
+ NetworkOutputs networkOutput = null;
+
+ // Now unmarshal it into network outputs
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkOutputs.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (networkoutputs));
+ SAXSource source = new SAXSource (inputSource);
+
+ networkOutput = jaxbUnmarshaller.unmarshal (source, NetworkOutputs.class).getValue ();
+
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed", e);
+ throw new ValidationException ("format for network outputs");
+ }
+
+ qr.setNetworkOutputs (networkOutput);
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("exception reading networkOutputs Clob", e);
+ }
+ }
+
+ protected Response queryGenericFilters (String serviceType, String aicNodeClli, String tenantId, String version) {
+ if (serviceType != null) {
+ return this.getRequestList ("serviceType", serviceType, version);
+ }
+ if (aicNodeClli != null) {
+ return this.getRequestList ("aicNodeClli", aicNodeClli, version);
+ }
+ if (tenantId != null) {
+ return this.getRequestList ("tenantId", tenantId, version);
+ }
+ return Response.status (HttpStatus.SC_BAD_REQUEST).entity ("").build ();
+ }
+
+ protected Response getRequestGeneric (String requestId, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+ MsoLogger.setLogContext (requestId, null);
+ getMsoLogger ().debug ("getRequest: " + requestId);
+
+ String responseString = null;
+
+ InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, "NETWORK");
+ if (activeReq != null) {
+ // build response for active
+ responseString = infraRequestsResponse (activeReq, version);
+ return Response.status (HttpStatus.SC_OK).entity (responseString).build ();
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ protected Response getRequestList (String queryAttribute, String queryValue, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
+
+ List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ queryValue,
+ "NETWORK");
+
+ List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+
+ if (activeReqList != null) {
+ // build response for active
+ queryResponseList = infraRequestsResponses (activeReqList, version);
+
+ }
+
+ if (queryResponseList != null && !queryResponseList.isEmpty ()) {
+ String result = this.translateNetworkRequests (queryResponseList);
+ return Response.status (HttpStatus.SC_OK).entity (result).build ();
+
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ private NetworkRequest fillGeneric (InfraRequests ar) {
+ NetworkRequest qr = beansObjectFactory.createNetworkRequest ();
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (ar.getRequestId ());
+ ri.setAction (ActionType.fromValue (ar.getAction ()));
+ ri.setRequestStatus (RequestStatusType.fromValue (ar.getRequestStatus ()));
+ if (ar.getProgress () != null) {
+ ri.setProgress (ar.getProgress ().intValue ());
+ }
+ if (ar.getSource () != null) {
+ ri.setSource (ar.getSource ());
+ }
+
+ ri.setStartTime (ar.getStartTime ().toString ());
+ if (ar.getEndTime () != null) {
+ ri.setEndTime (ar.getEndTime ().toString ());
+ }
+
+ if (ar.getStatusMessage () != null) {
+ ri.setStatusMessage (ar.getStatusMessage ());
+ }
+ qr.setRequestInfo (ri);
+ return qr;
+ }
+
+ private List <NetworkRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
+ List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+
+ for (InfraRequests ar : arList) {
+ NetworkRequest qr = fillGeneric (ar);
+ fillNetworkRequest (qr, ar, version);
+ queryResponseList.add (qr);
+ }
+ return queryResponseList;
+ }
+
+ private String translateNetworkRequests (List <NetworkRequest> queryResponseList) {
+ NetworkRequests queryResponses = new NetworkRequests ();
+ for (int i = 0; i < queryResponseList.size (); i++) {
+ queryResponses.getNetworkRequest ().add (queryResponseList.get (i));
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequests.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (queryResponses, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ return stringWriter.toString ();
+ }
+
+ private String infraRequestsResponse (InfraRequests ar, String version) {
+ NetworkRequest qr = fillGeneric (ar);
+ fillNetworkRequest (qr, ar, version);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (qr, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ String response = stringWriter.toString ();
+ return response;
+ }
+}
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
new file mode 100644
index 0000000000..f35ddfbda8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
@@ -0,0 +1,619 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+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.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+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.xml.sax.InputSource;
+
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.networkbeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkInputs;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest;
+import org.openecomp.mso.apihandlerinfra.networkbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.networkbeans.RequestInfo;
+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.requestsdb.HibernateUtil;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+public class NetworkMsoInfraRequest {
+
+ private String requestId;
+ private String requestXML;
+ private String requestUri;
+ private RequestInfo rinfo;
+ private NetworkInputs networkInputs;
+ private String networkParams;
+ private ActionType action;
+ private String errorMessage;
+ private String httpResponse;
+ private String responseBody;
+ private RequestStatusType status;
+ private long startTime;
+ private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static final String NOT_PROVIDED = "not provided";
+
+ NetworkMsoInfraRequest (String requestId) {
+ this.requestId = requestId;
+ Calendar startTimeCalendar = Calendar.getInstance ();
+ this.startTime = startTimeCalendar.getTimeInMillis ();
+ MsoLogger.setLogContext (requestId, null);
+
+ }
+
+ // Parse request XML
+ void parse (String reqXML, String version, MsoJavaProperties props) throws ValidationException {
+
+ msoLogger.debug ("Validating the request");
+
+ this.requestXML = reqXML;
+
+ NetworkRequest networkReq = null;
+ boolean isWrongRootElement = false;
+
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequest.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (reqXML));
+ SAXSource source = new SAXSource (inputSource);
+
+ if (reqXML.contains ("network-request") && !reqXML.contains ("vnf-request")) {
+ networkReq = jaxbUnmarshaller.unmarshal (source, NetworkRequest.class).getValue ();
+ } else {
+ isWrongRootElement = true;
+ }
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_VNFREQUEST_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", e);
+ throw new ValidationException ("format for network request");
+ }
+
+ if (isWrongRootElement) {
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR_REASON, "root element is not correct", "", "", MsoLogger.ErrorCode.DataError, "root element <network-request> expected");
+ throw new ValidationException ("root element <network-request> expected");
+ }
+
+ if (networkReq == null) {
+ throw new ValidationException ("network-request");
+ }
+
+ this.rinfo = networkReq.getRequestInfo ();
+
+ if (this.rinfo == null) {
+ throw new ValidationException ("request-info");
+ }
+
+ action = this.rinfo.getAction ();
+ if (action == null) {
+ throw new ValidationException ("action");
+ }
+
+ if (!InfraUtils.isActionAllowed (props, "network", version, action.value ())) {
+ throw new ValidationException ("action allowable for version " + version + " of network request");
+ }
+
+ this.networkInputs = networkReq.getNetworkInputs ();
+ if (this.networkInputs == null) {
+ throw new ValidationException ("network-inputs");
+ }
+
+ // Verify that the elements correspond to the version
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null ||
+ this.networkInputs.getServiceInstanceId() != null) {
+ throw new ValidationException ("format for v1 version of network request");
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null ||
+ this.networkInputs.getServiceInstanceId() != null) {
+ throw new ValidationException ("format for v2 version of network request");
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) {
+ throw new ValidationException ("format for v3 version of network request");
+ }
+ }
+
+ switch (action) {
+ case UPDATE:
+ case DELETE:
+ if (this.networkInputs.getNetworkId () == null) {
+ throw new ValidationException ("network-id");
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (ActionType.CREATE.equals (action) && this.networkInputs.getNetworkName () == null) {
+ throw new ValidationException ("network-name");
+ }
+
+ if (this.networkInputs.getNetworkType () == null) {
+ throw new ValidationException ("network-type");
+ }
+
+ if (!version.equals(Constants.SCHEMA_VERSION_V1) && this.networkInputs.getServiceId () == null) {
+ throw new ValidationException ("service-id ");
+ }
+
+ if (this.networkInputs.getServiceType () != null && this.networkInputs.getServiceId () != null) {
+ throw new ValidationException ("service-type or service-id ");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1) && this.networkInputs.getAicNodeClli () == null) {
+ throw new ValidationException ("aic-node-clli");
+ }
+
+ if ((version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) && (this.networkInputs.getAicCloudRegion () == null || this.networkInputs.getAicCloudRegion ().isEmpty())) {
+ throw new ValidationException ("aic-cloud-region");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V3) && this.networkInputs.getServiceInstanceId () == null) {
+ throw new ValidationException ("service-instance-id");
+ }
+
+ if (ActionType.CREATE.equals (action)) {
+ if (this.networkInputs.getTenantId () == null) {
+ throw new ValidationException ("tenant-id");
+ }
+ }
+
+
+ Object vpN = networkReq.getNetworkParams ();
+
+ if (vpN != null) {
+ Node node = (Node) vpN;
+ Document doc = node.getOwnerDocument ();
+ this.networkParams = domToStr (doc);
+ }
+
+ msoLogger.debug ("NetworkParams: " + this.networkParams);
+
+ msoLogger.debug ("Request valid");
+
+ // Rebuild the request string for BPEL to include request-id
+ rinfo.setRequestId (this.requestId);
+ networkReq.setRequestInfo (rinfo);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (networkReq, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ this.requestXML = stringWriter.toString ().replace ("http://ecomp.att.com/mso/infra/network-request",
+ "http://ecomp.att.com/mso/infra/vnf-request");
+ msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML);
+
+ }
+
+ public void createRequestRecord (Status status) {
+
+ long startTime = System.currentTimeMillis ();
+
+ Session session = null;
+ try {
+
+ session = HibernateUtil.getSessionFactory ().openSession ();
+ session.beginTransaction ();
+
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ aq.setRequestId (requestId);
+
+ Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ if (rinfo != null) {
+ if (rinfo.getAction () != null) {
+ aq.setAction (rinfo.getAction ().value ());
+ aq.setRequestAction (RequestActionMap.getMappedRequestAction (rinfo.getAction ().value ()));
+ }
+ aq.setSource (rinfo.getSource ());
+ } else {
+ // Set up mandatory parameters
+ aq.setAction (NOT_PROVIDED);
+ aq.setRequestAction (NOT_PROVIDED);
+ }
+
+ aq.setRequestBody (this.requestXML);
+ aq.setRequestScope (ModelType.network.name ());
+
+ if (networkInputs != null) {
+ if (networkInputs.getNetworkId () != null) {
+ aq.setVnfId (networkInputs.getNetworkId ());
+ }
+ if (networkInputs.getNetworkName () != null) {
+ aq.setVnfName (networkInputs.getNetworkName ());
+ }
+ if (networkInputs.getNetworkType () != null) {
+ aq.setVnfType (networkInputs.getNetworkType ());
+ }
+ if (networkInputs.getServiceInstanceId () != null) {
+ aq.setServiceInstanceId (networkInputs.getServiceInstanceId ());
+ }
+ if (networkInputs.getServiceType () != null) {
+ aq.setServiceType (networkInputs.getServiceType ());
+ }
+ if (networkInputs.getServiceId () != null) {
+ aq.setServiceType (networkInputs.getServiceId ());
+ }
+ if (networkInputs.getAicNodeClli () != null) {
+ aq.setAicNodeClli (networkInputs.getAicNodeClli ());
+ }
+ if (networkInputs.getTenantId () != null) {
+ aq.setTenantId (networkInputs.getTenantId ());
+ }
+ if (networkInputs.getProvStatus () != null) {
+ aq.setProvStatus (networkInputs.getProvStatus ());
+ }
+
+ }
+ aq.setStartTime (startTimeStamp);
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+ aq.setRequestType ("NETWORK");
+
+ if (networkParams != null) {
+ msoLogger.debug ("Storing networkParams: " + networkParams);
+ aq.setVnfParams (this.networkParams);
+ }
+
+ if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
+ aq.setStatusMessage (this.errorMessage);
+ aq.setResponseBody (this.responseBody);
+
+ Calendar endTime = Calendar.getInstance ();
+ Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ aq.setEndTime (endTimeStamp);
+ }
+ aq.setProgress (this.progress);
+
+
+ msoLogger.debug ("About to insert a record");
+
+ session.save (aq);
+ session.getTransaction ().commit ();
+ session.close ();
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "saveRequest", null);
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in createRequestRecord", e);
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "RequestDB", "saveRequest", null);
+ if (session != null) {
+ session.close ();
+ }
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ }
+
+ public void updateFinalStatus (Status status) {
+ try {
+ RequestsDatabase.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.SchemaError, "Exception in updateFinalStatus");
+ msoLogger.debug ("Exception: ", e);
+ }
+ }
+
+ public Response buildResponse (int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
+ return buildResponseWithError (httpResponseCode, errorCode, inProgress, null);
+ }
+
+ public Response buildResponseWithError (int httpResponseCode,
+ String errorCode,
+ InfraActiveRequests inProgress,
+ String errorString) {
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ NetworkRequest vr = beansObjectFactory.createNetworkRequest ();
+
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+
+ ri.setRequestId (requestId);
+ ri.setRequestStatus (this.status);
+ ri.setAction (this.rinfo.getAction ());
+ ri.setSource (this.rinfo.getSource ());
+
+ String errorMsg = null;
+ if (errorCode != null) {
+ // If error code is actually an XML error response from BPEL, treat it specially:
+ if (!Messages.errors.containsKey (errorCode)) {
+ if (errorCode.length () > 300) {
+ errorMsg = errorCode.substring (0, 299);
+ } else {
+ errorMsg = errorCode;
+ }
+
+ } else {
+
+ if (inProgress == null) {
+ if (errorCode.equals (ErrorNumbers.RECIPE_DOES_NOT_EXIST)) {
+ errorMsg = String.format (Messages.errors.get (errorCode), "network", errorString);
+ } else {
+ errorMsg = String.format (Messages.errors.get (errorCode), errorString);
+ }
+ } else if (errorCode.equals (ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS)) {
+ errorMsg = String.format (Messages.errors.get (errorCode),
+ "network",
+ inProgress.getVnfName (),
+ inProgress.getRequestStatus (),
+ "network");
+ } else if (errorCode.equals (ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID)) {
+ errorMsg = String.format (Messages.errors.get (errorCode),
+ "network",
+ inProgress.getVnfId (),
+ inProgress.getRequestStatus (),
+ inProgress.getAction (),
+ "network");
+ }
+ }
+
+ ri.setStatusMessage (errorMsg);
+ this.errorMessage = errorMsg;
+ }
+ ri.setProgress ((int) this.progress);
+
+ Date startDate = new Date (this.startTime);
+ SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
+ String startTimeString = sdf.format (startDate);
+
+ ri.setStartTime (startTimeString);
+
+ vr.setRequestInfo (ri);
+ vr.setNetworkInputs (this.networkInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (vr, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ String response = stringWriter.toString ();
+
+ this.httpResponse = Integer.toString (httpResponseCode);
+ this.responseBody = response;
+
+ // Log the failed request into the MSO Requests database
+
+ return Response.status (httpResponseCode).entity (response).build ();
+
+ }
+
+ public Response buildResponseFailedValidation (int httpResponseCode, String exceptionMessage) {
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+ NetworkRequest vr = beansObjectFactory.createNetworkRequest ();
+
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (requestId);
+
+ if (this.rinfo != null) {
+ if (this.rinfo.getAction () != null) {
+ ri.setAction (this.rinfo.getAction ());
+ } else {
+ ri.setAction (ActionType.NOT_PROVIDED);
+ }
+ if (this.rinfo.getSource () != null) {
+ ri.setSource (this.rinfo.getSource ());
+ }
+ } else {
+ ri.setAction (ActionType.NOT_PROVIDED);
+ }
+
+ // Nothing more is expected for this request
+
+ String errorMsg = String.format (Messages.errors.get (ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION
+ + "_service"),
+ exceptionMessage);
+ ri.setStatusMessage (errorMsg);
+ this.errorMessage = errorMsg;
+
+ ri.setProgress ((int) this.progress);
+ ri.setRequestStatus (RequestStatusType.FAILED);
+ Date startDate = new Date (this.startTime);
+ SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
+ String startTimeString = sdf.format (startDate);
+
+ ri.setStartTime (startTimeString);
+
+ vr.setRequestInfo (ri);
+ vr.setNetworkInputs (this.networkInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (vr, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Error marshalling", e);
+ }
+
+ String response = stringWriter.toString ();
+
+ this.httpResponse = Integer.toString (httpResponseCode);
+ this.responseBody = response;
+
+ return Response.status (httpResponseCode).entity (response).build ();
+ }
+
+ public String getRequestUri () {
+ return requestUri;
+ }
+
+ public void setRequestUri (String requestUri) {
+ this.requestUri = requestUri;
+ }
+
+ public NetworkInputs getNetworkInputs () {
+ return networkInputs;
+ }
+
+ public RequestInfo getRequestInfo () {
+ return rinfo;
+ }
+
+ public String getResponseBody () {
+ return responseBody;
+ }
+
+ public void setResponseBody (String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+ public String getHttpResponse () {
+ return httpResponse;
+ }
+
+ public void setHttpResponse (String httpResponse) {
+ this.httpResponse = httpResponse;
+ }
+
+ public String getRequestId () {
+ return requestId;
+ }
+
+ public String getRequestXML () {
+ return requestXML;
+ }
+
+ public void setRequestXML (String requestXML) {
+ this.requestXML = requestXML;
+ }
+
+ public RequestStatusType getStatus () {
+ return status;
+ }
+
+ public void setStatus (RequestStatusType status) {
+ this.status = status;
+ switch (status) {
+ case FAILED:
+ case COMPLETE:
+ this.progress = Constants.PROGRESS_REQUEST_COMPLETED;
+ break;
+ case IN_PROGRESS:
+ this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS;
+ break;
+ }
+ }
+
+ public String getServiceType () {
+ if (this.networkInputs.getServiceType () != null)
+ return this.networkInputs.getServiceType ();
+ if (this.networkInputs.getServiceId () != null)
+ return this.networkInputs.getServiceId ();
+ return null;
+ }
+
+ public static String domToStr (Document doc) {
+ if (doc == null) {
+ return null;
+ }
+
+ try {
+ StringWriter sw = new StringWriter ();
+ StreamResult sr = new StreamResult (sw);
+ TransformerFactory tf = TransformerFactory.newInstance ();
+ Transformer t = tf.newTransformer ();
+ t.setOutputProperty (OutputKeys.STANDALONE, "yes");
+ NodeList nl = doc.getDocumentElement ().getChildNodes ();
+ DOMSource source = null;
+ for (int x = 0; x < nl.getLength (); x++) {
+ Node e = nl.item (x);
+ if (e instanceof Element) {
+ source = new DOMSource (e);
+ break;
+ }
+ }
+ if (source != null) {
+ t.transform (source, sr);
+
+ String s = sw.toString ();
+ return s;
+ }
+
+ return null;
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in domToStr", e);
+ }
+ return null;
+ }
+}
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
new file mode 100644
index 0000000000..8d44d213b1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
@@ -0,0 +1,667 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+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.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.sax.SAXSource;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.xml.sax.InputSource;
+
+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.networkbeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkInputs;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkOutputs;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest;
+import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequests;
+import org.openecomp.mso.apihandlerinfra.networkbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.networkbeans.RequestInfo;
+import org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Recipe;
+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.InfraRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/{version: v1|v2|v3}/network-request")
+public class NetworkRequestHandler {
+
+ @Context
+ private UriInfo uriInfo;
+
+ protected ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties ();
+
+ private static final String NOT_FOUND = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Started</title></head><body>Application not started, properties file missing or invalid or Database Connection failed</body></html>";
+
+ private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
+ .entity (NOT_FOUND)
+ .build ();
+
+ @GET
+ public Response queryFilters (@QueryParam("network-type") String networkType,
+ @QueryParam("service-type") String serviceType,
+ @QueryParam("aic-node-clli") String aicNodeClli,
+ @QueryParam("tenant-id") String tenantId,
+ @PathParam("version") String version) {
+ MsoLogger.setServiceName ("QueryFilters");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+
+ msoLogger.debug ("Incoming request received for query filters with Network type " + networkType
+ + " - service type "
+ + serviceType
+ + " - aicNodeClli "
+ + aicNodeClli
+ + " - tenant id "
+ + tenantId);
+ Response response = null;
+ if (networkType != null) {
+ response = this.getRequestList ("vnfType", networkType, version);
+ } else {
+ response = queryGenericFilters (serviceType, aicNodeClli, tenantId, version);
+ }
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ @GET
+ @Path(Constants.REQUEST_ID_PATH)
+ public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+ MsoLogger.setServiceName ("GetRequest");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getRequest with requestId=" + requestId + ", version = " + version);
+ long startTime = System.currentTimeMillis ();
+
+ Response response = getRequestGeneric (requestId, version);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+ protected void fillNetworkRequest (NetworkRequest qr, InfraRequests ar, String version) {
+ NetworkInputs vi = beansObjectFactory.createNetworkInputs ();
+
+ if (ar.getVnfId () != null) {
+ vi.setNetworkId (ar.getVnfId ());
+ }
+ if (ar.getVnfName () != null) {
+ vi.setNetworkName (ar.getVnfName ());
+ }
+ if (ar.getVnfType () != null) {
+ vi.setNetworkType (ar.getVnfType ());
+ }
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (ar.getServiceType () != null) {
+ vi.setServiceType (ar.getServiceType ());
+ }
+ if (ar.getAicNodeClli () != null) {
+ vi.setAicNodeClli (ar.getAicNodeClli ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getServiceInstanceId () != null) {
+ vi.setServiceInstanceId (ar.getServiceInstanceId ());
+ }
+
+ }
+
+ if (ar.getTenantId () != null) {
+ vi.setTenantId (ar.getTenantId ());
+ }
+ if (ar.getProvStatus () != null) {
+ vi.setProvStatus (ar.getProvStatus ());
+ }
+ qr.setNetworkInputs (vi);
+
+ qr.setNetworkParams (ar.getVnfParams ());
+
+ try {
+ String networkoutputs = ar.getVnfOutputs ();
+ if (networkoutputs != null && networkoutputs.length () > 0) {
+ msoLogger.debug ("Read NETWORK outputs: " + networkoutputs);
+ NetworkOutputs networkOutput = null;
+
+ // Now unmarshal it into network outputs
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkOutputs.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (networkoutputs));
+ SAXSource source = new SAXSource (inputSource);
+
+ networkOutput = jaxbUnmarshaller.unmarshal (source, NetworkOutputs.class).getValue ();
+
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed", e);
+ throw new ValidationException ("format for network outputs");
+ }
+
+ qr.setNetworkOutputs (networkOutput);
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("exception reading networkOutputs Clob", e);
+ }
+ }
+
+ protected Response queryGenericFilters (String serviceType, String aicNodeClli, String tenantId, String version) {
+ if (serviceType != null) {
+ return this.getRequestList ("serviceType", serviceType, version);
+ }
+ if (aicNodeClli != null) {
+ return this.getRequestList ("aicNodeClli", aicNodeClli, version);
+ }
+ if (tenantId != null) {
+ return this.getRequestList ("tenantId", tenantId, version);
+ }
+ return Response.status (HttpStatus.SC_BAD_REQUEST).entity ("").build ();
+ }
+
+ protected Response getRequestGeneric (String requestId, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+ MsoLogger.setLogContext (requestId, null);
+ getMsoLogger ().debug ("getRequest: " + requestId);
+
+ String responseString = null;
+
+ InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, "NETWORK");
+ if (activeReq != null) {
+ // build response for active
+ responseString = infraRequestsResponse (activeReq, version);
+ return Response.status (HttpStatus.SC_OK).entity (responseString).build ();
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ protected Response getRequestList (String queryAttribute, String queryValue, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
+
+ List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ queryValue,
+ "NETWORK");
+
+ List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+
+ if (activeReqList != null) {
+ // build response for active
+ queryResponseList = infraRequestsResponses (activeReqList, version);
+
+ }
+
+ if (queryResponseList != null && !queryResponseList.isEmpty ()) {
+ String result = this.translateNetworkRequests (queryResponseList);
+ return Response.status (HttpStatus.SC_OK).entity (result).build ();
+
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ private NetworkRequest fillGeneric (InfraRequests ar) {
+ NetworkRequest qr = beansObjectFactory.createNetworkRequest ();
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (ar.getRequestId ());
+ ri.setAction (ActionType.fromValue (ar.getAction ()));
+ ri.setRequestStatus (RequestStatusType.fromValue (ar.getRequestStatus ()));
+ if (ar.getProgress () != null) {
+ ri.setProgress (ar.getProgress ().intValue ());
+ }
+ if (ar.getSource () != null) {
+ ri.setSource (ar.getSource ());
+ }
+
+ ri.setStartTime (ar.getStartTime ().toString ());
+ if (ar.getEndTime () != null) {
+ ri.setEndTime (ar.getEndTime ().toString ());
+ }
+
+ if (ar.getStatusMessage () != null) {
+ ri.setStatusMessage (ar.getStatusMessage ());
+ }
+ qr.setRequestInfo (ri);
+ return qr;
+ }
+
+ private List <NetworkRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
+ List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+
+ for (InfraRequests ar : arList) {
+ NetworkRequest qr = fillGeneric (ar);
+ fillNetworkRequest (qr, ar, version);
+ queryResponseList.add (qr);
+ }
+ return queryResponseList;
+ }
+
+ private String translateNetworkRequests (List <NetworkRequest> queryResponseList) {
+ NetworkRequests queryResponses = new NetworkRequests ();
+ for (int i = 0; i < queryResponseList.size (); i++) {
+ queryResponses.getNetworkRequest ().add (queryResponseList.get (i));
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequests.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (queryResponses, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ return stringWriter.toString ();
+ }
+
+ private String infraRequestsResponse (InfraRequests ar, String version) {
+ NetworkRequest qr = fillGeneric (ar);
+ fillNetworkRequest (qr, ar, version);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (qr, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ String response = stringWriter.toString ();
+ return response;
+ }
+
+ @POST
+ @Path("/")
+ @Produces(MediaType.APPLICATION_XML)
+ public Response manageNetworkRequest (String reqXML, @PathParam("version") String version) {
+ MsoLogger.setServiceName ("NetworkRequest");
+ if ("v1".equals(version)) {
+ return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1);
+ } else if ("v2".equals(version)) {
+ return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2);
+ } else if ("v3".equals(version)) {
+ return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3);
+ } else {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Version not found");
+ return Response.status(HttpStatus.SC_NOT_FOUND).build();
+ }
+ }
+
+ private Response manageNetworkRequestImpl (String reqXML, String version) {
+ String methodName = "NetworkRequest";
+
+ props = MsoPropertiesUtils.loadMsoProperties ();
+
+ long startTime = System.currentTimeMillis ();
+ if (MsoPropertiesUtils.getNoPropertiesState()) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application not started, properties file missing or invalid");
+ return NOT_STARTED_RESPONSE;
+ }
+ uriInfo.getRequestUri ();
+
+ // Generate unique request id for the new request
+ UUID requestUUID = UUID.randomUUID ();
+
+ NetworkMsoInfraRequest msoRequest = new NetworkMsoInfraRequest (requestUUID.toString ());
+ MsoLogger.setLogContext (msoRequest.getRequestId (), null);
+
+ if (reqXML == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The input Request is null");
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ String requestUri = uriInfo.getRequestUri ().toString ();
+
+ msoLogger.debug ("Incoming Request: " + reqXML);
+
+ msoRequest.setRequestUri (requestUri);
+ msoLogger.debug ("Schema version: " + version);
+ try {
+ msoRequest.parse (reqXML, version, props);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ());
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", 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;
+ }
+ MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ if (msoRequest.getRequestInfo ()
+ .getAction () == org.openecomp.mso.apihandlerinfra.networkbeans.ActionType.CREATE) {
+ // Check if this request is a duplicate of the one with the same network Name
+ msoLogger.debug ("Checking for a duplicate with the same network-name");
+ InfraActiveRequests dup = null;
+ try {
+
+ dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "NETWORK");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "network-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ "CREATE on the same Network Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same Network Name is already progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same Network Name is already progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ } else {
+ // Check if this request is a duplicate of the one with the same networkId
+ InfraActiveRequests dup = null;
+ msoLogger.debug ("Checking for a duplicate with the same network-id");
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "NETWORK");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "network-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the same network-id", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the same network-id");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ msoRequest.getRequestInfo ().getAction ().value ()
+ + " on the same Network Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same Network Id already in progress");
+
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same Network Id already in progress.");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ String orchestrationURI = "";
+
+ // Query MSO Catalog DB
+ try (CatalogDatabase db = new CatalogDatabase()) {
+
+ Recipe recipe = null;
+
+ if (msoRequest.getServiceType () != null
+ && msoRequest.getServiceType ().length () > 0) {
+ recipe = db.getNetworkRecipe (msoRequest.getNetworkInputs ().getNetworkType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ msoRequest.getServiceType ());
+
+ }
+ if (recipe == null) {
+ recipe = db.getNetworkRecipe (msoRequest.getNetworkInputs ().getNetworkType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ }
+
+ if (recipe == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "VNF Recipe attribute not found");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ null,
+ "");
+ msoRequest.createRequestRecord (Status.FAILED);
+ db.close ();
+ 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;
+ }
+ orchestrationURI = recipe.getOrchestrationUri ();
+ msoLogger.debug ("Orchestration URI is: " + orchestrationURI);
+
+ db.close ();
+
+ String requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.DataError, "Exception while creating record in DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ null,
+ "non-unique request-id specified");
+ // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try
+ // to create a failed record
+ 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 (orchestrationURI, props);
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+ response = requestClient.post (msoRequest.getRequestXML (),
+ requestId,
+ Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ version,
+ null,
+ null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_COMMUNICATION_TO_BPEL,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e);
+ 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.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_RESPONSE_FROM_BPEL,
+ null,
+ "bpelResponse is null");
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.DataError, "bpelResponse is null");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is null");
+ 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 bpelXMLResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.IN_PROGRESS);
+ RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ Status.IN_PROGRESS.toString (),
+ Constants.PROGRESS_REQUEST_IN_PROGRESS,
+ Constants.MODIFIED_BY_APIHANDLER);
+ Response resp = msoRequest.buildResponse (bpelStatus, null, null);
+ 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) resp.getEntity ());
+ return resp;
+ } else {
+
+ String bpelXMLResponseBody = respHandler.getResponseBody ();
+ if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", 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 with status Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", 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;
+ }
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ 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;
+ }
+ }
+}
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
new file mode 100644
index 0000000000..f89cae988a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.io.StringWriter;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+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.utils.UUIDChecker;
+
+@Path(Constants.NETWORK_TYPES_PATH)
+public class NetworkTypesHandler {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ @GET
+ public Response getNetworkTypes () {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("getNetworkTypes");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getNetworkTypes");
+
+ List <NetworkResource> networkResources = null;
+ try (CatalogDatabase db = new CatalogDatabase()){
+ networkResources = db.getAllNetworkResources ();
+ } catch (Exception e) {
+ msoLogger.debug ("No connection to catalog DB", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "no connection to catalog DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + e.toString ());
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity (e.toString ()).build ();
+ }
+
+ if (networkResources == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "NetworkType not found");
+ msoLogger.debug ("End of the transaction. NetworkType not found the final response status: " + HttpStatus.SC_NOT_FOUND);
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+ NetworkTypes networkTypes = beansObjectFactory.createNetworkTypes ();
+ for (int i = 0; i < networkResources.size (); i++) {
+ NetworkType networkType = beansObjectFactory.createNetworkType ();
+ NetworkResource vr = networkResources.get (i);
+ networkType.setType (vr.getNetworkType ());
+ networkType.setDescription (vr.getDescription ());
+ networkType.setId (String.valueOf (vr.getId ()));
+ networkTypes.getNetworkType ().add (networkType);
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (NetworkTypes.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (networkTypes, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Error marshalling", e);
+ }
+
+ String response = stringWriter.toString ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + response);
+ return Response.status (HttpStatus.SC_OK).entity (response).build ();
+ }
+}
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
new file mode 100644
index 0000000000..00104daaf6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
@@ -0,0 +1,251 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+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;
+import javax.ws.rs.core.Response;
+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.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.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("/orchestrationRequests/v2")
+public class OrchestrationRequests {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ /**
+ *
+ */
+ public OrchestrationRequests() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @GET
+ @Path("/{requestId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getOrchestrationRequest(@PathParam("requestId") String requestId) {
+
+ GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
+
+ MsoRequest msoRequest = new MsoRequest (requestId);
+
+ long startTime = System.currentTimeMillis ();
+
+ InfraActiveRequests requestDB = null;
+
+ try {
+ requestDB = RequestsDatabase.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);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ e.getMessage (),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+ if(requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+
+ orchestrationResponse.setRequest(request);
+
+ return Response.status(200).entity(orchestrationResponse).build();
+ }
+
+ @GET
+ @Path("/")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getOrchestrationRequest(@Context UriInfo ui) {
+
+ long startTime = System.currentTimeMillis ();
+
+ MsoRequest msoRequest = new MsoRequest();
+
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+
+ List<InfraActiveRequests> activeRequests = null;
+
+ GetOrchestrationListResponse orchestrationList = null;
+
+
+ try{
+
+ Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams);
+
+ activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap);
+
+ orchestrationList = new GetOrchestrationListResponse();
+
+ List<RequestList> requestLists = new ArrayList<RequestList>();
+
+ for(InfraActiveRequests infraActive : activeRequests){
+
+ Request request = mapInfraActiveRequestToRequest(infraActive);
+ RequestList requestList = new RequestList();
+ requestList.setRequest(request);
+
+ requestLists.add(requestList);
+
+ }
+
+ orchestrationList.setRequestList(requestLists);
+
+ }catch(Exception e){
+ msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ "Get Orchestration Request with Filters Failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+
+ return Response.status(200).entity(orchestrationList).build();
+ }
+
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
+
+
+ Request request = new Request();
+
+ ObjectMapper mapper = new ObjectMapper();
+ // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+
+ request.setRequestId(requestDB.getRequestId());
+ request.setRequestScope(requestDB.getRequestScope());
+ request.setRequestType(requestDB.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if(requestDB.getNetworkId() != null)
+ ir.setNetworkInstanceId(requestDB.getNetworkId());
+ if(requestDB.getNetworkName() != null)
+ ir.setNetworkInstanceName(requestDB.getNetworkName());
+ if(requestDB.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(requestDB.getServiceInstanceId());
+ if(requestDB.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(requestDB.getServiceInstanceName());
+ if(requestDB.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(requestDB.getVfModuleId());
+ if(requestDB.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(requestDB.getVfModuleName());
+ if(requestDB.getVnfId() != null)
+ ir.setVnfInstanceId(requestDB.getVnfId());
+ if(requestDB.getVnfName() != null)
+ ir.setVnfInstanceName(requestDB.getVnfName());
+ if(requestDB.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId());
+ if(requestDB.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName());
+
+
+ request.setInstanceReferences(ir);
+
+ String requestBody = requestDB.getRequestBody();
+
+ RequestDetails requestDetails = null;
+
+ try{
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+
+ }catch(Exception e){
+ msoLogger.debug("Exception caught mapping requestBody to RequestDetails");
+ }
+
+ request.setRequestDetails(requestDetails);
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT";
+ request.setStartTime(startTimeStamp);
+
+ RequestStatus status = new RequestStatus();
+ if(requestDB.getStatusMessage() != null){
+ status.setStatusMessage(requestDB.getStatusMessage());
+ }
+
+ if(requestDB.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT";
+ status.setFinishTime(endTimeStamp);
+ }
+
+
+ if(requestDB.getRequestStatus() != null){
+ status.setRequestState(requestDB.getRequestStatus());
+ }
+
+ if(requestDB.getProgress() != null){
+ status.setPercentProgress(requestDB.getProgress().intValue());
+ }
+
+ request.setRequestStatus(status);
+
+ return request;
+ }
+ }
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
new file mode 100644
index 0000000000..234f4068e3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+public class RecipeLookupResult {
+
+ private String orchestrationURI;
+ private int recipeTimeout;
+
+ public RecipeLookupResult(String orchestrationURI, int recipeTimeout) {
+ this.orchestrationURI = orchestrationURI;
+ this.recipeTimeout = recipeTimeout;
+ }
+
+ public String getOrchestrationURI () {
+ return orchestrationURI;
+ }
+
+ public void setOrchestrationURI (String orchestrationURI) {
+ this.orchestrationURI = orchestrationURI;
+ }
+
+ public int getRecipeTimeout () {
+ return recipeTimeout;
+ }
+
+ public void setRecipeTimeout (int recipeTimeout) {
+ this.recipeTimeout = recipeTimeout;
+ }
+}
+
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
new file mode 100644
index 0000000000..940fcc9c57
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * Map of actions to RequestActions
+*/
+public class RequestActionMap {
+ private static final Map<String, String> actionMap;
+
+ static {
+ actionMap = new HashMap<String, String>();
+ actionMap.put("CREATE_VF_MODULE", "createInstance");
+ actionMap.put("DELETE_VF_MODULE", "deleteInstance");
+ actionMap.put("UPDATE_VF_MODULE", "updateInstance");
+ actionMap.put("CREATE_VF_MODULE_VOL", "createInstance");
+ actionMap.put("DELETE_VF_MODULE_VOL", "deleteInstance");
+ actionMap.put("UPDATE_VF_MODULE_VOL", "updateInstance");
+ actionMap.put("CREATE", "createInstance");
+ actionMap.put("DELETE", "deleteInstance");
+ actionMap.put("UPDATE", "updateInstance");
+ actionMap.put("createInstance", "createInstance");
+ actionMap.put("deleteInstance", "deleteInstance");
+ actionMap.put("updateInstance", "updateInstance");
+
+ }
+
+ public static String getMappedRequestAction(String action) {
+ return actionMap.get(action);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java
new file mode 100644
index 0000000000..bfea00fad6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java
@@ -0,0 +1,2102 @@
+package org.openecomp.mso.apihandlerinfra;
+
+/*-
+ * #%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%
+ */
+
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.openecomp.mso.HealthCheckUtils;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig.Feature;
+
+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.GetOrchestrationListResponse;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestError;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus;
+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.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.VnfComponentsRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+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("/")
+public class RequestHandler {
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory ();
+
+ @Context
+ private UriInfo uriInfo;
+
+ private static final String NOT_FOUND = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Started</title></head><body>Application not started, properties file missing or invalid or Database Connection failed</body></html>";
+
+ private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
+ .entity (NOT_FOUND)
+ .build ();
+
+ private static boolean noProperties = true;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ @Context
+ private ServletContext sc;
+
+ private static MsoJavaProperties props = loadMsoProperties ();
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+
+ @HEAD
+ @GET
+ @Path("/healthcheck")
+ @Produces("text/html")
+ public Response healthcheck (@QueryParam("requestId") String requestId) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("Healthcheck");
+ UUIDChecker.verifyOldUUID(requestId, msoLogger);
+ HealthCheckUtils healthCheck = new HealthCheckUtils ();
+ if (!healthCheck.siteStatusCheck(msoLogger, startTime)) {
+ return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
+ }
+
+ if (!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_APIHANDLER_INFRA)) {
+ return HealthCheckUtils.NOT_STARTED_RESPONSE;
+ }
+
+ if (!healthCheck.requestDBCheck (msoLogger, startTime)) {
+ return HealthCheckUtils.NOT_STARTED_RESPONSE;
+ }
+ msoLogger.debug("healthcheck - Successful");
+ return HealthCheckUtils.HEALTH_CHECK_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;
+ }
+ }
+
+ private static MsoJavaProperties loadMsoProperties () {
+ MsoJavaProperties msoProperties;
+ try {
+ msoProperties = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_APIHANDLER_INFRA);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO Properties", e);
+ return null;
+ }
+
+ if (msoProperties != null && msoProperties.size () > 0) {
+ noProperties = false;
+ msoLogger.info (MessageEnum.APIH_PROPERTY_LOAD_SUC, "", "");
+ return msoProperties;
+ } else {
+ msoLogger.error (MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No MSO APIH_INFRA Properties found");
+ return null;
+ }
+ }
+
+ @POST
+ @Path("/serviceInstances/v2")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createServiceInstance(String request) {
+
+ Response response = serviceInstances(request, Action.createInstance, null);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/serviceInstances/v2/{serviceInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteServiceInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+ return response;
+ }
+
+ @POST
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @POST
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response updateVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+
+ @POST
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response updateVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
+
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
+
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @POST
+ @Path("/serviceInstances/v2/{serviceInstanceId}/networks")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/serviceInstances/v2/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response updateNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/serviceInstances/v2/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+
+
+ private Response serviceInstances(String requestJSON, Action action, HashMap<String,String> instanceIdMap) {
+
+ 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);
+ } 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 {
+ 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);
+
+ try (CatalogDatabase db = new CatalogDatabase()) {
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, 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;
+ }
+
+ 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 (), requestJSON);
+
+ 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, MSO_PROP_APIHANDLER_INFRA, "", "", 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, MSO_PROP_APIHANDLER_INFRA, "", "", 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;
+ } 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;
+ }
+ }
+
+ @GET
+ @Path("/orchestrationRequests/v2/{requestId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getOrchestrationRequest(@PathParam("requestId") String requestId) {
+
+ GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
+
+ MsoRequest msoRequest = new MsoRequest (requestId);
+
+ long startTime = System.currentTimeMillis ();
+
+ InfraActiveRequests requestDB = null;
+
+ try {
+ requestDB = RequestsDatabase.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);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ e.getMessage (),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+ if(requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+
+ orchestrationResponse.setRequest(request);
+
+ return Response.status(200).entity(orchestrationResponse).build();
+ }
+
+ @GET
+ @Path("/orchestrationRequests/v2")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getOrchestrationRequest(@Context UriInfo ui) {
+
+ long startTime = System.currentTimeMillis ();
+
+ MsoRequest msoRequest = new MsoRequest();
+
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+
+ List<InfraActiveRequests> activeRequests = null;
+
+ GetOrchestrationListResponse orchestrationList = null;
+
+
+ try{
+
+ Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams);
+
+ activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap);
+
+ orchestrationList = new GetOrchestrationListResponse();
+
+ List<RequestList> requestLists = new ArrayList<RequestList>();
+
+ for(InfraActiveRequests infraActive : activeRequests){
+
+ Request request = mapInfraActiveRequestToRequest(infraActive);
+ RequestList requestList = new RequestList();
+ requestList.setRequest(request);
+
+ requestLists.add(requestList);
+
+ }
+
+ orchestrationList.setRequestList(requestLists);
+
+ }catch(Exception e){
+ msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ "Get Orchestration Request with Filters Failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+
+ return Response.status(200).entity(orchestrationList).build();
+ }
+
+ @POST
+ @Path("/v3/vnf-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageVnfRequestV3 (String reqXML) {
+ // Set logger parameters
+ MsoLogger.setServiceName ("VnfRequest");
+ return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3);
+ }
+
+
+ @POST
+ @Path("/v2/vnf-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageVnfRequestV2 (String reqXML) {
+ // Set logger parameters
+ MsoLogger.setServiceName ("VnfRequest");
+ return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2);
+ }
+
+ @POST
+ @Path("/v1/vnf-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageVnfRequestV1 (String reqXML) {
+
+ // Set logger parameters
+ MsoLogger.setServiceName ("VnfRequest");
+
+ return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1);
+ }
+
+ @POST
+ @Path("/v3/network-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageNetworkRequestV3 (String reqXML) {
+
+ // Set logger parameters
+ MsoLogger.setServiceName ("NetworkRequest");
+
+ return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3);
+ }
+
+ @POST
+ @Path("/v2/network-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageNetworkRequestV2 (String reqXML) {
+
+ // Set logger parameters
+ MsoLogger.setServiceName ("NetworkRequest");
+
+ return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2);
+ }
+
+ @POST
+ @Path("/v1/network-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageNetworkRequestV1 (String reqXML) {
+
+ // Set logger parameters
+ MsoLogger.setServiceName ("NetworkRequest");
+
+ return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1);
+ }
+
+ @POST
+ @Path("/v3/volume-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageVolumeRequestV3 (String reqXML) {
+ // Set logger parameters
+ MsoLogger.setServiceName ("VolumeRequest");
+ return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3);
+ }
+
+ @POST
+ @Path("/v2/volume-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageVolumeRequestV2 (String reqXML) {
+ // Set logger parameters
+ MsoLogger.setServiceName ("VolumeRequest");
+ return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2);
+ }
+
+ @POST
+ @Path("/v1/volume-request")
+ @Consumes("*/*")
+ @Produces("application/xml")
+ public Response manageVolumeRequestV1 (String reqXML) {
+
+ // Set logger parameters
+ MsoLogger.setServiceName ("VolumeRequest");
+
+ return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1);
+ }
+
+
+ private Response manageVnfRequestImpl (String reqXML, String version) {
+ String methodName = "VnfRequest";
+ props = loadMsoProperties ();
+ long startTime = System.currentTimeMillis ();
+
+ // Generate unique request id for the new request
+ UUID requestUUID = UUID.randomUUID ();
+
+ VnfMsoInfraRequest msoRequest = new VnfMsoInfraRequest (requestUUID.toString ());
+ MsoLogger.setLogContext (msoRequest.getRequestId (), null);
+
+ if (noProperties) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exiting the transaction: Infra API Handler not started, properties file missing or invalid");
+ return NOT_STARTED_RESPONSE;
+ }
+
+ uriInfo.getRequestUri ();
+
+ if (reqXML == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The content of the request is null");
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ String requestUri = uriInfo.getRequestUri ().toString ();
+ msoLogger.debug ("Incoming request received for pose VNFRequest:" + reqXML);
+
+ msoRequest.setRequestUri (requestUri);
+ msoLogger.debug ("Schema version: " + version);
+ try {
+ msoRequest.parse (reqXML, version, props);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ());
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.SchemaError, "Exception when parsing reqXML", 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;
+ }
+ MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ if (msoRequest.getRequestInfo ().getAction () == org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType.CREATE) {
+ // Check if this request is a duplicate of the one with the same vnfName
+ msoLogger.debug ("Checking for a duplicate with the same vnf-name");
+ InfraActiveRequests dup = null;
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VNF");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "vnf-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, "CREATE on the same VNF Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same VNF Name is already progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same VNF Name is already progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ } else {
+ // Check if this request is a duplicate of the one with the same vnfId
+ InfraActiveRequests dup = null;
+ msoLogger.debug ("Checking for a duplicate with the same vnf-id");
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VNF");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "vnf-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the same vnf-id", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the same vnf-id");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ msoRequest.getRequestInfo ().getAction ().value ()
+ + " on the same VNF Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same VNF Id already in progress");
+
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same VNF Id already in progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ String orchestrationURI = "";
+
+ try (CatalogDatabase db = new CatalogDatabase()) {
+
+ Recipe recipe = null;
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ // First get recipe for the service type given
+ if (msoRequest.getServiceType () != null
+ && msoRequest.getServiceType ().length () > 0) {
+ recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ msoRequest.getServiceType ());
+ }
+ // If no recipe for the service type or no service type was given, look for recipe without service type
+ if (recipe == null) {
+ recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ }
+ }
+ if (version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) {
+ switch (msoRequest.getRequestInfo ().getAction ()) {
+ case CREATE:
+ case UPDATE:
+ case DELETE:
+ // First get recipe for the vnf type given
+ recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ msoRequest.getRequestInfo ().getAction ().value ());
+
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfRecipe (Constants.VNF_TYPE_WILDCARD,
+ msoRequest.getRequestInfo ().getAction ().value ());
+ }
+ break;
+ case CREATE_VF_MODULE:
+ case UPDATE_VF_MODULE:
+ case DELETE_VF_MODULE:
+ // First get recipe for the vnf type/vf module model name through vf module id query
+ recipe = db.getVfModuleRecipe (msoRequest.getVnfInputs ().getVnfType (), msoRequest.getVnfInputs ().getVfModuleModelName (),
+ msoRequest.getRequestInfo ().getAction ().value ());
+
+ // If no recipe is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfRecipeByVfModuleId (msoRequest.getVnfInputs ().getVfModuleId (),
+ Constants.VNF_TYPE_WILDCARD, msoRequest.getRequestInfo ().getAction ().value ());
+ }
+ // First get recipe for the vnf type given
+ //recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ // msoRequest.getRequestInfo ().getAction ().value ());
+
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ //if (recipe == null) {
+ // recipe = db.getVnfRecipe (Constants.VNF_TYPE_WILDCARD,
+ // msoRequest.getRequestInfo ().getAction ().value ());
+ //
+ //}
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ if (recipe == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ null,
+ "");
+ msoRequest.createRequestRecord (Status.FAILED);
+ db.close ();
+ 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;
+ }
+ orchestrationURI = recipe.getOrchestrationUri ();
+ msoLogger.debug ("Orchestration URI is: " + orchestrationURI);
+
+ // Retrieve additional info for Vf Modules from Catalog DB to send it to BPMN
+ switch (msoRequest.getRequestInfo ().getAction ()) {
+ case CREATE_VF_MODULE:
+ case UPDATE_VF_MODULE:
+ String personaModelId = "";
+ String personaModelVersion = "";
+ String vnfPersonaModelId = "";
+ String vnfPersonaModelVersion = "";
+ Boolean isBase = false;
+ String asdcServiceModelVersion = msoRequest.getVnfInputs ().getAsdcServiceModelVersion ();
+
+ // Get VF Module-specific persona info and base module indicator
+ VfModule vfm = null;
+ String vfModuleType = msoRequest.getVnfInputs ().getVnfType () + "::" + msoRequest.getVnfInputs ().getVfModuleModelName ();
+ if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
+ vfm = db.getVfModuleType (vfModuleType, asdcServiceModelVersion);
+ }
+ else {
+ vfm = db.getVfModuleType (vfModuleType);
+ }
+ if (vfm != null) {
+ if (vfm.getIsBase() == 1) {
+ isBase = true;
+ }
+ personaModelId = vfm.getModelInvariantUuid();
+ personaModelVersion = vfm.getModelVersion();
+ msoLogger.debug("Setting personaModelId to " + personaModelId +
+ ", personaModelVersion to " + personaModelVersion);
+ }
+ // Get VNF-specific persona info
+ VnfResource vnfr = null;
+ if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
+ vnfr = db.getVnfResource (msoRequest.getVnfInputs ().getVnfType (), asdcServiceModelVersion);
+ }
+ else {
+ vnfr = db.getVnfResource (msoRequest.getVnfInputs ().getVnfType ());
+ }
+ if (vnfr != null) {
+ vnfPersonaModelId = vnfr.getModelInvariantUuid ();
+ vnfPersonaModelVersion = vnfr.getModelVersion();
+ msoLogger.debug("Setting vnfPersonaModelId to " + vnfPersonaModelId +
+ ", vnfPersonaModelVersion to " + vnfPersonaModelVersion);
+ }
+
+ msoRequest.addBPMNSpecificInputs(personaModelId, personaModelVersion, isBase,
+ vnfPersonaModelId, vnfPersonaModelVersion);
+
+ break;
+ default:
+ break;
+ }
+
+ db.close ();
+
+ String requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING);
+ } 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.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ null,
+ "non-unique request-id specified");
+ // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try
+ // to create a failed record
+ 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;
+ }
+
+ msoLogger.debug("Request going to BPEL: " + msoRequest.getRequestXML ());
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+ try {
+ requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props);
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+ response = requestClient.post (msoRequest.getRequestXML (),
+ requestId,
+ Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ version,
+ null,
+ null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_COMMUNICATION_TO_BPEL,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e);
+ 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.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_RESPONSE_FROM_BPEL,
+ null,
+ "bpelResponse is null");
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "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 bpelXMLResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
+ 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);
+ Response resp = msoRequest.buildResponse (bpelStatus, null, null);
+ 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) resp.getEntity ());
+ return resp;
+ } else {
+
+ String bpelXMLResponseBody = respHandler.getResponseBody ();
+ if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", 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.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", 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;
+ }
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ 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;
+ }
+ }
+
+ private Response manageNetworkRequestImpl (String reqXML, String version) {
+ String methodName = "NetworkRequest";
+
+ props = loadMsoProperties ();
+
+ long startTime = System.currentTimeMillis ();
+ if (noProperties) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application not started, properties file missing or invalid");
+ return NOT_STARTED_RESPONSE;
+ }
+ uriInfo.getRequestUri ();
+
+ // Generate unique request id for the new request
+ UUID requestUUID = UUID.randomUUID ();
+
+ NetworkMsoInfraRequest msoRequest = new NetworkMsoInfraRequest (requestUUID.toString ());
+ MsoLogger.setLogContext (msoRequest.getRequestId (), null);
+
+ if (reqXML == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The input Request is null");
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ String requestUri = uriInfo.getRequestUri ().toString ();
+
+ msoLogger.debug ("Incoming Request: " + reqXML);
+
+ msoRequest.setRequestUri (requestUri);
+ msoLogger.debug ("Schema version: " + version);
+ try {
+ msoRequest.parse (reqXML, version, props);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ());
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", 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;
+ }
+ MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ if (msoRequest.getRequestInfo ()
+ .getAction () == org.openecomp.mso.apihandlerinfra.networkbeans.ActionType.CREATE) {
+ // Check if this request is a duplicate of the one with the same network Name
+ msoLogger.debug ("Checking for a duplicate with the same network-name");
+ InfraActiveRequests dup = null;
+ try {
+
+ dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "NETWORK");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "network-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ "CREATE on the same Network Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same Network Name is already progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same Network Name is already progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ } else {
+ // Check if this request is a duplicate of the one with the same networkId
+ InfraActiveRequests dup = null;
+ msoLogger.debug ("Checking for a duplicate with the same network-id");
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "NETWORK");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "network-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the same network-id", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the same network-id");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ msoRequest.getRequestInfo ().getAction ().value ()
+ + " on the same Network Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same Network Id already in progress");
+
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same Network Id already in progress.");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ String orchestrationURI = "";
+
+ // Query MSO Catalog DB
+ try (CatalogDatabase db = new CatalogDatabase()) {
+ Recipe recipe = null;
+
+ if (msoRequest.getServiceType () != null
+ && msoRequest.getServiceType ().length () > 0) {
+ recipe = db.getNetworkRecipe (msoRequest.getNetworkInputs ().getNetworkType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ msoRequest.getServiceType ());
+
+ }
+ if (recipe == null) {
+ recipe = db.getNetworkRecipe (msoRequest.getNetworkInputs ().getNetworkType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ }
+
+ if (recipe == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "VNF Recipe attribute not found");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ null,
+ "");
+ msoRequest.createRequestRecord (Status.FAILED);
+ db.close ();
+ 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;
+ }
+ orchestrationURI = recipe.getOrchestrationUri ();
+ msoLogger.debug ("Orchestration URI is: " + orchestrationURI);
+
+ String requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.DataError, "Exception while creating record in DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ null,
+ "non-unique request-id specified");
+ // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try
+ // to create a failed record
+ 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 (orchestrationURI, props);
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+ response = requestClient.post (msoRequest.getRequestXML (),
+ requestId,
+ Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ version,
+ null,
+ null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_COMMUNICATION_TO_BPEL,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e);
+ 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.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_RESPONSE_FROM_BPEL,
+ null,
+ "bpelResponse is null");
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.DataError, "bpelResponse is null");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is null");
+ 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 bpelXMLResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.IN_PROGRESS);
+ RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ Status.IN_PROGRESS.toString (),
+ Constants.PROGRESS_REQUEST_IN_PROGRESS,
+ Constants.MODIFIED_BY_APIHANDLER);
+ Response resp = msoRequest.buildResponse (bpelStatus, null, null);
+ 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) resp.getEntity ());
+ return resp;
+ } else {
+
+ String bpelXMLResponseBody = respHandler.getResponseBody ();
+ if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", 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 with status Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", 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;
+ }
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ 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;
+ }
+ }
+
+ private Response manageVolumeRequestImpl (String reqXML, String version) {
+ String methodName = "VolumeRequest";
+ props = loadMsoProperties ();
+
+ long startTime = System.currentTimeMillis ();
+ if (noProperties) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application not started, properties file missing or invalid");
+ return NOT_STARTED_RESPONSE;
+ }
+
+ uriInfo.getRequestUri ();
+
+ // Generate unique request id for the new request
+ UUID requestUUID = UUID.randomUUID ();
+
+ VolumeMsoInfraRequest msoRequest = new VolumeMsoInfraRequest (requestUUID.toString ());
+
+ if (reqXML == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The input request is null");
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ String requestUri = uriInfo.getRequestUri ().toString ();
+
+ msoLogger.debug ("Incoming Request: " + reqXML);
+
+ msoRequest.setRequestUri (requestUri);
+
+ msoLogger.debug ("Schema version: " + version);
+ try {
+ msoRequest.parse (reqXML, version, props);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ());
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", 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;
+ }
+ MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo ().getAction ().name ());
+ msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo ().getAction ().name ());
+ if (msoRequest.getRequestInfo ()
+ .getAction () == org.openecomp.mso.apihandlerinfra.volumebeans.ActionType.CREATE) {
+ // Check if this request is a duplicate of the one with the same network Name
+ msoLogger.debug ("Checking for a duplicate with the same volume-name");
+ InfraActiveRequests dup = null;
+ try {
+
+ dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VOLUME");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "volume-group-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ "CREATE on the same Volume Group Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same Volume Group Name is already progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same Volume Group Name is already progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ } else {
+ // Check if this request is a duplicate of the one with the same volumeGroupId
+ InfraActiveRequests dup = null;
+ msoLogger.debug ("Checking for a duplicate with the same volume-group-id");
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VOLUME");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "volume-group-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the sam volume-group-id", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the sam volume-group-id");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ msoRequest.getRequestInfo ().getAction ().value ()
+ + " on the same Volume Group Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same Volume Group Id already in progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same Volume Group Id already in progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ String orchestrationURI = "";
+
+ // Query MSO Catalog DB
+ try (CatalogDatabase db = new CatalogDatabase()) {
+
+ Recipe recipe = null;
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (msoRequest.getServiceType () != null
+ && msoRequest.getServiceType ().length () > 0) {
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (),
+ msoRequest.getServiceType ());
+ }
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipe (Constants.VNF_TYPE_WILDCARD,
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ }
+ }
+ }
+ else if (version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) {
+ switch (msoRequest.getRequestInfo ().getAction ()) {
+ case CREATE:
+ case UPDATE:
+ case DELETE:
+ // First get recipe for the vnf type given
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (), null);
+
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipe (Constants.VNF_TYPE_WILDCARD,
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (), null);
+ }
+ break;
+ case CREATE_VF_MODULE_VOL:
+ case UPDATE_VF_MODULE_VOL:
+ case DELETE_VF_MODULE_VOL:
+ // First get recipe for the vnf type given
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (), null);
+
+ // 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,
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value ());
+ }
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ if (recipe == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "VNF Recipe not found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ null,
+ "");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "VNF Recipe not found in DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ orchestrationURI = recipe.getOrchestrationUri ();
+ msoLogger.debug ("Orchestration URI is: " + orchestrationURI);
+
+ String requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception in createRequestRecord", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ null,
+ "non-unique request-id specified");
+ // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try
+ // to create a failed record
+ 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 (orchestrationURI, props);
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+ response = requestClient.post (msoRequest.getRequestXML (),
+ requestId,
+ Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ version,
+ null,
+ null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_COMMUNICATION_TO_BPEL,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e);
+ 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.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_RESPONSE_FROM_BPEL,
+ null,
+ "bpelResponse is null");
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.DataError, "Null response from BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN engine");
+ 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 bpelXMLResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.IN_PROGRESS);
+ RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ Status.IN_PROGRESS.toString (),
+ Constants.PROGRESS_REQUEST_IN_PROGRESS,
+ Constants.MODIFIED_BY_APIHANDLER);
+ Response resp = msoRequest.buildResponse (bpelStatus, null, null);
+ 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) resp.getEntity ());
+ return resp;
+ } else {
+
+ String bpelXMLResponseBody = respHandler.getResponseBody ();
+ if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", MsoLogger.ErrorCode.DataError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is with status Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", MsoLogger.ErrorCode.DataError, "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is empty");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ 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;
+ }
+ }
+
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
+
+
+ Request request = new Request();
+
+ ObjectMapper mapper = new ObjectMapper();
+ // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+
+ request.setRequestId(requestDB.getRequestId());
+ request.setRequestScope(requestDB.getRequestScope());
+ request.setRequestType(requestDB.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if(requestDB.getNetworkId() != null)
+ ir.setNetworkInstanceId(requestDB.getNetworkId());
+ if(requestDB.getNetworkName() != null)
+ ir.setNetworkInstanceName(requestDB.getNetworkName());
+ if(requestDB.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(requestDB.getServiceInstanceId());
+ if(requestDB.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(requestDB.getServiceInstanceName());
+ if(requestDB.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(requestDB.getVfModuleId());
+ if(requestDB.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(requestDB.getVfModuleName());
+ if(requestDB.getVnfId() != null)
+ ir.setVnfInstanceId(requestDB.getVnfId());
+ if(requestDB.getVnfName() != null)
+ ir.setVnfInstanceName(requestDB.getVnfName());
+ if(requestDB.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId());
+ if(requestDB.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName());
+
+
+ request.setInstanceReferences(ir);
+
+ String requestBody = requestDB.getRequestBody();
+
+ RequestDetails requestDetails = null;
+
+ try{
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+
+ }catch(Exception e){
+ msoLogger.debug("Exception caught mapping requestBody to RequestDetails");
+ }
+
+ request.setRequestDetails(requestDetails);
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT";
+ request.setStartTime(startTimeStamp);
+
+ RequestStatus status = new RequestStatus();
+ if(requestDB.getStatusMessage() != null){
+ status.setStatusMessage(requestDB.getStatusMessage());
+ }
+
+ if(requestDB.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT";
+ status.setFinishTime(endTimeStamp);
+ }
+
+
+ if(requestDB.getRequestStatus() != null){
+ status.setRequestState(requestDB.getRequestStatus());
+ }
+
+ if(requestDB.getProgress() != null){
+ status.setPercentProgress(requestDB.getProgress().intValue());
+ }
+
+ request.setRequestStatus(status);
+
+ return request;
+ }
+
+ private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+
+ RecipeLookupResult recipeLookupResult = null;
+ // Query MSO Catalog DB
+
+ if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) {
+
+ // SERVICE REQUEST
+ // Construct the default service name
+ // TODO need to make this a configurable property
+
+ String defaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+ Service serviceRecord = db.getServiceByName(defaultServiceName);
+ int serviceId = serviceRecord.getId();
+ ServiceRecipe recipe = db.getServiceRecipe(serviceId, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) ||
+ msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup)) {
+
+ String vnfComponentType = msoRequest.getModelInfo().getModelType().name();
+ VnfComponentsRecipe recipe = null;
+
+ if (action != Action.deleteInstance) {
+ RelatedInstanceList[] instanceList = null;
+ if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) {
+ instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList();
+ }
+
+ String serviceModelName = null;
+ String vnfModelName = null;
+ String vfModuleModelName = null;
+ String asdcServiceModelVersion = null;
+ String modelVersion = null;
+
+ if (instanceList != null) {
+
+ for(RelatedInstanceList relatedInstanceList : instanceList){
+
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){
+ serviceModelName = relatedInstance.getModelInfo().getModelName();
+ asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion();
+ }
+
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)){
+ vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName();
+ }
+
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule) ||
+ relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) {
+ vfModuleModelName = relatedInstance.getModelInfo().getModelName();
+ modelVersion = relatedInstance.getModelInfo().getModelVersion();
+ }
+ }
+ }
+
+ String vnfType = serviceModelName + "/" + vnfModelName;
+
+ // Try to find a recipe for a custom flow first
+ recipe = db.getVnfComponentsRecipe(vnfType, vfModuleModelName, asdcServiceModelVersion, modelVersion, action.name());
+ }
+
+ if (recipe == null) {
+ // Find the default recipe record
+ recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ // VNF REQUEST
+ // Construct the default vnf type
+ // TODO need to make this a configurable property
+
+ String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ VnfRecipe recipe = db.getVnfRecipe(defaultVnfType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) {
+ // NETWORK REQUEST
+ // Construct the default network type
+ // TODO need to make this a configurable property
+
+ String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ Recipe recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+
+ 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;
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000000..774b9d6f91
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
@@ -0,0 +1,734 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+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.serviceinstancebeans.RelatedInstance;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList;
+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.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.VnfComponentsRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+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/v2")
+public class ServiceInstances {
+
+ 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";
+
+ private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties ();
+
+ /**
+ *
+ */
+ public ServiceInstances() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @POST
+ @Path("/")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createServiceInstance(String request) {
+
+ Response response = serviceInstances(request, Action.createInstance, null);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{serviceInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteServiceInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+ return response;
+ }
+
+ @POST
+ @Path("/{serviceInstanceId}/vnfs")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response updateVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
+
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+
+ @POST
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response updateVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
+
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
+
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{serviceInstanceId}/networks")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response createNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = serviceInstances(request, Action.createInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @PUT
+ @Path("/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response updateNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ Response response = serviceInstances(request, Action.updateInstance, instanceIdMap);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response deleteNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId) {
+
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap);
+
+ return response;
+ }
+
+
+
+ private Response serviceInstances(String requestJSON, Action action, HashMap<String,String> instanceIdMap) {
+
+ 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);
+ } 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 {
+ 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);
+
+ try (CatalogDatabase db = new CatalogDatabase()){
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, 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;
+ }
+
+ 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 (), requestJSON);
+
+ 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, MSO_PROP_APIHANDLER_INFRA, "", "", 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, MSO_PROP_APIHANDLER_INFRA, "", "", 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;
+ } 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;
+ }
+ }
+
+ private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+
+ RecipeLookupResult recipeLookupResult = null;
+ // Query MSO Catalog DB
+
+ if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) {
+
+ // SERVICE REQUEST
+ // Construct the default service name
+ // TODO need to make this a configurable property
+
+ String defaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+ Service serviceRecord = db.getServiceByName(defaultServiceName);
+ int serviceId = serviceRecord.getId();
+ ServiceRecipe recipe = db.getServiceRecipe(serviceId, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) ||
+ msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup)) {
+
+ String vnfComponentType = msoRequest.getModelInfo().getModelType().name();
+ VnfComponentsRecipe recipe = null;
+
+ if (action != Action.deleteInstance) {
+ RelatedInstanceList[] instanceList = null;
+ if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) {
+ instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList();
+ }
+
+ String serviceModelName = null;
+ String vnfModelName = null;
+ String vfModuleModelName = null;
+ String asdcServiceModelVersion = null;
+ String modelVersion = null;
+
+ if (instanceList != null) {
+
+ for(RelatedInstanceList relatedInstanceList : instanceList){
+
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){
+ serviceModelName = relatedInstance.getModelInfo().getModelName();
+ asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion();
+ }
+
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)){
+ vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName();
+ }
+
+ if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule) ||
+ relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) {
+ vfModuleModelName = relatedInstance.getModelInfo().getModelName();
+ modelVersion = relatedInstance.getModelInfo().getModelVersion();
+ }
+ }
+ }
+
+ String vnfType = serviceModelName + "/" + vnfModelName;
+
+ // Try to find a recipe for a custom flow first
+ recipe = db.getVnfComponentsRecipe(vnfType, vfModuleModelName, asdcServiceModelVersion, modelVersion, action.name());
+ }
+
+ if (recipe == null) {
+ // Find the default recipe record
+ recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ // VNF REQUEST
+ // Construct the default vnf type
+ // TODO need to make this a configurable property
+
+ String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ VnfRecipe recipe = db.getVnfRecipe(defaultVnfType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) {
+ // NETWORK REQUEST
+ // Construct the default network type
+ // TODO need to make this a configurable property
+
+ String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ Recipe recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
+
+ if (recipe == null) {
+ return null;
+ }
+ recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+
+ 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;
+ }
+
+}
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
new file mode 100644
index 0000000000..c98f90d70f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Status {
+ PENDING,
+ IN_PROGRESS,
+ COMPLETE,
+ FAILED,
+ TIMEOUT
+}
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
new file mode 100644
index 0000000000..8a0a1f3152
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.io.StringWriter;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+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;
+
+@Path(Constants.VF_MODULE_MODEL_NAMES_PATH)
+public class VfModuleModelNamesHandler {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static final String LOG_SERVICE_NAME = "InfrastructurePortal:MSO-APIH.";
+ private static final String LOG_REPLY_NAME = "MSO-APIH:InfrastructurePortal.";
+
+ @GET
+ public Response getVfModuleModelNames () {
+ 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()){
+ vfModules = db.getAllVfModules ();
+ } catch (Exception e) {
+ msoLogger.debug ("No connection to catalog DB", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "no connection to catalog DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + e.toString ());
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity (e.toString ()).build ();
+ }
+
+ if (vfModules == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "VfModule not found");
+ msoLogger.debug ("End of the transaction. VfModuleModelName not found the final response status: " + HttpStatus.SC_NOT_FOUND);
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+ VfModuleModelNames vfModuleModelNames = beansObjectFactory.createVfModuleModelNames ();
+ for (int i = 0; i < vfModules.size (); i++) {
+ VfModuleModelName vfModuleModelName = beansObjectFactory.createVfModuleModelName ();
+ VfModule vm = vfModules.get (i);
+ vfModuleModelName.setModelName (vm.getType ());
+ vfModuleModelName.setModelVersion (vm.getVersion ());
+ vfModuleModelName.setModelInvariantUuid (vm.getModelInvariantUuid ());
+ vfModuleModelName.setIsBase(vm.isBase());
+ vfModuleModelName.setDescription (vm.getDescription ());
+ vfModuleModelName.setId (String.valueOf (vm.getId ()));
+ vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion ());
+ vfModuleModelNames.getVfModuleModelName ().add (vfModuleModelName);
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VfModuleModelNames.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (vfModuleModelNames, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Error marshalling", e);
+ }
+
+ String response = stringWriter.toString ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + response);
+ return Response.status (HttpStatus.SC_OK).entity (response).build ();
+ }
+}
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
new file mode 100644
index 0000000000..7494747879
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
@@ -0,0 +1,373 @@
+package org.openecomp.mso.apihandlerinfra;
+
+/*-
+ * #%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%
+ */
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+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 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.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestInfo;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs;
+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.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/{version: v1|v2|v3}/vnf-request")
+public class VnfInfoHandler {
+
+ protected ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+
+ @GET
+ public Response queryFilters (@QueryParam("vnf-type") String vnfType,
+ @QueryParam("service-type") String serviceType,
+ @QueryParam("aic-node-clli") String aicNodeClli,
+ @QueryParam("tenant-id") String tenantId,
+ @QueryParam("volume-group-id") String volumeGroupId,
+ @QueryParam("volume-group-name") String volumeGroupName,
+ @QueryParam("vnf-name") String vnfName,
+ @PathParam("version") String version) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VNFQueryFilters");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for queryFilter with vnf-type:" + vnfType
+ + " service-type:" + serviceType
+ + " aic-node-clli:" + aicNodeClli
+ + " tenant-id:" + tenantId
+ + " volume-group-id:" + volumeGroupId
+ + " volume-group-name:" + volumeGroupName
+ + " vnf-name: " + vnfName);
+ Response response = null;
+ if (vnfType != null) {
+ response = this.getRequestList ("vnfType", vnfType, version);
+ } else {
+ response = queryGenericFilters (serviceType, aicNodeClli, tenantId, volumeGroupId, volumeGroupName, vnfName, version);
+ }
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ @GET
+ @Path(Constants.REQUEST_ID_PATH)
+ public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VNFGetRequest");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getRequest with request-id:" + requestId + ", version = " + version);
+
+ Response response = getRequestGeneric (requestId, version);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+ protected String getRequestType () {
+ return VnfRequestType.VNF.toString ();
+ }
+
+ protected void fillVnfRequest (VnfRequest qr, InfraRequests ar, String version) {
+ VnfInputs vi = beansObjectFactory.createVnfInputs ();
+
+ if (ar.getVnfId () != null) {
+ vi.setVnfId (ar.getVnfId ());
+ }
+ if (ar.getVnfName () != null) {
+ vi.setVnfName (ar.getVnfName ());
+ }
+ if (ar.getVnfType () != null) {
+ vi.setVnfType (ar.getVnfType ());
+ }
+ if (ar.getTenantId () != null) {
+ vi.setTenantId (ar.getTenantId ());
+ }
+ if (ar.getProvStatus () != null) {
+ vi.setProvStatus (ar.getProvStatus ());
+ }
+ if (ar.getVolumeGroupName () != null) {
+ vi.setVolumeGroupName (ar.getVolumeGroupName ());
+ }
+ if (ar.getVolumeGroupId () != null) {
+ vi.setVolumeGroupId (ar.getVolumeGroupId ());
+ }
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (ar.getServiceType () != null) {
+ vi.setServiceType (ar.getServiceType ());
+ }
+ if (ar.getAicNodeClli () != null) {
+ vi.setAicNodeClli (ar.getAicNodeClli ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleName () != null) {
+ vi.setVfModuleName (ar.getVfModuleName ());
+ }
+ if (ar.getVfModuleId () != null) {
+ vi.setVfModuleId (ar.getVfModuleId ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleName () != null) {
+ vi.setVfModuleName (ar.getVfModuleName ());
+ }
+ if (ar.getVfModuleId () != null) {
+ vi.setVfModuleId (ar.getVfModuleId ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ if (ar.getServiceInstanceId () != null) {
+ vi.setServiceInstanceId (ar.getServiceInstanceId ());
+ }
+ }
+ qr.setVnfInputs (vi);
+
+ qr.setVnfParams (ar.getVnfParams ());
+
+ try {
+ String vnfoutputs = ar.getVnfOutputs ();
+ if (vnfoutputs != null && vnfoutputs.length () > 0) {
+ msoLogger.debug ("Read VNF outputs: " + vnfoutputs);
+ VnfOutputs vnfOutput = null;
+
+ // Now unmarshal it into vnf outputs
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfOutputs.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (vnfoutputs));
+ SAXSource source = new SAXSource (inputSource);
+
+ vnfOutput = jaxbUnmarshaller.unmarshal (source, VnfOutputs.class).getValue ();
+
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed", e);
+ throw new ValidationException ("format for vnf outputs");
+ }
+
+ qr.setVnfOutputs (vnfOutput);
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("exception reading vnfOutputs Clob", e);
+ }
+ }
+
+ protected Response queryGenericFilters (String serviceType, String aicNodeClli, String tenantId, String volumeGroupId, String volumeGroupName, String vnfName, String version) {
+ if (serviceType != null) {
+ return this.getRequestList ("serviceType", serviceType, version);
+ }
+ if (aicNodeClli != null) {
+ return this.getRequestList ("aicNodeClli", aicNodeClli, version);
+ }
+ if (tenantId != null) {
+ return this.getRequestList ("tenantId", tenantId, version);
+ }
+ if (volumeGroupId != null) {
+ return this.getRequestList ("volumeGroupId", volumeGroupId, version);
+ }
+ if (volumeGroupName != null) {
+ return this.getRequestList ("volumeGroupName", volumeGroupName, version);
+ }
+ if (vnfName != null) {
+ return this.getRequestList ("vnfName", vnfName, version);
+ }
+ return Response.status (HttpStatus.SC_BAD_REQUEST).entity ("").build ();
+ }
+
+ protected Response getRequestGeneric (String requestId, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest: " + requestId);
+
+ String responseString = null;
+
+ InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, getRequestType ());
+ if (activeReq != null) {
+ // build response for active
+ responseString = infraRequestsResponse (activeReq, version);
+ return Response.status (HttpStatus.SC_OK).entity (responseString).build ();
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ protected Response getRequestList (String queryAttribute, String queryValue, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
+
+ List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ queryValue,
+ getRequestType ());
+
+ List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+
+ if (activeReqList != null) {
+ // build response for active
+ queryResponseList = infraRequestsResponses (activeReqList, version);
+
+ }
+
+ if (queryResponseList != null && !queryResponseList.isEmpty ()) {
+ String result = this.translateVnfRequests (queryResponseList);
+ return Response.status (HttpStatus.SC_OK).entity (result).build ();
+
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ private VnfRequest fillGeneric (InfraRequests ar) {
+ VnfRequest qr = beansObjectFactory.createVnfRequest ();
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (ar.getRequestId ());
+ ri.setAction (ActionType.fromValue (ar.getAction ()));
+ ri.setRequestStatus (RequestStatusType.fromValue (ar.getRequestStatus ()));
+ if (ar.getProgress () != null) {
+ ri.setProgress (ar.getProgress ().intValue ());
+ }
+ if (ar.getSource () != null) {
+ ri.setSource (ar.getSource ());
+ }
+
+ ri.setStartTime (ar.getStartTime ().toString ());
+ if (ar.getEndTime () != null) {
+ ri.setEndTime (ar.getEndTime ().toString ());
+ }
+
+ if (ar.getStatusMessage () != null) {
+ ri.setStatusMessage (ar.getStatusMessage ());
+ }
+ qr.setRequestInfo (ri);
+ return qr;
+ }
+
+ private List <VnfRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
+ List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+
+ for (InfraRequests ar : arList) {
+ VnfRequest qr = fillGeneric (ar);
+ fillVnfRequest (qr, ar, version);
+ queryResponseList.add (qr);
+ }
+ return queryResponseList;
+ }
+
+ private String translateVnfRequests (List <VnfRequest> queryResponseList) {
+ VnfRequests queryResponses = new VnfRequests ();
+ for (int i = 0; i < queryResponseList.size (); i++) {
+ queryResponses.getVnfRequest ().add (queryResponseList.get (i));
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequests.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (queryResponses, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ return stringWriter.toString ();
+ }
+
+ private String infraRequestsResponse (InfraRequests ar, String version) {
+ VnfRequest qr = fillGeneric (ar);
+ fillVnfRequest (qr, ar, version);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (qr, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ String response = stringWriter.toString ();
+ return response;
+ }
+}
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
new file mode 100644
index 0000000000..e22d182086
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
@@ -0,0 +1,714 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+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.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+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.xml.sax.InputSource;
+
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestInfo;
+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.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.HibernateUtil;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+public class VnfMsoInfraRequest {
+
+ private String requestId;
+ private String requestXML;
+ private String requestUri;
+ private VnfRequest vnfReq;
+ private RequestInfo rinfo;
+ private VnfInputs vnfInputs;
+ private String vnfParams;
+ private ActionType action;
+ private String errorMessage;
+ private String httpResponse;
+ private String responseBody;
+ private RequestStatusType status;
+ private long startTime;
+ private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static final String NOT_PROVIDED = "not provided";
+
+ VnfMsoInfraRequest (String requestId) {
+ this.requestId = requestId;
+ Calendar startTimeCalendar = Calendar.getInstance ();
+ this.startTime = startTimeCalendar.getTimeInMillis ();
+ MsoLogger.setLogContext (requestId, null);
+
+ }
+
+ // Parse request XML
+ void parse (String reqXML, String version, MsoJavaProperties props) throws ValidationException {
+
+ msoLogger.debug ("Validating the request");
+
+ this.requestXML = reqXML;
+
+ VnfRequest vnfReq = null;
+ boolean isWrongRootElement = false;
+
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (reqXML));
+ SAXSource source = new SAXSource (inputSource);
+
+ if (reqXML.contains ("vnf-request") && !reqXML.contains ("network-request")) {
+ vnfReq = jaxbUnmarshaller.unmarshal (source, VnfRequest.class).getValue ();
+ } else {
+ isWrongRootElement = true;
+ }
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_VNFREQUEST_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in format for vnf request ", e);
+ throw new ValidationException ("format for vnf request");
+ }
+
+ if (isWrongRootElement) {
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR_REASON, "root element is not correct", "", "", MsoLogger.ErrorCode.DataError, "root element is not correct");
+ throw new ValidationException ("root element <vnf-request> expected");
+ }
+
+ if (vnfReq == null) {
+ throw new ValidationException ("vnf-request");
+ }
+ this.vnfReq = vnfReq;
+
+ this.rinfo = vnfReq.getRequestInfo ();
+
+ if (this.rinfo == null) {
+ throw new ValidationException ("request-info");
+ }
+ if (this.rinfo.getRequestId () != null) {
+ msoLogger.info (MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, this.rinfo.getRequestId ());
+ }
+
+ action = this.rinfo.getAction ();
+ if (action == null) {
+ throw new ValidationException ("action");
+ }
+
+ this.vnfInputs = vnfReq.getVnfInputs ();
+ if (this.vnfInputs == null) {
+ throw new ValidationException ("vnf-inputs");
+ }
+
+ // Verify that BPMN-specific elements are not in the APIH incoming request
+ if (this.vnfInputs.getPersonaModelId () != null || this.vnfInputs.getPersonaModelVersion () != null ||
+ this.vnfInputs.getIsBaseVfModule () != null || this.vnfInputs.getVnfPersonaModelId () != null ||
+ this.vnfInputs.getVnfPersonaModelVersion () != null) {
+ throw new ValidationException ("format for vnf request");
+ }
+ // Verify that the elements correspond to the version
+
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (this.vnfInputs.getVfModuleName () != null || this.vnfInputs.getVfModuleId () != null ||
+ this.vnfInputs.getVfModuleModelName () != null || this.vnfInputs.getAsdcServiceModelVersion () != null ||
+ this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null ||
+ this.vnfInputs.getServiceInstanceId () != null) {
+ throw new ValidationException ("format for v1 version of vnf request");
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null || this.vnfInputs.getServiceInstanceId () != null) {
+ throw new ValidationException ("format for v2 version of vnf request");
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) {
+ throw new ValidationException ("format for v3 version of vnf request");
+ }
+ }
+
+
+ if (!InfraUtils.isActionAllowed (props, "vnf", version, action.value ())) {
+ throw new ValidationException ("action allowable for version " + version + " of vnf request");
+ }
+
+ if ((ActionType.UPDATE.equals(action) || ActionType.DELETE.equals(action)) && this.vnfInputs.getVnfId () == null) {
+ throw new ValidationException("vnf-id");
+ }
+
+ if ((ActionType.UPDATE_VF_MODULE.equals (action) || ActionType.DELETE_VF_MODULE.equals (action)) && this.vnfInputs.getVfModuleId () == null) {
+ throw new ValidationException ("vf-module-id");
+ }
+
+ if (ActionType.CREATE.equals (action) && this.vnfInputs.getVnfName () == null) {
+ throw new ValidationException ("vnf-name");
+ }
+
+ if (ActionType.CREATE_VF_MODULE.equals (action)) {
+ if (this.vnfInputs.getVfModuleName () == null) {
+ throw new ValidationException ("vf-module-name");
+ }
+ if (!InfraUtils.isValidHeatName(this.vnfInputs.getVfModuleName ())) {
+ throw new ValidationException ("vf-module-name: no value meeting heat stack name syntax requirements");
+ }
+ }
+
+ if (this.vnfInputs.getVnfType () == null) {
+ throw new ValidationException ("vnf-type");
+ }
+
+ if ((ActionType.CREATE_VF_MODULE.equals (action) || ActionType.UPDATE_VF_MODULE.equals (action) || ActionType.DELETE_VF_MODULE.equals (action)) && this.vnfInputs.getVfModuleModelName () == null) {
+ throw new ValidationException ("vf-module-model-name");
+ }
+
+ if (!version.equals(Constants.SCHEMA_VERSION_V1) && this.vnfInputs.getServiceId () == null) {
+ throw new ValidationException ("service-id ");
+ }
+
+ if (this.vnfInputs.getServiceType () != null && this.vnfInputs.getServiceId () != null) {
+ throw new ValidationException ("service-type or service-id ");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1) && this.vnfInputs.getAicNodeClli () == null) {
+ throw new ValidationException ("aic-node-clli");
+ }
+
+ if ((version.equals(Constants.SCHEMA_VERSION_V2) || version.equals(Constants.SCHEMA_VERSION_V3)) && (this.vnfInputs.getAicCloudRegion () == null || this.vnfInputs.getAicCloudRegion ().isEmpty())) {
+ throw new ValidationException ("aic-cloud-region");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V3) && this.vnfInputs.getServiceInstanceId () == null) {
+ throw new ValidationException ("service-instance-id");
+ }
+
+
+ if (this.vnfInputs.getTenantId () == null) {
+ throw new ValidationException ("tenant-id");
+ }
+
+ Object vp = vnfReq.getVnfParams ();
+
+ if (vp != null) {
+ msoLogger.debug ("This object is not null");
+
+ Node node = (Node) vp;
+ Document doc = node.getOwnerDocument ();
+ this.vnfParams = domToStr (doc);
+ }
+
+ msoLogger.debug ("VNFParams: " + this.vnfParams);
+
+ msoLogger.debug ("Request valid");
+
+ // Rebuild the request string for BPEL to include request-id
+ rinfo.setRequestId (this.requestId);
+ this.vnfReq.setRequestInfo (rinfo);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (this.vnfReq, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ this.requestXML = stringWriter.toString ();
+ msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML);
+
+ }
+
+ public void createRequestRecord (Status status) {
+
+ Session session = null;
+ try {
+
+ session = HibernateUtil.getSessionFactory ().openSession ();
+ session.beginTransaction ();
+
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ aq.setRequestId (requestId);
+ aq.setClientRequestId(rinfo.getRequestId());
+
+ Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ if (rinfo != null) {
+ if (rinfo.getAction () != null) {
+ aq.setAction (rinfo.getAction ().value ());
+ aq.setRequestAction (RequestActionMap.getMappedRequestAction (rinfo.getAction ().value ()));
+ }
+ aq.setSource (rinfo.getSource ());
+ } else {
+ // Set up mandatory parameters
+ aq.setAction (NOT_PROVIDED);
+ aq.setRequestAction (NOT_PROVIDED);
+ }
+
+ aq.setRequestBody (this.requestXML);
+ aq.setRequestScope ("");
+
+ if (vnfInputs != null) {
+ if (vnfInputs.getVnfId () != null) {
+ aq.setVnfId (vnfInputs.getVnfId ());
+ }
+ if (vnfInputs.getVnfName () != null) {
+ aq.setVnfName (vnfInputs.getVnfName ());
+ }
+ if (vnfInputs.getVnfType () != null) {
+ aq.setVnfType (vnfInputs.getVnfType ());
+ }
+ if (vnfInputs.getServiceInstanceId () != null) {
+ aq.setServiceInstanceId (vnfInputs.getServiceInstanceId ());
+ }
+ if (vnfInputs.getServiceType () != null) {
+ aq.setServiceType (vnfInputs.getServiceType ());
+ }
+ if (vnfInputs.getServiceId () != null) {
+ aq.setAaiServiceId (vnfInputs.getServiceId ());
+ }
+ if (vnfInputs.getAicNodeClli () != null) {
+ aq.setAicNodeClli (vnfInputs.getAicNodeClli ());
+ }
+ if (vnfInputs.getAicCloudRegion () != null) {
+ aq.setAicCloudRegion (vnfInputs.getAicCloudRegion ());
+ }
+ if (vnfInputs.getTenantId () != null) {
+ aq.setTenantId (vnfInputs.getTenantId ());
+ }
+ if (vnfInputs.getProvStatus () != null) {
+ aq.setProvStatus (vnfInputs.getProvStatus ());
+ }
+ if (vnfInputs.getVolumeGroupName () != null) {
+ aq.setVolumeGroupName (vnfInputs.getVolumeGroupName ());
+ }
+ if (vnfInputs.getVolumeGroupId () != null) {
+ aq.setVolumeGroupId (vnfInputs.getVolumeGroupId ());
+ }
+ if (vnfInputs.getVfModuleId () != null) {
+ aq.setVfModuleId (vnfInputs.getVfModuleId ());
+ }
+ if (vnfInputs.getVfModuleName () != null) {
+ aq.setVfModuleName (vnfInputs.getVfModuleName ());
+ }
+ if (vnfInputs.getVfModuleModelName () != null) {
+ aq.setVfModuleModelName (vnfInputs.getVfModuleModelName ());
+ }
+
+ if (vnfInputs.getVfModuleName () != null || vnfInputs.getVfModuleId () != null) {
+ aq.setRequestScope (ModelType.vfModule.name ());
+ }
+ else {
+ aq.setRequestScope (ModelType.vnf.name ());
+ }
+
+
+ }
+
+ aq.setStartTime (startTimeStamp);
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+ aq.setRequestType ("VNF");
+
+ if (vnfParams != null) {
+ msoLogger.debug ("Storing vnfParams: " + vnfParams);
+ aq.setVnfParams (this.vnfParams);
+ }
+
+ if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
+ aq.setStatusMessage (this.errorMessage);
+ aq.setResponseBody (this.responseBody);
+
+ Calendar endTime = Calendar.getInstance ();
+ Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ aq.setEndTime (endTimeStamp);
+ }
+
+ aq.setProgress (this.progress);
+
+
+ msoLogger.debug ("About to insert a record");
+
+ session.save (aq);
+ session.getTransaction ().commit ();
+ session.close ();
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception in createRequestRecord", e);
+ if (session != null) {
+ session.close ();
+ }
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ }
+
+ public void updateFinalStatus (Status status) {
+ int result = 0;
+ try {
+ result = RequestsDatabase.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.AvailabilityError, "Exception in updateFinalStatus");
+ msoLogger.debug ("Exception: ", e);
+ }
+ }
+
+ public Response buildResponse (int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
+ return buildResponseWithError (httpResponseCode, errorCode, inProgress, null);
+ }
+
+ public Response buildResponseWithError (int httpResponseCode,
+ String errorCode,
+ InfraActiveRequests inProgress,
+ String errorString) {
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ VnfRequest vr = beansObjectFactory.createVnfRequest ();
+
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+
+ ri.setRequestId (requestId);
+ ri.setRequestStatus (this.status);
+ ri.setAction (this.rinfo.getAction ());
+ ri.setSource (this.rinfo.getSource ());
+
+ String errorMsg = null;
+ if (errorCode != null) {
+ // If error code is actually an XML error response from BPEL, treat it specially:
+ if (!Messages.errors.containsKey (errorCode)) {
+ if (errorCode.length () > 300) {
+ errorMsg = errorCode.substring (0, 299);
+ } else {
+ errorMsg = errorCode;
+ }
+
+ } else {
+
+ if (inProgress == null) {
+ if (errorCode.equals (ErrorNumbers.RECIPE_DOES_NOT_EXIST)) {
+ errorMsg = String.format (Messages.errors.get (errorCode), "vnf", errorString);
+ } else {
+ errorMsg = String.format (Messages.errors.get (errorCode), errorString);
+ }
+ } else if (errorCode.equals (ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS)) {
+ errorMsg = String.format (Messages.errors.get (errorCode),
+ "vnf",
+ inProgress.getVnfName (),
+ inProgress.getRequestStatus (),
+ "vnf");
+ } else if (errorCode.equals (ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID)) {
+ errorMsg = String.format (Messages.errors.get (errorCode),
+ "vnf",
+ inProgress.getVnfId (),
+ inProgress.getRequestStatus (),
+ inProgress.getAction (),
+ "vnf");
+ }
+ }
+
+ ri.setStatusMessage (errorMsg);
+ this.errorMessage = errorMsg;
+ }
+ ri.setProgress ((int) this.progress);
+
+ Date startDate = new Date (this.startTime);
+ SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
+ String startTimeString = sdf.format (startDate);
+
+ ri.setStartTime (startTimeString);
+
+ if (this.progress == Constants.PROGRESS_REQUEST_COMPLETED) {
+ ri.setEndTime(startTimeString);
+ }
+
+ vr.setRequestInfo (ri);
+
+ this.vnfInputs.setIsBaseVfModule(null);
+ this.vnfInputs.setPersonaModelId(null);
+ this.vnfInputs.setPersonaModelVersion(null);
+ this.vnfInputs.setVnfPersonaModelId(null);
+ this.vnfInputs.setVnfPersonaModelVersion(null);
+
+ vr.setVnfInputs (this.vnfInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (vr, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ String response = stringWriter.toString ();
+
+ this.httpResponse = Integer.toString (httpResponseCode);
+ this.responseBody = response;
+
+
+ // Log the failed request into the MSO Requests database
+
+ return Response.status (httpResponseCode).entity (response).build ();
+
+ }
+
+ public Response buildResponseFailedValidation (int httpResponseCode, String exceptionMessage) {
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+ VnfRequest vr = beansObjectFactory.createVnfRequest ();
+
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (requestId);
+
+ if (this.rinfo != null) {
+ if (this.rinfo.getAction () != null) {
+ ri.setAction (this.rinfo.getAction ());
+ } else {
+ ri.setAction (ActionType.NOT_PROVIDED);
+ }
+ if (this.rinfo.getSource () != null) {
+ ri.setSource (this.rinfo.getSource ());
+ }
+ } else {
+ ri.setAction (ActionType.NOT_PROVIDED);
+ }
+
+ // Nothing more is expected for this request
+
+ String errorMsg = String.format (Messages.errors.get (ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION
+ + "_service"),
+ exceptionMessage);
+ ri.setStatusMessage (errorMsg);
+ this.errorMessage = errorMsg;
+
+ ri.setProgress ((int) this.progress);
+ ri.setRequestStatus (RequestStatusType.FAILED);
+ Date startDate = new Date (this.startTime);
+ SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
+ String startTimeString = sdf.format (startDate);
+
+ ri.setStartTime (startTimeString);
+ ri.setEndTime(startTimeString);
+
+ vr.setRequestInfo (ri);
+
+ vr.setVnfInputs (this.vnfInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (vr, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Error marshalling", e);
+ }
+
+ String response = stringWriter.toString ();
+
+ this.httpResponse = Integer.toString (httpResponseCode);
+ this.responseBody = response;
+
+ return Response.status (httpResponseCode).entity (response).build ();
+ }
+
+ public String getRequestUri () {
+ return requestUri;
+ }
+
+ public void setRequestUri (String requestUri) {
+ this.requestUri = requestUri;
+ }
+
+ public VnfInputs getVnfInputs () {
+ return vnfInputs;
+ }
+
+ public RequestInfo getRequestInfo () {
+ return rinfo;
+ }
+
+ public String getResponseBody () {
+ return responseBody;
+ }
+
+ public void setResponseBody (String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+ public String getHttpResponse () {
+ return httpResponse;
+ }
+
+ public void setHttpResponse (String httpResponse) {
+ this.httpResponse = httpResponse;
+ }
+
+ public String getRequestId () {
+ return requestId;
+ }
+
+ public String getRequestXML () {
+ return requestXML;
+ }
+
+ public void setRequestXML (String requestXML) {
+ this.requestXML = requestXML;
+ }
+
+ public RequestStatusType getStatus () {
+ return status;
+ }
+
+ public String getServiceType () {
+ if (this.vnfInputs.getServiceType () != null)
+ return this.vnfInputs.getServiceType ();
+ if (this.vnfInputs.getServiceId () != null)
+ return this.vnfInputs.getServiceId ();
+ return null;
+ }
+
+ public void setStatus (RequestStatusType status) {
+ this.status = status;
+ switch (status) {
+ case FAILED:
+ case COMPLETE:
+ this.progress = Constants.PROGRESS_REQUEST_COMPLETED;
+ break;
+ case IN_PROGRESS:
+ this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS;
+ break;
+ }
+ }
+
+ public static String domToStr (Document doc) {
+ if (doc == null) {
+ return null;
+ }
+
+ try {
+ StringWriter sw = new StringWriter ();
+ StreamResult sr = new StreamResult (sw);
+ TransformerFactory tf = TransformerFactory.newInstance ();
+ Transformer t = tf.newTransformer ();
+ t.setOutputProperty (OutputKeys.STANDALONE, "yes");
+ NodeList nl = doc.getDocumentElement ().getChildNodes ();
+ DOMSource source = null;
+ for (int x = 0; x < nl.getLength (); x++) {
+ Node e = nl.item (x);
+ if (e instanceof Element) {
+ source = new DOMSource (e);
+ break;
+ }
+ }
+ if (source != null) {
+ t.transform (source, sr);
+
+ String s = sw.toString ();
+ return s;
+ }
+
+ return null;
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in domToStr", e);
+ }
+ return null;
+ }
+
+ public void addBPMNSpecificInputs(String personaModelId, String personaModelVersion, Boolean isBaseVfModule,
+ String vnfPersonaModelId, String vnfPersonaModelVersion) {
+ vnfInputs.setPersonaModelId(personaModelId);
+ vnfInputs.setPersonaModelVersion(personaModelVersion);
+ vnfInputs.setIsBaseVfModule(isBaseVfModule);
+ vnfInputs.setVnfPersonaModelId(vnfPersonaModelId);
+ vnfInputs.setVnfPersonaModelVersion(vnfPersonaModelVersion);
+
+ this.vnfReq.setVnfInputs(vnfInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (this.vnfReq, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ this.requestXML = stringWriter.toString ();
+ msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML);
+
+
+ }
+}
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
new file mode 100644
index 0000000000..617172be08
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
@@ -0,0 +1,804 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+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.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.sax.SAXSource;
+
+import org.xml.sax.InputSource;
+
+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.vnfbeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestInfo;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs;
+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.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Recipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+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.InfraRequests;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/{version: v1|v2|v3}/vnf-request")
+public class VnfRequestHandler {
+
+ @Context
+ private UriInfo uriInfo;
+
+ protected ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties ();
+
+ private static final String NOT_FOUND = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Started</title></head><body>Application not started, properties file missing or invalid or Database Connection failed</body></html>";
+
+ private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
+ .entity (NOT_FOUND)
+ .build ();
+
+ @GET
+ public Response queryFilters (@QueryParam("vnf-type") String vnfType,
+ @QueryParam("service-type") String serviceType,
+ @QueryParam("aic-node-clli") String aicNodeClli,
+ @QueryParam("tenant-id") String tenantId,
+ @QueryParam("volume-group-id") String volumeGroupId,
+ @QueryParam("volume-group-name") String volumeGroupName,
+ @QueryParam("vnf-name") String vnfName,
+ @PathParam("version") String version) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VNFQueryFilters");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for queryFilter with vnf-type:" + vnfType
+ + " service-type:" + serviceType
+ + " aic-node-clli:" + aicNodeClli
+ + " tenant-id:" + tenantId
+ + " volume-group-id:" + volumeGroupId
+ + " volume-group-name:" + volumeGroupName
+ + " vnf-name: " + vnfName);
+ Response response = null;
+ if (vnfType != null) {
+ response = this.getRequestList ("vnfType", vnfType, version);
+ } else {
+ response = queryGenericFilters (serviceType, aicNodeClli, tenantId, volumeGroupId, volumeGroupName, vnfName, version);
+ }
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ @GET
+ @Path(Constants.REQUEST_ID_PATH)
+ public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VNFGetRequest");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getRequest with request-id:" + requestId + ", version = " + version);
+
+ Response response = getRequestGeneric (requestId, version);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+ protected String getRequestType () {
+ return VnfRequestType.VNF.toString ();
+ }
+
+ protected void fillVnfRequest (VnfRequest qr, InfraRequests ar, String version) {
+ VnfInputs vi = beansObjectFactory.createVnfInputs ();
+
+ if (ar.getVnfId () != null) {
+ vi.setVnfId (ar.getVnfId ());
+ }
+ if (ar.getVnfName () != null) {
+ vi.setVnfName (ar.getVnfName ());
+ }
+ if (ar.getVnfType () != null) {
+ vi.setVnfType (ar.getVnfType ());
+ }
+ if (ar.getTenantId () != null) {
+ vi.setTenantId (ar.getTenantId ());
+ }
+ if (ar.getProvStatus () != null) {
+ vi.setProvStatus (ar.getProvStatus ());
+ }
+ if (ar.getVolumeGroupName () != null) {
+ vi.setVolumeGroupName (ar.getVolumeGroupName ());
+ }
+ if (ar.getVolumeGroupId () != null) {
+ vi.setVolumeGroupId (ar.getVolumeGroupId ());
+ }
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (ar.getServiceType () != null) {
+ vi.setServiceType (ar.getServiceType ());
+ }
+ if (ar.getAicNodeClli () != null) {
+ vi.setAicNodeClli (ar.getAicNodeClli ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleName () != null) {
+ vi.setVfModuleName (ar.getVfModuleName ());
+ }
+ if (ar.getVfModuleId () != null) {
+ vi.setVfModuleId (ar.getVfModuleId ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleName () != null) {
+ vi.setVfModuleName (ar.getVfModuleName ());
+ }
+ if (ar.getVfModuleId () != null) {
+ vi.setVfModuleId (ar.getVfModuleId ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ if (ar.getServiceInstanceId () != null) {
+ vi.setServiceInstanceId (ar.getServiceInstanceId ());
+ }
+ }
+ qr.setVnfInputs (vi);
+
+ qr.setVnfParams (ar.getVnfParams ());
+
+ try {
+ String vnfoutputs = ar.getVnfOutputs ();
+ if (vnfoutputs != null && vnfoutputs.length () > 0) {
+ msoLogger.debug ("Read VNF outputs: " + vnfoutputs);
+ VnfOutputs vnfOutput = null;
+
+ // Now unmarshal it into vnf outputs
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfOutputs.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (vnfoutputs));
+ SAXSource source = new SAXSource (inputSource);
+
+ vnfOutput = jaxbUnmarshaller.unmarshal (source, VnfOutputs.class).getValue ();
+
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed", e);
+ throw new ValidationException ("format for vnf outputs");
+ }
+
+ qr.setVnfOutputs (vnfOutput);
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("exception reading vnfOutputs Clob", e);
+ }
+ }
+
+ protected Response queryGenericFilters (String serviceType, String aicNodeClli, String tenantId, String volumeGroupId, String volumeGroupName, String vnfName, String version) {
+ if (serviceType != null) {
+ return this.getRequestList ("serviceType", serviceType, version);
+ }
+ if (aicNodeClli != null) {
+ return this.getRequestList ("aicNodeClli", aicNodeClli, version);
+ }
+ if (tenantId != null) {
+ return this.getRequestList ("tenantId", tenantId, version);
+ }
+ if (volumeGroupId != null) {
+ return this.getRequestList ("volumeGroupId", volumeGroupId, version);
+ }
+ if (volumeGroupName != null) {
+ return this.getRequestList ("volumeGroupName", volumeGroupName, version);
+ }
+ if (vnfName != null) {
+ return this.getRequestList ("vnfName", vnfName, version);
+ }
+ return Response.status (HttpStatus.SC_BAD_REQUEST).entity ("").build ();
+ }
+
+ protected Response getRequestGeneric (String requestId, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest: " + requestId);
+
+ String responseString = null;
+
+ InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId, getRequestType ());
+ if (activeReq != null) {
+ // build response for active
+ responseString = infraRequestsResponse (activeReq, version);
+ return Response.status (HttpStatus.SC_OK).entity (responseString).build ();
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ protected Response getRequestList (String queryAttribute, String queryValue, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
+
+ List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ queryValue,
+ getRequestType ());
+
+ List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+
+ if (activeReqList != null) {
+ // build response for active
+ queryResponseList = infraRequestsResponses (activeReqList, version);
+
+ }
+
+ if (queryResponseList != null && !queryResponseList.isEmpty ()) {
+ String result = this.translateVnfRequests (queryResponseList);
+ return Response.status (HttpStatus.SC_OK).entity (result).build ();
+
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ private VnfRequest fillGeneric (InfraRequests ar) {
+ VnfRequest qr = beansObjectFactory.createVnfRequest ();
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (ar.getRequestId ());
+ ri.setAction (ActionType.fromValue (ar.getAction ()));
+ ri.setRequestStatus (RequestStatusType.fromValue (ar.getRequestStatus ()));
+ if (ar.getProgress () != null) {
+ ri.setProgress (ar.getProgress ().intValue ());
+ }
+ if (ar.getSource () != null) {
+ ri.setSource (ar.getSource ());
+ }
+
+ ri.setStartTime (ar.getStartTime ().toString ());
+ if (ar.getEndTime () != null) {
+ ri.setEndTime (ar.getEndTime ().toString ());
+ }
+
+ if (ar.getStatusMessage () != null) {
+ ri.setStatusMessage (ar.getStatusMessage ());
+ }
+ qr.setRequestInfo (ri);
+ return qr;
+ }
+
+ private List <VnfRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
+ List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+
+ for (InfraRequests ar : arList) {
+ VnfRequest qr = fillGeneric (ar);
+ fillVnfRequest (qr, ar, version);
+ queryResponseList.add (qr);
+ }
+ return queryResponseList;
+ }
+
+ private String translateVnfRequests (List <VnfRequest> queryResponseList) {
+ VnfRequests queryResponses = new VnfRequests ();
+ for (int i = 0; i < queryResponseList.size (); i++) {
+ queryResponses.getVnfRequest ().add (queryResponseList.get (i));
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequests.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (queryResponses, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ return stringWriter.toString ();
+ }
+
+ private String infraRequestsResponse (InfraRequests ar, String version) {
+ VnfRequest qr = fillGeneric (ar);
+ fillVnfRequest (qr, ar, version);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (qr, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ String response = stringWriter.toString ();
+ return response;
+ }
+
+ @POST
+ @Path("/")
+ @Produces(MediaType.APPLICATION_XML)
+ public Response manageVnfRequest (String reqXML, @PathParam("version") String version) {
+ MsoLogger.setServiceName ("VnfRequest");
+ if ("v1".equals(version)) {
+ return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1);
+ } else if ("v2".equals(version)) {
+ return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2);
+ } else if ("v3".equals(version)) {
+ return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3);
+ } else {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Version not found");
+ return Response.status(HttpStatus.SC_NOT_FOUND).build();
+ }
+ }
+
+ private Response manageVnfRequestImpl (String reqXML, String version) {
+ String methodName = "VnfRequest";
+ props = MsoPropertiesUtils.loadMsoProperties ();
+ long startTime = System.currentTimeMillis ();
+
+ // Generate unique request id for the new request
+ UUID requestUUID = UUID.randomUUID ();
+
+ VnfMsoInfraRequest msoRequest = new VnfMsoInfraRequest (requestUUID.toString ());
+ MsoLogger.setLogContext (msoRequest.getRequestId (), null);
+
+ if (MsoPropertiesUtils.getNoPropertiesState()) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exiting the transaction: Infra API Handler not started, properties file missing or invalid");
+ return NOT_STARTED_RESPONSE;
+ }
+
+ uriInfo.getRequestUri ();
+
+ if (reqXML == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The content of the request is null");
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ String requestUri = uriInfo.getRequestUri ().toString ();
+ msoLogger.debug ("Incoming request received for pose VNFRequest:" + reqXML);
+
+ msoRequest.setRequestUri (requestUri);
+ msoLogger.debug ("Schema version: " + version);
+ try {
+ msoRequest.parse (reqXML, version, props);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ());
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.SchemaError, "Exception when parsing reqXML", 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;
+ }
+ MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name());
+ if (msoRequest.getRequestInfo ().getAction () == org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType.CREATE) {
+ // Check if this request is a duplicate of the one with the same vnfName
+ msoLogger.debug ("Checking for a duplicate with the same vnf-name");
+ InfraActiveRequests dup = null;
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VNF");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "vnf-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, "CREATE on the same VNF Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same VNF Name is already progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same VNF Name is already progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ } else {
+ // Check if this request is a duplicate of the one with the same vnfId
+ InfraActiveRequests dup = null;
+ msoLogger.debug ("Checking for a duplicate with the same vnf-id");
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VNF");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "vnf-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the same vnf-id", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the same vnf-id");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ msoRequest.getRequestInfo ().getAction ().value ()
+ + " on the same VNF Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same VNF Id already in progress");
+
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same VNF Id already in progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ String orchestrationURI = "";
+
+ // Query MSO Catalog DB
+ try (CatalogDatabase db = new CatalogDatabase()){
+
+ Recipe recipe = null;
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ // First get recipe for the service type given
+ if (msoRequest.getServiceType () != null
+ && msoRequest.getServiceType ().length () > 0) {
+ recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ msoRequest.getServiceType ());
+ }
+ // If no recipe for the service type or no service type was given, look for recipe without service type
+ if (recipe == null) {
+ recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ }
+ }
+ if (version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) {
+ switch (msoRequest.getRequestInfo ().getAction ()) {
+ case CREATE:
+ case UPDATE:
+ case DELETE:
+ // First get recipe for the vnf type given
+ recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ msoRequest.getRequestInfo ().getAction ().value ());
+
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfRecipe (Constants.VNF_TYPE_WILDCARD,
+ msoRequest.getRequestInfo ().getAction ().value ());
+ }
+ break;
+ case CREATE_VF_MODULE:
+ case UPDATE_VF_MODULE:
+ case DELETE_VF_MODULE:
+ // First get recipe for the vnf type/vf module model name through vf module id query
+ recipe = db.getVfModuleRecipe (msoRequest.getVnfInputs ().getVnfType (), msoRequest.getVnfInputs ().getVfModuleModelName (),
+ msoRequest.getRequestInfo ().getAction ().value ());
+
+ // If no recipe is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfRecipeByVfModuleId (msoRequest.getVnfInputs ().getVfModuleId (),
+ Constants.VNF_TYPE_WILDCARD, msoRequest.getRequestInfo ().getAction ().value ());
+ }
+ // First get recipe for the vnf type given
+ //recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (),
+ // msoRequest.getRequestInfo ().getAction ().value ());
+
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ //if (recipe == null) {
+ // recipe = db.getVnfRecipe (Constants.VNF_TYPE_WILDCARD,
+ // msoRequest.getRequestInfo ().getAction ().value ());
+ //
+ //}
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ if (recipe == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ null,
+ "");
+ msoRequest.createRequestRecord (Status.FAILED);
+ db.close ();
+ 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;
+ }
+ orchestrationURI = recipe.getOrchestrationUri ();
+ msoLogger.debug ("Orchestration URI is: " + orchestrationURI);
+
+ // Retrieve additional info for Vf Modules from Catalog DB to send it to BPMN
+ switch (msoRequest.getRequestInfo ().getAction ()) {
+ case CREATE_VF_MODULE:
+ case UPDATE_VF_MODULE:
+ String personaModelId = "";
+ String personaModelVersion = "";
+ String vnfPersonaModelId = "";
+ String vnfPersonaModelVersion = "";
+ Boolean isBase = false;
+ String asdcServiceModelVersion = msoRequest.getVnfInputs ().getAsdcServiceModelVersion ();
+
+ // Get VF Module-specific persona info and base module indicator
+ VfModule vfm = null;
+ String vfModuleType = msoRequest.getVnfInputs ().getVnfType () + "::" + msoRequest.getVnfInputs ().getVfModuleModelName ();
+ if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
+ vfm = db.getVfModuleType (vfModuleType, asdcServiceModelVersion);
+ }
+ else {
+ vfm = db.getVfModuleType (vfModuleType);
+ }
+ if (vfm != null) {
+ if (vfm.getIsBase() == 1) {
+ isBase = true;
+ }
+ personaModelId = vfm.getModelInvariantUuid();
+ personaModelVersion = vfm.getModelVersion();
+ msoLogger.debug("Setting personaModelId to " + personaModelId +
+ ", personaModelVersion to " + personaModelVersion);
+ }
+ // Get VNF-specific persona info
+ VnfResource vnfr = null;
+ if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
+ vnfr = db.getVnfResource (msoRequest.getVnfInputs ().getVnfType (), asdcServiceModelVersion);
+ }
+ else {
+ vnfr = db.getVnfResource (msoRequest.getVnfInputs ().getVnfType ());
+ }
+ if (vnfr != null) {
+ vnfPersonaModelId = vnfr.getModelInvariantUuid ();
+ vnfPersonaModelVersion = vnfr.getModelVersion();
+ msoLogger.debug("Setting vnfPersonaModelId to " + vnfPersonaModelId +
+ ", vnfPersonaModelVersion to " + vnfPersonaModelVersion);
+ }
+
+ msoRequest.addBPMNSpecificInputs(personaModelId, personaModelVersion, isBase,
+ vnfPersonaModelId, vnfPersonaModelVersion);
+
+ break;
+ default:
+ break;
+ }
+
+ db.close ();
+
+ String requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING);
+ } 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.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ null,
+ "non-unique request-id specified");
+ // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try
+ // to create a failed record
+ 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;
+ }
+
+ msoLogger.debug("Request going to BPEL: " + msoRequest.getRequestXML ());
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+ try {
+ requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props);
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+ response = requestClient.post (msoRequest.getRequestXML (),
+ requestId,
+ Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ version,
+ null,
+ null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_COMMUNICATION_TO_BPEL,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e);
+ 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.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_RESPONSE_FROM_BPEL,
+ null,
+ "bpelResponse is null");
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "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 bpelXMLResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
+ 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);
+ Response resp = msoRequest.buildResponse (bpelStatus, null, null);
+ 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) resp.getEntity ());
+ return resp;
+ } else {
+
+ String bpelXMLResponseBody = respHandler.getResponseBody ();
+ if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", 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.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", 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;
+ }
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ 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;
+ }
+ }
+}
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
new file mode 100644
index 0000000000..e8023b8bf9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestType.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+/*
+ * Enum for VNF Request Type values
+*/
+public enum VnfRequestType {
+ VNF,
+ NETWORK
+}
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
new file mode 100644
index 0000000000..32fd80d58a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfType;
+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.utils.UUIDChecker;
+import org.apache.http.HttpStatus;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+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)
+public class VnfTypesHandler {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+
+ @GET
+ public Response getVnfTypes (@QueryParam("vnf-role") String vnfRole) {
+
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("GetVnfTypes");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getVnfTypes with vnf-role:" + vnfRole);
+
+ List <VnfResource> vnfResources = null;
+ try(CatalogDatabase db = new CatalogDatabase ()) {
+ ;
+ if (vnfRole != null) {
+ vnfResources = db.getVnfResourcesByRole (vnfRole);
+ } else {
+ vnfResources = db.getAllVnfResources ();
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("No connection to catalog DB", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "No connection to catalog DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + e.toString ());
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity (e.toString ()).build ();
+ }
+
+ if (vnfResources == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Error:no vnf types found");
+ msoLogger.debug ("End of the transaction. No VNF Types found. The final response status is: " + HttpStatus.SC_NOT_FOUND);
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+ VnfTypes vnfTypes = beansObjectFactory.createVnfTypes ();
+ 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 ()));
+ vnfTypes.getVnfType ().add (vnfType);
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VnfTypes.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (vnfTypes, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Error marshalling", e);
+ }
+
+ String response = stringWriter.toString ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + response);
+ return Response.status (HttpStatus.SC_OK).entity (response).build ();
+ }
+}
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
new file mode 100644
index 0000000000..3190fc507e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
@@ -0,0 +1,367 @@
+package org.openecomp.mso.apihandlerinfra;
+
+/*-
+ * #%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%
+ */
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+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 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.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType;
+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.VolumeInputs;
+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.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/{version: v1|v2|v3}/volume-request")
+public class VolumeInfoHandler {
+
+ protected ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ @GET
+ public Response queryFilters (@QueryParam("vnf-type") String vnfType,
+ @QueryParam("service-type") String serviceType,
+ @QueryParam("aic-node-clli") String aicNodeClli,
+ @QueryParam("tenantId") String tenantId,
+ @QueryParam("volume-group-id") String volumeGroupId,
+ @QueryParam("volume-group-name") String volumeGroupName,
+ @PathParam("version") String version) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VolumeQueryFilters");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for queryFilter with vnf-type:" + vnfType
+ + " service-type:" + serviceType
+ + " aic-node-clli:" + aicNodeClli
+ + " tenant-id:" + tenantId
+ + " volume-group-id:" + volumeGroupId
+ + " volume-group-name:" + volumeGroupName);
+ Response response = null;
+ if (vnfType != null) {
+ response = this.getRequestList ("vnfType", vnfType, version);
+ } else {
+ response = queryGenericFilters (serviceType, aicNodeClli, tenantId, volumeGroupId, volumeGroupName, version);
+ }
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ @GET
+ @Path(Constants.REQUEST_ID_PATH)
+ public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
+
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VolumeGetRequest");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getRequest with request-id:" + requestId);
+
+ Response response = getRequestGeneric (requestId, version);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+
+ protected void fillVolumeRequest (VolumeRequest qr, InfraRequests ar, String version) {
+ VolumeInputs vi = beansObjectFactory.createVolumeInputs ();
+
+ if (ar.getVolumeGroupId () != null) {
+ vi.setVolumeGroupId (ar.getVolumeGroupId ());
+ }
+ if (ar.getVolumeGroupName () != null) {
+ vi.setVolumeGroupName (ar.getVolumeGroupName ());
+ }
+ if (ar.getVnfType () != null) {
+ vi.setVnfType (ar.getVnfType ());
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (ar.getServiceType () != null) {
+ vi.setServiceType (ar.getServiceType ());
+ }
+ if (ar.getAicNodeClli () != null) {
+ vi.setAicNodeClli (ar.getAicNodeClli ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ if (ar.getServiceInstanceId () != null) {
+ vi.setServiceInstanceId (ar.getServiceInstanceId ());
+ }
+ if (ar.getVnfId () != null) {
+ vi.setVnfId (ar.getVnfId ());
+ }
+ }
+ if (ar.getTenantId () != null) {
+ vi.setTenantId (ar.getTenantId ());
+ }
+
+ qr.setVolumeInputs (vi);
+
+ qr.setVolumeParams(ar.getVnfParams ());
+
+ try {
+ String volumeoutputs = ar.getVnfOutputs ();
+ if (volumeoutputs != null && volumeoutputs.length () > 0) {
+ msoLogger.debug ("Read VOLUME outputs: " + volumeoutputs);
+ VolumeOutputs volumeOutput = null;
+
+ // Now unmarshal it into network outputs
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeOutputs.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (volumeoutputs));
+ SAXSource source = new SAXSource (inputSource);
+
+ volumeOutput = (VolumeOutputs) jaxbUnmarshaller.unmarshal (source, VolumeOutputs.class).getValue ();
+
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed", e);
+ throw new ValidationException ("format for volume outputs");
+ }
+
+ qr.setVolumeOutputs (volumeOutput);
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("exception reading networkOutputs Clob", e);
+ }
+ }
+
+ protected Response queryGenericFilters (String serviceType, String aicNodeClli, String tenantId, String volumeGroupId, String volumeGroupName, String version) {
+ if (serviceType != null) {
+ return this.getRequestList ("serviceType", serviceType, version);
+ }
+ if (aicNodeClli != null) {
+ return this.getRequestList ("aicNodeClli", aicNodeClli, version);
+ }
+ if (tenantId != null) {
+ return this.getRequestList ("tenantId", tenantId, version);
+ }
+ if (volumeGroupName != null) {
+ return this.getRequestList ("volumeGroupName", volumeGroupName, version);
+ }
+ if (volumeGroupId != null) {
+ return this.getRequestList ("volumeGroupId", volumeGroupId, version);
+ }
+ return Response.status (HttpStatus.SC_BAD_REQUEST).entity ("").build ();
+ }
+
+
+ protected Response getRequestGeneric (String requestId, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest: " + requestId);
+
+ String responseString = null;
+
+ InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId,
+ "VOLUME");
+ if (activeReq != null) {
+ // build response for active
+ responseString = infraRequestsResponse (activeReq, version);
+ return Response.status (HttpStatus.SC_OK).entity (responseString).build ();
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ protected Response getRequestList (String queryAttribute, String queryValue, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
+
+ List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ queryValue,
+ "VOLUME");
+
+ List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+
+ if (activeReqList != null) {
+ // build response for active
+ queryResponseList = infraRequestsResponses (activeReqList, version);
+
+ }
+
+
+ if (queryResponseList != null && !queryResponseList.isEmpty ()) {
+ String result = this.translateVolumeRequests (queryResponseList);
+ return Response.status (HttpStatus.SC_OK).entity (result).build ();
+
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ private VolumeRequest fillGeneric (InfraRequests ar) {
+ VolumeRequest qr = beansObjectFactory.createVolumeRequest ();
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (ar.getRequestId ());
+ ri.setAction (ActionType.fromValue (ar.getAction ()));
+ ri.setRequestStatus (RequestStatusType.fromValue (ar.getRequestStatus ()));
+ if (ar.getProgress () != null) {
+ ri.setProgress (ar.getProgress ().intValue ());
+ }
+ if (ar.getSource () != null) {
+ ri.setSource (ar.getSource ());
+ }
+
+ ri.setStartTime (ar.getStartTime ().toString ());
+ if (ar.getEndTime () != null) {
+ ri.setEndTime (ar.getEndTime ().toString ());
+ }
+
+ if (ar.getStatusMessage () != null) {
+ ri.setStatusMessage (ar.getStatusMessage ());
+ }
+ qr.setRequestInfo (ri);
+ return qr;
+ }
+
+ private List <VolumeRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
+ List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+
+ for (InfraRequests ar : arList) {
+ VolumeRequest qr = fillGeneric (ar);
+ fillVolumeRequest (qr, ar, version);
+ queryResponseList.add (qr);
+ }
+ return queryResponseList;
+ }
+
+ private String translateVolumeRequests (List <VolumeRequest> queryResponseList) {
+ VolumeRequests queryResponses = new VolumeRequests ();
+ for (int i = 0; i < queryResponseList.size (); i++) {
+ queryResponses.getVolumeRequest ().add (queryResponseList.get (i));
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequests.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (queryResponses, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ return stringWriter.toString ();
+ }
+
+ private String infraRequestsResponse (InfraRequests ar, String version) {
+ VolumeRequest qr = fillGeneric (ar);
+ fillVolumeRequest (qr, ar, version);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (qr, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ String response = stringWriter.toString ();
+ return response;
+ }
+
+ private String getAuditLogReturnMsg (Response response) {
+ String returnMsg = "";
+ if (response.getStatus() == HttpStatus.SC_OK) {
+ returnMsg = "Successful. StatusCode=" + HttpStatus.SC_OK;
+ } else if (response.getStatus() == HttpStatus.SC_NOT_FOUND) {
+ returnMsg = "Record not found . StatusCode=" + HttpStatus.SC_NOT_FOUND;
+ } else if (response.getStatus() == HttpStatus.SC_BAD_REQUEST) {
+ returnMsg = "Bad request: one of the following attribute serviceType, aicNodeClli, tenantId, volumeGroupId, volumeGroupName should be defined. StatusCode=" + HttpStatus.SC_BAD_REQUEST;
+ }
+ return returnMsg;
+ }
+}
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
new file mode 100644
index 0000000000..42ef60bfaf
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
@@ -0,0 +1,644 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+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.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.hibernate.Query;
+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.xml.sax.InputSource;
+
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeInputs;
+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.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.HibernateUtil;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+public class VolumeMsoInfraRequest {
+
+ private String requestId;
+ private String requestXML;
+ private String requestUri;
+ private RequestInfo rinfo;
+ private VolumeInputs volumeInputs;
+ private String volumeParams;
+ private ActionType action;
+ private String errorMessage;
+ private String httpResponse;
+ private String responseBody;
+ private RequestStatusType status;
+ private long startTime;
+ private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static final String NOT_PROVIDED = "not provided";
+
+ VolumeMsoInfraRequest (String requestId) {
+ this.requestId = requestId;
+ Calendar startTimeCalendar = Calendar.getInstance ();
+ this.startTime = startTimeCalendar.getTimeInMillis ();
+ MsoLogger.setLogContext (requestId, null);
+
+ }
+
+ // Parse request XML
+ void parse (String reqXML, String version, MsoJavaProperties props) throws ValidationException {
+
+ msoLogger.debug ("Validating the request");
+
+ this.requestXML = reqXML;
+
+ VolumeRequest volumeReq = null;
+ boolean isWrongRootElement = false;
+
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (reqXML));
+ SAXSource source = new SAXSource (inputSource);
+
+ if (reqXML.contains ("volume-request") && !reqXML.contains("vnf-request")) {
+ volumeReq = jaxbUnmarshaller.unmarshal (source, VolumeRequest.class).getValue ();
+ } else {
+ isWrongRootElement = true;
+ }
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_VNFREQUEST_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", e);
+ throw new ValidationException ("format for volume request");
+ }
+
+ if (isWrongRootElement) {
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR_REASON, "root element is not correct", "", "", MsoLogger.ErrorCode.SchemaError, "root element <volume-request> expected");
+ throw new ValidationException ("root element <volume-request> expected");
+ }
+
+ if (volumeReq == null) {
+ throw new ValidationException ("volume-request");
+ }
+
+ this.rinfo = volumeReq.getRequestInfo ();
+
+ if (this.rinfo == null) {
+ throw new ValidationException ("request-info");
+ }
+
+ action = this.rinfo.getAction ();
+ if (action == null) {
+ throw new ValidationException ("action");
+ }
+ this.volumeInputs = volumeReq.getVolumeInputs ();
+ if (this.volumeInputs == null) {
+ throw new ValidationException ("volume-inputs");
+ }
+
+ // Verify that the elements correspond to the version
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null ||
+ this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null ||
+ this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) {
+ throw new ValidationException ("format for v1 version of volume request");
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null ||
+ this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) {
+ throw new ValidationException ("format for v2 version of volume request");
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) {
+ throw new ValidationException ("format for v3 version of volume request");
+ }
+ }
+
+
+ if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) {
+ throw new ValidationException ("action allowable for version " + version + " of volume request");
+ }
+
+ switch (action) {
+ case UPDATE:
+ case DELETE:
+ case UPDATE_VF_MODULE_VOL:
+ case DELETE_VF_MODULE_VOL:
+ if (this.volumeInputs.getVolumeGroupId () == null) {
+ throw new ValidationException ("volume-group-id");
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (ActionType.CREATE.equals (action) || ActionType.CREATE_VF_MODULE_VOL.equals(action)) {
+ if (this.volumeInputs.getVolumeGroupName () == null) {
+ throw new ValidationException ("volume-group-name");
+ }
+ if (!InfraUtils.isValidHeatName(this.volumeInputs.getVolumeGroupName ())) {
+ throw new ValidationException ("volume-group-name: no value meeting heat stack name syntax requirements");
+ }
+ }
+
+
+ if (this.volumeInputs.getVnfType () == null) {
+ throw new ValidationException ("vnf-type");
+ }
+
+
+ switch (action) {
+ case CREATE_VF_MODULE_VOL:
+ case UPDATE_VF_MODULE_VOL:
+ case DELETE_VF_MODULE_VOL:
+ if (this.volumeInputs.getVfModuleModelName () == null) {
+ throw new ValidationException ("vf-module-model-name");
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!version.equals(Constants.SCHEMA_VERSION_V1) && this.volumeInputs.getServiceId () == null) {
+ throw new ValidationException ("service-id ");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1) && this.volumeInputs.getServiceType () != null && this.volumeInputs.getServiceId () != null) {
+ throw new ValidationException ("service-type or service-id ");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1) && this.volumeInputs.getAicNodeClli () == null) {
+ throw new ValidationException ("aic-node-clli");
+ }
+
+ if ((version.equals(Constants.SCHEMA_VERSION_V2) || version.equals(Constants.SCHEMA_VERSION_V3)) && (this.volumeInputs.getAicCloudRegion () == null || this.volumeInputs.getAicCloudRegion ().isEmpty())) {
+ throw new ValidationException ("aic-cloud-region");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V3) && this.volumeInputs.getServiceInstanceId () == null) {
+ throw new ValidationException ("service-instance-id");
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V3) && this.volumeInputs.getVnfId () == null && ActionType.CREATE_VF_MODULE_VOL.equals(action)) {
+ throw new ValidationException ("vnf-id");
+ }
+
+ if (ActionType.CREATE.equals (action) || ActionType.CREATE_VF_MODULE_VOL.equals(action)) {
+ if (this.volumeInputs.getTenantId () == null) {
+ throw new ValidationException ("tenant-id");
+ }
+ }
+
+
+ Object vpN = volumeReq.getVolumeParams ();
+
+ if (vpN != null) {
+ Node node = (Node) vpN;
+ Document doc = node.getOwnerDocument ();
+ this.volumeParams = domToStr (doc);
+ }
+
+ msoLogger.debug ("VolumeParams: " + this.volumeParams);
+
+
+ msoLogger.debug ("Request valid");
+
+ // Rebuild the request string for BPEL to include request-id
+ rinfo.setRequestId (this.requestId);
+ volumeReq.setRequestInfo (rinfo);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (volumeReq, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ this.requestXML = stringWriter.toString ().replace("http://ecomp.att.com/mso/infra/volume-request",
+ "http://ecomp.att.com/mso/infra/vnf-request");
+
+ msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML);
+
+ }
+
+ public void createRequestRecord (Status status) {
+
+ Session session = null;
+ try {
+
+ session = HibernateUtil.getSessionFactory ().openSession ();
+ session.beginTransaction ();
+
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ aq.setRequestId (requestId);
+
+ Timestamp startTimeStamp = new Timestamp (Calendar.getInstance ().getTimeInMillis ());
+ if (rinfo != null) {
+ if (rinfo.getAction () != null) {
+ aq.setAction (rinfo.getAction ().value ());
+ aq.setRequestAction (RequestActionMap.getMappedRequestAction (rinfo.getAction ().value ()));
+ }
+ aq.setSource (rinfo.getSource ());
+ } else {
+ // Set up mandatory parameters
+ aq.setAction (NOT_PROVIDED);
+ aq.setAction (NOT_PROVIDED);
+ }
+
+ aq.setRequestBody (this.requestXML);
+ aq.setRequestScope (ModelType.volumeGroup.name ());
+
+ if (volumeInputs != null) {
+ if (volumeInputs.getVolumeGroupId () != null) {
+ aq.setVolumeGroupId (volumeInputs.getVolumeGroupId ());
+ }
+ if (volumeInputs.getVolumeGroupName () != null) {
+ aq.setVolumeGroupName (volumeInputs.getVolumeGroupName ());
+ }
+ if (volumeInputs.getVnfType () != null) {
+ aq.setVnfType (volumeInputs.getVnfType ());
+ }
+ if (volumeInputs.getVnfId () != null) {
+ aq.setVnfId (volumeInputs.getVnfId ());
+ }
+ if (volumeInputs.getServiceInstanceId () != null) {
+ aq.setServiceInstanceId (volumeInputs.getServiceInstanceId ());
+ }
+ if (volumeInputs.getServiceType () != null) {
+ aq.setServiceType (volumeInputs.getServiceType ());
+ }
+ if (volumeInputs.getServiceId () != null) {
+ aq.setAaiServiceId (volumeInputs.getServiceId ());
+ }
+ if (volumeInputs.getAicNodeClli () != null) {
+ aq.setAicNodeClli (volumeInputs.getAicNodeClli ());
+ }
+ if (volumeInputs.getAicCloudRegion () != null) {
+ aq.setAicCloudRegion (volumeInputs.getAicCloudRegion ());
+ }
+ if (volumeInputs.getTenantId () != null) {
+ aq.setTenantId (volumeInputs.getTenantId ());
+ }
+
+ }
+ aq.setStartTime (startTimeStamp);
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+ aq.setRequestType ("VOLUME");
+
+ if (volumeParams != null) {
+ msoLogger.debug ("Storing volumeParams: " + volumeParams);
+ aq.setVnfParams (this.volumeParams);
+ }
+
+ if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
+ aq.setStatusMessage (this.errorMessage);
+ aq.setResponseBody (this.responseBody);
+
+ Calendar endTime = Calendar.getInstance ();
+ Timestamp endTimeStamp = new Timestamp (endTime.getTimeInMillis ());
+ aq.setEndTime (endTimeStamp);
+ }
+ aq.setProgress (this.progress);
+
+
+ msoLogger.debug ("About to insert a record");
+
+ session.save (aq);
+ session.getTransaction ().commit ();
+ session.close ();
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in createRequestRecord", e);
+ if (session != null) {
+ session.close ();
+ }
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ }
+
+ public void updateFinalStatus (Status status) {
+ int result = 0;
+ try {
+ result = RequestsDatabase.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");
+ msoLogger.debug("Exception: ", e);
+ }
+ }
+
+ public Response buildResponse (int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
+ return buildResponseWithError (httpResponseCode, errorCode, inProgress, null);
+ }
+
+ public Response buildResponseWithError (int httpResponseCode,
+ String errorCode,
+ InfraActiveRequests inProgress,
+ String errorString) {
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ VolumeRequest vr = beansObjectFactory.createVolumeRequest ();
+
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+
+ ri.setRequestId (requestId);
+ ri.setRequestStatus (this.status);
+ ri.setAction (this.rinfo.getAction ());
+ ri.setSource (this.rinfo.getSource ());
+
+ String errorMsg = null;
+ if (errorCode != null) {
+ // If error code is actually an XML error response from BPEL, treat it specially:
+ if (!Messages.errors.containsKey (errorCode)) {
+ if (errorCode.length () > 300) {
+ errorMsg = errorCode.substring (0, 299);
+ } else {
+ errorMsg = errorCode;
+ }
+
+ } else {
+
+ if (inProgress == null) {
+ if (errorCode.equals(ErrorNumbers.RECIPE_DOES_NOT_EXIST)) {
+ errorMsg = String.format (Messages.errors.get (errorCode), "volume", errorString);
+ }
+ else {
+ errorMsg = String.format (Messages.errors.get (errorCode), errorString);
+ }
+ } else if (errorCode.equals (ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS)) {
+ errorMsg = String.format (Messages.errors.get (errorCode),
+ "volume",
+ inProgress.getVnfName (),
+ inProgress.getRequestStatus (),
+ "volume");
+ } else if (errorCode.equals (ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID)) {
+ errorMsg = String.format (Messages.errors.get (errorCode),
+ "volume",
+ inProgress.getVnfId (),
+ inProgress.getRequestStatus (),
+ inProgress.getAction (),
+ "volume");
+ }
+ }
+
+ ri.setStatusMessage (errorMsg);
+ this.errorMessage = errorMsg;
+ }
+ ri.setProgress ((int) this.progress);
+
+ Date startDate = new Date (this.startTime);
+ SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
+ String startTimeString = sdf.format (startDate);
+
+ ri.setStartTime (startTimeString);
+
+ vr.setRequestInfo (ri);
+ vr.setVolumeInputs (this.volumeInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (vr, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Exception: ", e);
+ }
+
+ String response = stringWriter.toString ();
+
+ this.httpResponse = Integer.toString (httpResponseCode);
+ this.responseBody = response;
+
+ // Log the failed request into the MSO Requests database
+
+ return Response.status (httpResponseCode).entity (response).build ();
+
+ }
+
+ public Response buildResponseFailedValidation (int httpResponseCode, String exceptionMessage) {
+
+ ObjectFactory beansObjectFactory = new ObjectFactory ();
+ VolumeRequest vr = beansObjectFactory.createVolumeRequest ();
+
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (requestId);
+
+ if (this.rinfo != null) {
+ if (this.rinfo.getAction () != null) {
+ ri.setAction (this.rinfo.getAction ());
+ } else {
+ ri.setAction (ActionType.NOT_PROVIDED);
+ }
+ if (this.rinfo.getSource () != null) {
+ ri.setSource (this.rinfo.getSource ());
+ }
+ } else {
+ ri.setAction (ActionType.NOT_PROVIDED);
+ }
+
+ // Nothing more is expected for this request
+
+ String errorMsg = String.format (Messages.errors.get (ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION
+ + "_service"),
+ exceptionMessage);
+ ri.setStatusMessage (errorMsg);
+ this.errorMessage = errorMsg;
+
+ ri.setProgress ((int) this.progress);
+ ri.setRequestStatus (RequestStatusType.FAILED);
+ Date startDate = new Date (this.startTime);
+ SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
+ String startTimeString = sdf.format (startDate);
+
+ ri.setStartTime (startTimeString);
+
+ vr.setRequestInfo (ri);
+ vr.setVolumeInputs (this.volumeInputs);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (vr, stringWriter);
+
+ } catch (JAXBException e) {
+ msoLogger.debug ("Error marshalling", e);
+ }
+
+ String response = stringWriter.toString ();
+
+ this.httpResponse = Integer.toString (httpResponseCode);
+ this.responseBody = response;
+
+ return Response.status (httpResponseCode).entity (response).build ();
+ }
+
+ public String getRequestUri () {
+ return requestUri;
+ }
+
+ public void setRequestUri (String requestUri) {
+ this.requestUri = requestUri;
+ }
+
+ public VolumeInputs getVolumeInputs () {
+ return volumeInputs;
+ }
+
+ public RequestInfo getRequestInfo () {
+ return rinfo;
+ }
+
+ public String getResponseBody () {
+ return responseBody;
+ }
+
+ public void setResponseBody (String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+ public String getHttpResponse () {
+ return httpResponse;
+ }
+
+ public void setHttpResponse (String httpResponse) {
+ this.httpResponse = httpResponse;
+ }
+
+ public String getRequestId () {
+ return requestId;
+ }
+
+ public String getRequestXML () {
+ return requestXML;
+ }
+
+ public void setRequestXML (String requestXML) {
+ this.requestXML = requestXML;
+ }
+
+ public RequestStatusType getStatus () {
+ return status;
+ }
+
+ public void setStatus (RequestStatusType status) {
+ this.status = status;
+ switch (status) {
+ case FAILED:
+ case COMPLETE:
+ this.progress = Constants.PROGRESS_REQUEST_COMPLETED;
+ break;
+ case IN_PROGRESS:
+ this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS;
+ break;
+ }
+ }
+
+ public String getServiceType () {
+ if (this.volumeInputs.getServiceType () != null)
+ return this.volumeInputs.getServiceType ();
+ if (this.volumeInputs.getServiceId () != null)
+ return this.volumeInputs.getServiceId ();
+ return null;
+ }
+
+ public static String domToStr (Document doc) {
+ if (doc == null) {
+ return null;
+ }
+
+ try {
+ StringWriter sw = new StringWriter ();
+ StreamResult sr = new StreamResult (sw);
+ TransformerFactory tf = TransformerFactory.newInstance ();
+ Transformer t = tf.newTransformer ();
+ t.setOutputProperty (OutputKeys.STANDALONE, "yes");
+ NodeList nl = doc.getDocumentElement ().getChildNodes ();
+ DOMSource source = null;
+ for (int x = 0; x < nl.getLength (); x++) {
+ Node e = nl.item (x);
+ if (e instanceof Element) {
+ source = new DOMSource (e);
+ break;
+ }
+ }
+ if (source != null) {
+ t.transform (source, sr);
+
+ String s = sw.toString ();
+ return s;
+ }
+
+ return null;
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception in domToStr", e);
+ }
+ return null;
+ }
+}
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
new file mode 100644
index 0000000000..7c1b74c684
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
@@ -0,0 +1,746 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+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.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.sax.SAXSource;
+
+import org.xml.sax.InputSource;
+
+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.volumebeans.ActionType;
+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.VolumeInputs;
+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.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Recipe;
+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.InfraRequests;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+@Path("/{version: v1|v2|v3}/volume-request")
+public class VolumeRequestHandler {
+
+ @Context
+ private UriInfo uriInfo;
+
+ protected ObjectFactory beansObjectFactory = new ObjectFactory ();
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties ();
+
+ private static final String NOT_FOUND = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Started</title></head><body>Application not started, properties file missing or invalid or Database Connection failed</body></html>";
+
+ private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
+ .entity (NOT_FOUND)
+ .build ();
+
+ @GET
+ public Response queryFilters (@QueryParam("vnf-type") String vnfType,
+ @QueryParam("service-type") String serviceType,
+ @QueryParam("aic-node-clli") String aicNodeClli,
+ @QueryParam("tenantId") String tenantId,
+ @QueryParam("volume-group-id") String volumeGroupId,
+ @QueryParam("volume-group-name") String volumeGroupName,
+ @PathParam("version") String version) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VolumeQueryFilters");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for queryFilter with vnf-type:" + vnfType
+ + " service-type:" + serviceType
+ + " aic-node-clli:" + aicNodeClli
+ + " tenant-id:" + tenantId
+ + " volume-group-id:" + volumeGroupId
+ + " volume-group-name:" + volumeGroupName);
+ Response response = null;
+ if (vnfType != null) {
+ response = this.getRequestList ("vnfType", vnfType, version);
+ } else {
+ response = queryGenericFilters (serviceType, aicNodeClli, tenantId, volumeGroupId, volumeGroupName, version);
+ }
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ @GET
+ @Path(Constants.REQUEST_ID_PATH)
+ public Response getRequest (@PathParam("request-id") String requestId, @PathParam("version") String version) {
+
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("VolumeGetRequest");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ msoLogger.debug ("Incoming request received for getRequest with request-id:" + requestId);
+
+ Response response = getRequestGeneric (requestId, version);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+
+ protected void fillVolumeRequest (VolumeRequest qr, InfraRequests ar, String version) {
+ VolumeInputs vi = beansObjectFactory.createVolumeInputs ();
+
+ if (ar.getVolumeGroupId () != null) {
+ vi.setVolumeGroupId (ar.getVolumeGroupId ());
+ }
+ if (ar.getVolumeGroupName () != null) {
+ vi.setVolumeGroupName (ar.getVolumeGroupName ());
+ }
+ if (ar.getVnfType () != null) {
+ vi.setVnfType (ar.getVnfType ());
+ }
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (ar.getServiceType () != null) {
+ vi.setServiceType (ar.getServiceType ());
+ }
+ if (ar.getAicNodeClli () != null) {
+ vi.setAicNodeClli (ar.getAicNodeClli ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ }
+ else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
+ if (ar.getAaiServiceId () != null) {
+ vi.setServiceId (ar.getAaiServiceId ());
+ }
+ if (ar.getAicCloudRegion () != null) {
+ vi.setAicCloudRegion (ar.getAicCloudRegion ());
+ }
+ if (ar.getVfModuleModelName () != null) {
+ vi.setVfModuleModelName (ar.getVfModuleModelName ());
+ }
+ if (ar.getServiceInstanceId () != null) {
+ vi.setServiceInstanceId (ar.getServiceInstanceId ());
+ }
+ if (ar.getVnfId () != null) {
+ vi.setVnfId (ar.getVnfId ());
+ }
+ }
+ if (ar.getTenantId () != null) {
+ vi.setTenantId (ar.getTenantId ());
+ }
+
+ qr.setVolumeInputs (vi);
+
+ qr.setVolumeParams(ar.getVnfParams ());
+
+ try {
+ String volumeoutputs = ar.getVnfOutputs ();
+ if (volumeoutputs != null && volumeoutputs.length () > 0) {
+ msoLogger.debug ("Read VOLUME outputs: " + volumeoutputs);
+ VolumeOutputs volumeOutput = null;
+
+ // Now unmarshal it into network outputs
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeOutputs.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller ();
+
+ InputSource inputSource = new InputSource (new StringReader (volumeoutputs));
+ SAXSource source = new SAXSource (inputSource);
+
+ volumeOutput = (VolumeOutputs) jaxbUnmarshaller.unmarshal (source, VolumeOutputs.class).getValue ();
+
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed", e);
+ throw new ValidationException ("format for volume outputs");
+ }
+
+ qr.setVolumeOutputs (volumeOutput);
+ }
+ } catch (Exception e) {
+ msoLogger.debug ("exception reading networkOutputs Clob", e);
+ }
+ }
+
+ protected Response queryGenericFilters (String serviceType, String aicNodeClli, String tenantId, String volumeGroupId, String volumeGroupName, String version) {
+ if (serviceType != null) {
+ return this.getRequestList ("serviceType", serviceType, version);
+ }
+ if (aicNodeClli != null) {
+ return this.getRequestList ("aicNodeClli", aicNodeClli, version);
+ }
+ if (tenantId != null) {
+ return this.getRequestList ("tenantId", tenantId, version);
+ }
+ if (volumeGroupName != null) {
+ return this.getRequestList ("volumeGroupName", volumeGroupName, version);
+ }
+ if (volumeGroupId != null) {
+ return this.getRequestList ("volumeGroupId", volumeGroupId, version);
+ }
+ return Response.status (HttpStatus.SC_BAD_REQUEST).entity ("").build ();
+ }
+
+
+ protected Response getRequestGeneric (String requestId, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest: " + requestId);
+
+ String responseString = null;
+
+ InfraActiveRequests activeReq = RequestsDatabase.getRequestFromInfraActive (requestId,
+ "VOLUME");
+ if (activeReq != null) {
+ // build response for active
+ responseString = infraRequestsResponse (activeReq, version);
+ return Response.status (HttpStatus.SC_OK).entity (responseString).build ();
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ protected Response getRequestList (String queryAttribute, String queryValue, String version) {
+ // Check INFRA_ACTIVE_REQUESTS table to find info
+ // on this request
+
+ getMsoLogger ().debug ("getRequest based on " + queryAttribute + ": " + queryValue);
+
+ List <InfraActiveRequests> activeReqList = RequestsDatabase.getRequestListFromInfraActive (queryAttribute,
+ queryValue,
+ "VOLUME");
+
+ List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+
+ if (activeReqList != null) {
+ // build response for active
+ queryResponseList = infraRequestsResponses (activeReqList, version);
+
+ }
+
+
+ if (queryResponseList != null && !queryResponseList.isEmpty ()) {
+ String result = this.translateVolumeRequests (queryResponseList);
+ return Response.status (HttpStatus.SC_OK).entity (result).build ();
+
+ } else {
+ // Report that no request has been found
+ return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build ();
+ }
+ }
+
+ private VolumeRequest fillGeneric (InfraRequests ar) {
+ VolumeRequest qr = beansObjectFactory.createVolumeRequest ();
+ RequestInfo ri = beansObjectFactory.createRequestInfo ();
+ ri.setRequestId (ar.getRequestId ());
+ ri.setAction (ActionType.fromValue (ar.getAction ()));
+ ri.setRequestStatus (RequestStatusType.fromValue (ar.getRequestStatus ()));
+ if (ar.getProgress () != null) {
+ ri.setProgress (ar.getProgress ().intValue ());
+ }
+ if (ar.getSource () != null) {
+ ri.setSource (ar.getSource ());
+ }
+
+ ri.setStartTime (ar.getStartTime ().toString ());
+ if (ar.getEndTime () != null) {
+ ri.setEndTime (ar.getEndTime ().toString ());
+ }
+
+ if (ar.getStatusMessage () != null) {
+ ri.setStatusMessage (ar.getStatusMessage ());
+ }
+ qr.setRequestInfo (ri);
+ return qr;
+ }
+
+ private List <VolumeRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
+ List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+
+ for (InfraRequests ar : arList) {
+ VolumeRequest qr = fillGeneric (ar);
+ fillVolumeRequest (qr, ar, version);
+ queryResponseList.add (qr);
+ }
+ return queryResponseList;
+ }
+
+ private String translateVolumeRequests (List <VolumeRequest> queryResponseList) {
+ VolumeRequests queryResponses = new VolumeRequests ();
+ for (int i = 0; i < queryResponseList.size (); i++) {
+ queryResponses.getVolumeRequest ().add (queryResponseList.get (i));
+ }
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequests.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ // output pretty printed
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ jaxbMarshaller.marshal (queryResponses, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ return stringWriter.toString ();
+ }
+
+ private String infraRequestsResponse (InfraRequests ar, String version) {
+ VolumeRequest qr = fillGeneric (ar);
+ fillVolumeRequest (qr, ar, version);
+
+ StringWriter stringWriter = new StringWriter ();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller ();
+
+ jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbMarshaller.marshal (qr, stringWriter);
+
+ } catch (JAXBException e) {
+ getMsoLogger ().debug ("Marshalling issue", e);
+ }
+
+ String response = stringWriter.toString ();
+ return response;
+ }
+
+ private String getAuditLogReturnMsg (Response response) {
+ String returnMsg = "";
+ if (response.getStatus() == HttpStatus.SC_OK) {
+ returnMsg = "Successful. StatusCode=" + HttpStatus.SC_OK;
+ } else if (response.getStatus() == HttpStatus.SC_NOT_FOUND) {
+ returnMsg = "Record not found . StatusCode=" + HttpStatus.SC_NOT_FOUND;
+ } else if (response.getStatus() == HttpStatus.SC_BAD_REQUEST) {
+ returnMsg = "Bad request: one of the following attribute serviceType, aicNodeClli, tenantId, volumeGroupId, volumeGroupName should be defined. StatusCode=" + HttpStatus.SC_BAD_REQUEST;
+ }
+ return returnMsg;
+ }
+
+ @POST
+ @Path("/")
+ @Produces(MediaType.APPLICATION_XML)
+ public Response manageVolumeRequest (String reqXML, @PathParam("version") String version) {
+ MsoLogger.setServiceName ("VolumeRequest");
+ if ("v1".equals(version)) {
+ return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1);
+ } else if ("v2".equals(version)) {
+ return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2);
+ } else if ("v3".equals(version)) {
+ return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3);
+ } else {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Version not found");
+ return Response.status(HttpStatus.SC_NOT_FOUND).build();
+ }
+ }
+
+ private Response manageVolumeRequestImpl (String reqXML, String version) {
+ String methodName = "VolumeRequest";
+ props = MsoPropertiesUtils.loadMsoProperties ();
+
+ long startTime = System.currentTimeMillis ();
+ if (MsoPropertiesUtils.getNoPropertiesState()) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application not started, properties file missing or invalid");
+ return NOT_STARTED_RESPONSE;
+ }
+
+ uriInfo.getRequestUri ();
+
+ // Generate unique request id for the new request
+ UUID requestUUID = UUID.randomUUID ();
+
+ VolumeMsoInfraRequest msoRequest = new VolumeMsoInfraRequest (requestUUID.toString ());
+
+ if (reqXML == null) {
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The input request is null");
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ String requestUri = uriInfo.getRequestUri ().toString ();
+
+ msoLogger.debug ("Incoming Request: " + reqXML);
+
+ msoRequest.setRequestUri (requestUri);
+
+ msoLogger.debug ("Schema version: " + version);
+ try {
+ msoRequest.parse (reqXML, version, props);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ());
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ msoRequest.createRequestRecord (Status.FAILED);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", 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;
+ }
+ MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo ().getAction ().name ());
+ msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo ().getAction ().name ());
+ if (msoRequest.getRequestInfo ()
+ .getAction () == org.openecomp.mso.apihandlerinfra.volumebeans.ActionType.CREATE) {
+ // Check if this request is a duplicate of the one with the same network Name
+ msoLogger.debug ("Checking for a duplicate with the same volume-name");
+ InfraActiveRequests dup = null;
+ try {
+
+ dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VOLUME");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "volume-group-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ "CREATE on the same Volume Group Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same Volume Group Name is already progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same Volume Group Name is already progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ } else {
+ // Check if this request is a duplicate of the one with the same volumeGroupId
+ InfraActiveRequests dup = null;
+ msoLogger.debug ("Checking for a duplicate with the same volume-group-id");
+ try {
+ dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (),
+ msoRequest.getRequestInfo ().getAction ().value (),
+ "VOLUME");
+
+ } catch (Exception e) {
+ msoLogger.debug ("Exception", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "volume-group-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the sam volume-group-id", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the sam volume-group-id");
+ 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.
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT,
+ ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID,
+ dup);
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND,
+ msoRequest.getRequestInfo ().getAction ().value ()
+ + " on the same Volume Group Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same Volume Group Id already in progress");
+ msoRequest.createRequestRecord (Status.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same Volume Group Id already in progress");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ String orchestrationURI = "";
+
+ // Query MSO Catalog DB
+ try(CatalogDatabase db = new CatalogDatabase ()) {
+ Recipe recipe = null;
+
+ if (version.equals(Constants.SCHEMA_VERSION_V1)) {
+ if (msoRequest.getServiceType () != null
+ && msoRequest.getServiceType ().length () > 0) {
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (),
+ msoRequest.getServiceType ());
+ }
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipe (Constants.VNF_TYPE_WILDCARD,
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (),
+ null);
+ }
+ }
+ }
+ else if (version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) {
+ switch (msoRequest.getRequestInfo ().getAction ()) {
+ case CREATE:
+ case UPDATE:
+ case DELETE:
+ // First get recipe for the vnf type given
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (), null);
+
+ // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type
+ if (recipe == null) {
+ recipe = db.getVnfComponentsRecipe (Constants.VNF_TYPE_WILDCARD,
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (), null);
+ }
+ break;
+ case CREATE_VF_MODULE_VOL:
+ case UPDATE_VF_MODULE_VOL:
+ case DELETE_VF_MODULE_VOL:
+ // First get recipe for the vnf type given
+ recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (),
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value (), null);
+
+ // 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,
+ Constants.VOLUME_GROUP_COMPONENT_TYPE,
+ msoRequest.getRequestInfo ().getAction ().value ());
+ }
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ if (recipe == null) {
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "VNF Recipe not found in DB");
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.RECIPE_DOES_NOT_EXIST,
+ null,
+ "");
+ msoRequest.createRequestRecord (Status.FAILED);
+ db.close ();
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "VNF Recipe not found in DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ orchestrationURI = recipe.getOrchestrationUri ();
+ msoLogger.debug ("Orchestration URI is: " + orchestrationURI);
+ String requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ msoRequest.createRequestRecord (Status.PENDING);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception in createRequestRecord", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB,
+ null,
+ "non-unique request-id specified");
+ // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try
+ // to create a failed record
+ 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 (orchestrationURI, props);
+ // Capture audit event
+ msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+ response = requestClient.post (msoRequest.getRequestXML (),
+ requestId,
+ Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ version,
+ null,
+ null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_COMMUNICATION_TO_BPEL,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e);
+ 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.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.NO_RESPONSE_FROM_BPEL,
+ null,
+ "bpelResponse is null");
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.DataError, "Null response from BPMN engine");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN engine");
+ 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 bpelXMLResponseBody = respHandler.getResponseBody ();
+ msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.IN_PROGRESS);
+ RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (),
+ Status.IN_PROGRESS.toString (),
+ Constants.PROGRESS_REQUEST_IN_PROGRESS,
+ Constants.MODIFIED_BY_APIHANDLER);
+ Response resp = msoRequest.buildResponse (bpelStatus, null, null);
+ 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) resp.getEntity ());
+ return resp;
+ } else {
+
+ String bpelXMLResponseBody = respHandler.getResponseBody ();
+ if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", MsoLogger.ErrorCode.DataError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is with status Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ } else {
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null);
+ msoRequest.updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", MsoLogger.ErrorCode.DataError, "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is empty");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+ }
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception while communciate with Catalog DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB,
+ null,
+ e.getMessage ());
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord (Status.FAILED);
+ 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;
+ }
+
+ }
+}
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
new file mode 100644
index 0000000000..d5e9629ce1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ActionType.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for action-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="action-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="CREATE"/>
+ * &lt;enumeration value="SETSTATUS"/>
+ * &lt;enumeration value="REPLACE"/>
+ * &lt;enumeration value="UPDATE"/>
+ * &lt;enumeration value="DELETE"/>
+ * &lt;enumeration value="NOT_PROVIDED"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "action-type")
+@XmlEnum
+public enum ActionType {
+
+ CREATE,
+ SETSTATUS,
+ REPLACE,
+ UPDATE,
+ DELETE,
+ NOT_PROVIDED;
+
+ public String value() {
+ return name();
+ }
+
+ public static ActionType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
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
new file mode 100644
index 0000000000..f2bf59e298
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkInputs.java
@@ -0,0 +1,378 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="network-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="network-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="network-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="service-instance-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="backout-on-failure" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ * &lt;choice>
+ * &lt;element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="service-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;choice>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="aic-cloud-region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="prov-status" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "networkId",
+ "networkName",
+ "networkType",
+ "serviceInstanceId",
+ "backoutOnFailure",
+ "serviceType",
+ "serviceId",
+ "aicNodeClli",
+ "aicCloudRegion",
+ "tenantId",
+ "provStatus"
+})
+@XmlRootElement(name = "network-inputs")
+public class NetworkInputs {
+
+ @XmlElement(name = "network-id")
+ protected String networkId;
+ @XmlElement(name = "network-name")
+ protected String networkName;
+ @XmlElement(name = "network-type", required = true)
+ protected String networkType;
+ @XmlElement(name = "service-instance-id")
+ protected String serviceInstanceId;
+ @XmlElement(name = "backout-on-failure")
+ protected Boolean backoutOnFailure;
+ @XmlElement(name = "service-type")
+ protected String serviceType;
+ @XmlElement(name = "service-id")
+ protected String serviceId;
+ @XmlElement(name = "aic-node-clli")
+ protected String aicNodeClli;
+ @XmlElement(name = "aic-cloud-region")
+ protected String aicCloudRegion;
+ @XmlElement(name = "tenant-id", required = true)
+ protected String tenantId;
+ @XmlElement(name = "prov-status")
+ protected String provStatus;
+
+ /**
+ * Gets the value of the networkId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ /**
+ * Sets the value of the networkId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNetworkId(String value) {
+ this.networkId = value;
+ }
+
+ /**
+ * Gets the value of the networkName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ /**
+ * Sets the value of the networkName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNetworkName(String value) {
+ this.networkName = value;
+ }
+
+ /**
+ * Gets the value of the networkType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ /**
+ * Sets the value of the networkType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNetworkType(String value) {
+ this.networkType = value;
+ }
+
+ /**
+ * Gets the value of the serviceInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ /**
+ * Sets the value of the serviceInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceInstanceId(String value) {
+ this.serviceInstanceId = value;
+ }
+
+ /**
+ * Gets the value of the serviceType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ /**
+ * Sets the value of the serviceType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceType(String value) {
+ this.serviceType = value;
+ }
+
+ /**
+ * Gets the value of the serviceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ /**
+ * Sets the value of the serviceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceId (String value) {
+ this.serviceId = value;
+ }
+
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the aicCloudRegion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicCloudRegion() {
+ return aicCloudRegion;
+ }
+
+ /**
+ * Sets the value of the aicCloudRegion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicCloudRegion(String value) {
+ this.aicCloudRegion = value;
+ }
+
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+ /**
+ * Gets the value of the provStatus property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ /**
+ * Sets the value of the provStatus property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setProvStatus(String value) {
+ this.provStatus = value;
+ }
+
+ /**
+ * Gets the value of the backoutOnFailure property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean getBackoutOnFailure() {
+ return backoutOnFailure;
+ }
+
+ /**
+ * Sets the value of the backoutOnFailure property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setBackoutOnFailure(Boolean value) {
+ this.backoutOnFailure = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..683b76452b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputs.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="network-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="network-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "networkId",
+ "networkName"
+})
+@XmlRootElement(name = "network-outputs")
+public class NetworkOutputs {
+
+ @XmlElement(name = "network-id", required = true)
+ protected String networkId;
+ @XmlElement(name = "network-name", required = true)
+ protected String networkName;
+
+ /**
+ * Gets the value of the networkId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ /**
+ * Sets the value of the networkId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNetworkId(String value) {
+ this.networkId = value;
+ }
+
+ /**
+ * Gets the value of the networkName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ /**
+ * Sets the value of the networkName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setNetworkName(String value) {
+ this.networkName = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..41e1236a8b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java
@@ -0,0 +1,179 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-info"/>
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}network-inputs"/>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}network-params" minOccurs="0"/>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}network-outputs" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestInfo",
+ "networkInputs",
+ "networkParams",
+ "networkOutputs"
+})
+@XmlRootElement(name = "network-request")
+public class NetworkRequest {
+
+ @XmlElement(name = "request-info", required = true)
+ protected RequestInfo requestInfo;
+ @XmlElement(name = "network-inputs")
+ protected NetworkInputs networkInputs;
+ @XmlElement(name = "network-params")
+ protected Object networkParams;
+ @XmlElement(name = "network-outputs")
+ protected NetworkOutputs networkOutputs;
+
+ /**
+ * 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;
+ }
+
+
+ /**
+ * Gets the value of the networkInputs property.
+ *
+ * @return
+ * possible object is
+ * {@link NetworkInputs }
+ *
+ */
+ public NetworkInputs getNetworkInputs() {
+ return networkInputs;
+ }
+
+ /**
+ * Sets the value of the networkInputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link NetworkInputs }
+ *
+ */
+ public void setNetworkInputs(NetworkInputs value) {
+ this.networkInputs = value;
+ }
+
+ /**
+ * Gets the value of the networkParams property.
+ *
+ * @return
+ * possible object is
+ * {@link Object }
+ *
+ */
+ public Object getNetworkParams() {
+ return networkParams;
+ }
+
+ /**
+ * Sets the value of the networkParams property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Object }
+ *
+ */
+ public void setNetworkParams(Object value) {
+ this.networkParams = value;
+ }
+
+ /**
+ * Gets the value of the networkOutputs property.
+ *
+ * @return
+ * possible object is
+ * {@link NetworkOutputs }
+ *
+ */
+ public NetworkOutputs getNetworkOutputs() {
+ return networkOutputs;
+ }
+
+ /**
+ * Sets the value of the networkOutputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link NetworkOutputs }
+ *
+ */
+ public void setNetworkOutputs(NetworkOutputs value) {
+ this.networkOutputs = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..1c0cd94ca2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/network-request/v1}network-request" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "networkRequest"
+})
+@XmlRootElement(name = "network-requests")
+public class NetworkRequests {
+
+ @XmlElement(name = "network-request")
+ protected List<NetworkRequest> networkRequest;
+
+ /**
+ * Gets the value of the networkRequest property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the vnfRequest property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getNetworkRequest().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link NetworkRequest }
+ *
+ *
+ */
+ public List<NetworkRequest> getNetworkRequest() {
+ if (networkRequest == null) {
+ networkRequest = new ArrayList<NetworkRequest>();
+ }
+ return this.networkRequest;
+ }
+
+}
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
new file mode 100644
index 0000000000..a92fd33234
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkType.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "type",
+ "id",
+ "description"
+})
+@XmlRootElement(name = "network-type")
+public class NetworkType {
+
+ @XmlElement(required = true)
+ protected String type;
+ @XmlElement(required = true)
+ protected String id;
+ @XmlElement(required = true)
+ protected String description;
+
+ /**
+ * 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 id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the description property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..e7ddc929b2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "networkType"
+})
+@XmlRootElement(name = "network-types")
+public class NetworkTypes {
+
+ @XmlElement(name = "network-type")
+ protected List<NetworkType> networkType;
+
+ /**
+ * Gets the value of the networkType property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the vnfType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getNetworkType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link NetworkType }
+ *
+ *
+ */
+ public List<NetworkType> getNetworkType() {
+ if (networkType == null) {
+ networkType = new ArrayList<NetworkType>();
+ }
+ return this.networkType;
+ }
+
+}
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
new file mode 100644
index 0000000000..df553da518
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.openecomp.mso.apihandlerinfra.vnfbeans1 package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _NetworkParams_QNAME = new QName("http://ecomp.att.com/mso/infra/network-request/v1", "network-params");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link RequestInfo }
+ *
+ */
+ public RequestInfo createRequestInfo() {
+ return new RequestInfo();
+ }
+
+ /**
+ * Create an instance of {@link NetworkRequest }
+ *
+ */
+ public NetworkRequest createNetworkRequest() {
+ return new NetworkRequest();
+ }
+
+ /**
+ * Create an instance of {@link NetworkInputs }
+ *
+ */
+ public NetworkInputs createNetworkInputs() {
+ return new NetworkInputs();
+ }
+
+ /**
+ * Create an instance of {@link NetworkOutputs }
+ *
+ */
+ public NetworkOutputs createNetworkOutputs() {
+ return new NetworkOutputs();
+ }
+
+ /**
+ * Create an instance of {@link NetworkRequests }
+ *
+ */
+ public NetworkRequests createNetworkRequests() {
+ return new NetworkRequests();
+ }
+
+ /**
+ * Create an instance of {@link NetworkTypes }
+ *
+ */
+ public NetworkTypes createNetworkTypes() {
+ return new NetworkTypes();
+ }
+
+ /**
+ * Create an instance of {@link NetworkType }
+ *
+ */
+ public NetworkType createNetworkType() {
+ return new NetworkType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://ecomp.att.com/mso/infra/network-request/v1", name = "network-params")
+ public JAXBElement<Object> createNetworkParams(Object value) {
+ return new JAXBElement<Object>(_NetworkParams_QNAME, Object.class, null, value);
+ }
+
+}
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
new file mode 100644
index 0000000000..c7e20aa034
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java
@@ -0,0 +1,286 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="action" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}action-type"/>
+ * &lt;element name="request-status" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
+ * &lt;element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="end-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestId",
+ "action",
+ "requestStatus",
+ "statusMessage",
+ "progress",
+ "startTime",
+ "endTime",
+ "source"
+})
+@XmlRootElement(name = "request-info")
+public class RequestInfo {
+
+ @XmlElement(name = "request-id")
+ protected String requestId;
+ @XmlElement(required = true)
+ protected ActionType action;
+ @XmlElement(name = "request-status")
+ protected RequestStatusType requestStatus;
+ @XmlElement(name = "status-message")
+ protected String statusMessage;
+ protected Integer progress;
+ @XmlElement(name = "start-time")
+ protected String startTime;
+ @XmlElement(name = "end-time")
+ protected String endTime;
+ protected String source;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the action property.
+ *
+ * @return
+ * possible object is
+ * {@link ActionType }
+ *
+ */
+ public ActionType getAction() {
+ return action;
+ }
+
+ /**
+ * Sets the value of the action property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ActionType }
+ *
+ */
+ public void setAction(ActionType value) {
+ this.action = value;
+ }
+
+ /**
+ * Gets the value of the requestStatus property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestStatusType }
+ *
+ */
+ public RequestStatusType getRequestStatus() {
+ return requestStatus;
+ }
+
+ /**
+ * Sets the value of the requestStatus property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestStatusType }
+ *
+ */
+ public void setRequestStatus(RequestStatusType value) {
+ this.requestStatus = value;
+ }
+
+ /**
+ * Gets the value of the statusMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ /**
+ * Sets the value of the statusMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStatusMessage(String value) {
+ this.statusMessage = value;
+ }
+
+ /**
+ * Gets the value of the progress property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getProgress() {
+ return progress;
+ }
+
+ /**
+ * Sets the value of the progress property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setProgress(Integer value) {
+ this.progress = value;
+ }
+
+ /**
+ * Gets the value of the startTime property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Sets the value of the startTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStartTime(String value) {
+ this.startTime = value;
+ }
+
+ /**
+ * Gets the value of the endTime property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * Sets the value of the endTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setEndTime(String value) {
+ this.endTime = value;
+ }
+
+ /**
+ * 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;
+ }
+
+}
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
new file mode 100644
index 0000000000..50d6daae7e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestStatusType.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.networkbeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for request-status-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="request-status-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="COMPLETE"/>
+ * &lt;enumeration value="FAILED"/>
+ * &lt;enumeration value="IN_PROGRESS"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "request-status-type")
+@XmlEnum
+public enum RequestStatusType {
+
+ COMPLETE,
+ FAILED,
+ IN_PROGRESS,
+ PENDING,
+ TIMEOUT;
+
+ public String value() {
+ return name();
+ }
+
+ public static RequestStatusType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
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
new file mode 100644
index 0000000000..54fb4971b5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/infra/network-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.openecomp.mso.apihandlerinfra.networkbeans;
+
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
new file mode 100644
index 0000000000..9225523d87
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.01.08 at 03:50:12 PM EST
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/request/types/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.openecomp.mso.apihandlerinfra;
+
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
new file mode 100644
index 0000000000..a9f7f7a880
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class CloudConfiguration {
+
+ protected String aicNodeClli;
+ protected String tenantId;
+ protected String lcpCloudRegionId;
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..aa596ef372
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.7
+// 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: 2016.05.03 at 03:56:30 PM CDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for exceptionType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="exceptionType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="variables" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="50" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "exceptionType", propOrder = {
+ "messageId",
+ "text",
+ "variables"
+})
+@XmlSeeAlso({
+ ServiceException.class,
+ PolicyException.class
+})
+public class ExceptionType {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ @XmlElement(required = true)
+ protected String text;
+ protected List<String> variables;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the text property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Sets the value of the text property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setText(String value) {
+ this.text = value;
+ }
+
+ /**
+ * Gets the value of the variables property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the variables property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVariables().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getVariables() {
+ if (variables == null) {
+ variables = new ArrayList<String>();
+ }
+ return this.variables;
+ }
+
+}
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
new file mode 100644
index 0000000000..6df45c7a0f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import java.util.List;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class GetOrchestrationListResponse {
+
+ protected List<RequestList> requestList;
+
+ public List<RequestList> getRequestList() {
+ return requestList;
+ }
+
+ public void setRequestList(List<RequestList> requestList) {
+ this.requestList = requestList;
+ }
+
+}
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
new file mode 100644
index 0000000000..87aa15717e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class GetOrchestrationResponse {
+
+ protected Request request;
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..fd5c73f97f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class InstanceReferences {
+
+ protected String serviceInstanceId;
+ protected String serviceInstanceName;
+ protected String vnfInstanceId;
+ protected String vnfInstanceName;
+ protected String vfModuleInstanceId;
+ protected String vfModuleInstanceName;
+ protected String volumeGroupInstanceId;
+ protected String volumeGroupInstanceName;
+ protected String networkInstanceId;
+ protected String networkInstanceName;
+
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+ public String getVfModuleInstanceName() {
+ return vfModuleInstanceName;
+ }
+ public void setVfModuleInstanceName(String vfModuleInstanceName) {
+ this.vfModuleInstanceName = vfModuleInstanceName;
+ }
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+ public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+ public String getNetworkInstanceName() {
+ return networkInstanceName;
+ }
+ public void setNetworkInstanceName(String networkInstanceName) {
+ this.networkInstanceName = networkInstanceName;
+ }
+
+
+
+}
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
new file mode 100644
index 0000000000..e361b1db32
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.7
+// 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: 2016.03.30 at 02:48:23 PM CDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import org.openecomp.mso.apihandlerinfra.ModelType;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class ModelInfo {
+
+ protected String modelCustomizationName;
+ protected String modelInvariantId;
+ protected ModelType modelType;
+ protected String modelNameVersionId;
+ protected String modelName;
+ protected String modelVersion;
+
+
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ public String getModelNameVersionId() {
+ return modelNameVersionId;
+ }
+ public void setModelNameVersionId(String modelNameVersionId) {
+ this.modelNameVersionId = modelNameVersionId;
+ }
+ public String getModelName() {
+ return modelName;
+ }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+ public String getModelVersion() {
+ return modelVersion;
+ }
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+ public ModelType getModelType() {
+ return modelType;
+ }
+ public void setModelType(ModelType modelType) {
+ this.modelType = modelType;
+ }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..4d336c460a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.7
+// 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: 2016.03.30 at 02:48:23 PM CDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for policyException complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="policyException">
+ * &lt;complexContent>
+ * &lt;extension base="{http://ecomp.att.com/mso/request/types/v1}exceptionType">
+ * &lt;/extension>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "policyException")
+public class PolicyException
+ extends ExceptionType
+{
+
+
+}
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
new file mode 100644
index 0000000000..90275f67c6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RelatedInstance {
+
+ protected String instanceName;
+ protected String instanceId;
+ protected ModelInfo modelInfo;
+
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+
+
+}
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
new file mode 100644
index 0000000000..1244d3b567
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+public class RelatedInstanceList {
+
+ protected RelatedInstance relatedInstance;
+
+ public RelatedInstance getRelatedInstance() {
+ return relatedInstance;
+ }
+
+ public void setRelatedInstance(RelatedInstance relatedInstance) {
+ this.relatedInstance = relatedInstance;
+ }
+
+
+
+}
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
new file mode 100644
index 0000000000..7a88c2dd94
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import java.util.Date;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+//@JsonRootName(value = "request")
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class Request {
+
+ protected String requestId;
+ protected String startTime;
+ protected String requestScope;
+ protected String requestType;
+ //protected String requestDetails;
+ protected RequestDetails requestDetails;
+ protected InstanceReferences instanceReferences;
+ protected RequestStatus requestStatus;
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public String getStartTime() {
+ return startTime;
+ }
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+ public String getRequestScope() {
+ return requestScope;
+ }
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+ public String getRequestType() {
+ return requestType;
+ }
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+ public InstanceReferences getInstanceReferences() {
+ return instanceReferences;
+ }
+ public void setInstanceReferences(InstanceReferences instanceReferences) {
+ this.instanceReferences = instanceReferences;
+ }
+ 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/serviceinstancebeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
new file mode 100644
index 0000000000..de6cbb7978
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+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 ModelInfo modelInfo;
+ protected RequestInfo requestInfo;
+ protected RelatedInstanceList[] relatedInstanceList;
+ protected SubscriberInfo subscriberInfo;
+ protected CloudConfiguration cloudConfiguration;
+ protected RequestParameters requestParameters;
+
+ /**
+ * Gets the value of the serviceInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link ModelInfo }
+ *
+ */
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ /**
+ * Sets the value of the serviceInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ModelInfo }
+ *
+ */
+ public void setModelInfo(ModelInfo value) {
+ this.modelInfo = value;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Gets the value of the subscriberInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link SubscriberInfo }
+ *
+ */
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ /**
+ * Sets the value of the subscriberInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SubscriberInfo }
+ *
+ */
+ public void setSubscriberInfo(SubscriberInfo value) {
+ this.subscriberInfo = value;
+ }
+
+ /**
+ * Gets the value of the cloudConfiguration property.
+ *
+ * @return
+ * possible object is
+ * {@link CloudConfiguration }
+ *
+ */
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ /**
+ * Sets the value of the cloudConfiguration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link CloudConfiguration }
+ *
+ */
+ public void setCloudConfiguration(CloudConfiguration value) {
+ this.cloudConfiguration = value;
+ }
+
+ /**
+ * Gets the value of the requestParameters property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestParameters }
+ *
+ */
+ public RequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ /**
+ * Sets the value of the requestParameters property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestParameters }
+ *
+ */
+ public void setRequestParameters(RequestParameters value) {
+ this.requestParameters = value;
+ }
+
+ public RelatedInstanceList[] getRelatedInstanceList() {
+ return relatedInstanceList;
+ }
+
+ public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
+ this.relatedInstanceList = relatedInstanceList;
+ }
+
+}
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
new file mode 100644
index 0000000000..3a27238670
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.7
+// 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: 2016.04.07 at 08:25:52 AM CDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;choice>
+ * &lt;element name="policyException" type="{http://ecomp.att.com/mso/request/types/v1}policyException"/>
+ * &lt;element name="serviceException" type="{http://ecomp.att.com/mso/request/types/v1}serviceException"/>
+ * &lt;/choice>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "policyException",
+ "serviceException"
+})
+@XmlRootElement(name = "requestError")
+public class RequestError {
+
+ protected PolicyException policyException;
+ protected ServiceException serviceException;
+
+ /**
+ * Gets the value of the policyException property.
+ *
+ * @return
+ * possible object is
+ * {@link PolicyException }
+ *
+ */
+ public PolicyException getPolicyException() {
+ return policyException;
+ }
+
+ /**
+ * Sets the value of the policyException property.
+ *
+ * @param value
+ * allowed object is
+ * {@link PolicyException }
+ *
+ */
+ public void setPolicyException(PolicyException value) {
+ this.policyException = value;
+ }
+
+ /**
+ * Gets the value of the serviceException property.
+ *
+ * @return
+ * possible object is
+ * {@link ServiceException }
+ *
+ */
+ public ServiceException getServiceException() {
+ return serviceException;
+ }
+
+ /**
+ * Sets the value of the serviceException property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ServiceException }
+ *
+ */
+ public void setServiceException(ServiceException value) {
+ this.serviceException = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..e5f3167c1f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
@@ -0,0 +1,191 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestInfo {
+
+ protected String billingAccountNumber;
+ protected String callbackUrl;
+ protected String correlator;
+ protected String orderNumber;
+ protected String productFamilyId;
+ protected Integer orderVersion;
+ protected String source;
+ protected String instanceName;
+ protected boolean suppressRollback;
+
+ /**
+ * Gets the value of the callbackUrl property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ /**
+ * Sets the value of the callbackUrl property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCallbackUrl(String value) {
+ this.callbackUrl = value;
+ }
+
+ /**
+ * Gets the value of the correlator property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCorrelator() {
+ return correlator;
+ }
+
+ /**
+ * Sets the value of the correlator property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCorrelator(String value) {
+ this.correlator = value;
+ }
+
+ /**
+ * Gets the value of the orderNumber property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ /**
+ * Sets the value of the orderNumber property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOrderNumber(String value) {
+ this.orderNumber = value;
+ }
+
+ /**
+ * Gets the value of the orderVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getOrderVersion() {
+ return orderVersion;
+ }
+
+ /**
+ * Sets the value of the orderVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setOrderVersion(Integer value) {
+ this.orderVersion = value;
+ }
+
+ /**
+ * 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 String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getBillingAccountNumber() {
+ return billingAccountNumber;
+ }
+
+ public void setBillingAccountNumber(String billingAccountNumber) {
+ this.billingAccountNumber = billingAccountNumber;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public boolean isSuppressRollback() {
+ return suppressRollback;
+ }
+
+ public void setSuppressRollback(boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..dba82a80fc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import java.util.List;
+
+
+public class RequestList {
+
+ protected Request request;
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+}
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
new file mode 100644
index 0000000000..1a8204055e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestParameters {
+
+ private String subscriptionServiceType;
+ private List<Map<String, String>> userParams = new ArrayList<>();
+
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public List<Map<String, String>> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<Map<String, String>> userParams) {
+ this.userParams = userParams;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..c2e3ecfbbd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+public class RequestReferences {
+
+ String requestId;
+ String instanceId;
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..a9bf5e873f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import java.util.Date;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class RequestStatus {
+
+ protected String requestState;
+ protected String statusMessage;
+ protected Integer percentProgress;
+ protected String finishTime;
+
+
+ public String getRequestState() {
+ return requestState;
+ }
+ public void setRequestState(String requestState) {
+ this.requestState = requestState;
+ }
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+ public Integer getPercentProgress() {
+ return percentProgress;
+ }
+ public void setPercentProgress(Integer percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+ public String getFinishTime() {
+ return finishTime;
+ }
+ public void setFinishTime(String finishTime) {
+ this.finishTime = finishTime;
+ }
+
+}
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
new file mode 100644
index 0000000000..f207e96cb5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.7
+// 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: 2016.03.30 at 02:48:23 PM CDT
+//
+
+
+package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for serviceException complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="serviceException">
+ * &lt;complexContent>
+ * &lt;extension base="{http://ecomp.att.com/mso/request/types/v1}exceptionType">
+ * &lt;/extension>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "serviceException")
+public class ServiceException
+ extends ExceptionType
+{
+
+
+}
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
new file mode 100644
index 0000000000..30903b9649
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+
+
+public class ServiceInstancesRequest {
+
+ private RequestDetails requestDetails;
+ private String serviceInstanceId;
+ private String vnfInstanceId;
+ private String networkInstanceId;
+ private String volumeGroupInstanceId;
+ private String vfModuleInstanceId;
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..b5be488367
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+public class ServiceInstancesResponse {
+
+ RequestReferences requestReferences;
+
+ public RequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ public void setRequestReferences(RequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..bf7a044b28
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.serviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class SubscriberInfo {
+
+ protected String globalSubscriberId;
+ protected String subscriberName;
+
+ /**
+ * Gets the value of the globalSubscriberId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ /**
+ * Sets the value of the globalSubscriberId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setGlobalSubscriberId(String value) {
+ this.globalSubscriberId = value;
+ }
+
+ /**
+ * Gets the value of the subscriberName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ /**
+ * Sets the value of the subscriberName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSubscriberName(String value) {
+ this.subscriberName = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..3062dfcb96
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for action-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="action-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="CREATE"/>
+ * &lt;enumeration value="SETSTATUS"/>
+ * &lt;enumeration value="REPLACE"/>
+ * &lt;enumeration value="UPDATE"/>
+ * &lt;enumeration value="DELETE"/>
+ * &lt;enumeration value="CREATE_VF_MODULE"/>
+ * &lt;enumeration value="UPDATE_VF_MODULE"/>
+ * &lt;enumeration value="DELETE_VF_MODULE"/>
+ * &lt;enumeration value="NOT_PROVIDED"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "action-type")
+@XmlEnum
+public enum ActionType {
+
+ CREATE,
+ SETSTATUS,
+ REPLACE,
+ UPDATE,
+ DELETE,
+ CREATE_VF_MODULE,
+ UPDATE_VF_MODULE,
+ DELETE_VF_MODULE,
+ NOT_PROVIDED;
+
+ public String value() {
+ return name();
+ }
+
+ public static ActionType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
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
new file mode 100644
index 0000000000..b1c000f348
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.openecomp.mso.apihandlerinfra.vnfbeans1 package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _VnfParams_QNAME = new QName("http://ecomp.att.com/mso/infra/vnf-request/v1", "vnf-params");
+ private final static QName _NetworkParams_QNAME = new QName("http://ecomp.att.com/mso/infra/vnf-request/v1", "network-params");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link VnfInputs }
+ *
+ */
+ public VnfInputs createVnfInputs() {
+ return new VnfInputs();
+ }
+
+ /**
+ * Create an instance of {@link RequestInfo }
+ *
+ */
+ public RequestInfo createRequestInfo() {
+ return new RequestInfo();
+ }
+
+ /**
+ * Create an instance of {@link VnfOutputs }
+ *
+ */
+ public VnfOutputs createVnfOutputs() {
+ return new VnfOutputs();
+ }
+
+ /**
+ * Create an instance of {@link VnfType }
+ *
+ */
+ public VnfType createVnfType() {
+ return new VnfType();
+ }
+
+ /**
+ * Create an instance of {@link VnfRequest }
+ *
+ */
+ public VnfRequest createVnfRequest() {
+ return new VnfRequest();
+ }
+
+
+ /**
+ * Create an instance of {@link VnfTypes }
+ *
+ */
+ public VnfTypes createVnfTypes() {
+ return new VnfTypes();
+ }
+
+ /**
+ * Create an instance of {@link VnfRequests }
+ *
+ */
+ public VnfRequests createVnfRequests() {
+ return new VnfRequests();
+ }
+
+ /**
+ * Create an instance of {@link VfModuleModelName }
+ *
+ */
+ public VfModuleModelName createVfModuleModelName() {
+ return new VfModuleModelName();
+ }
+
+ /**
+ * Create an instance of {@link VfModuleModelNames }
+ *
+ */
+ public VfModuleModelNames createVfModuleModelNames() {
+ return new VfModuleModelNames();
+ }
+
+
+
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://ecomp.att.com/mso/infra/vnf-request/v1", name = "vnf-params")
+ public JAXBElement<Object> createVnfParams(Object value) {
+ return new JAXBElement<Object>(_VnfParams_QNAME, Object.class, null, value);
+ }
+
+}
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
new file mode 100644
index 0000000000..cb8973b83e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
@@ -0,0 +1,286 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="action" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}action-type"/>
+ * &lt;element name="request-status" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
+ * &lt;element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="end-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestId",
+ "action",
+ "requestStatus",
+ "statusMessage",
+ "progress",
+ "startTime",
+ "endTime",
+ "source"
+})
+@XmlRootElement(name = "request-info")
+public class RequestInfo {
+
+ @XmlElement(name = "request-id")
+ protected String requestId;
+ @XmlElement(required = true)
+ protected ActionType action;
+ @XmlElement(name = "request-status")
+ protected RequestStatusType requestStatus;
+ @XmlElement(name = "status-message")
+ protected String statusMessage;
+ protected Integer progress;
+ @XmlElement(name = "start-time")
+ protected String startTime;
+ @XmlElement(name = "end-time")
+ protected String endTime;
+ protected String source;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the action property.
+ *
+ * @return
+ * possible object is
+ * {@link ActionType }
+ *
+ */
+ public ActionType getAction() {
+ return action;
+ }
+
+ /**
+ * Sets the value of the action property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ActionType }
+ *
+ */
+ public void setAction(ActionType value) {
+ this.action = value;
+ }
+
+ /**
+ * Gets the value of the requestStatus property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestStatusType }
+ *
+ */
+ public RequestStatusType getRequestStatus() {
+ return requestStatus;
+ }
+
+ /**
+ * Sets the value of the requestStatus property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestStatusType }
+ *
+ */
+ public void setRequestStatus(RequestStatusType value) {
+ this.requestStatus = value;
+ }
+
+ /**
+ * Gets the value of the statusMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ /**
+ * Sets the value of the statusMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStatusMessage(String value) {
+ this.statusMessage = value;
+ }
+
+ /**
+ * Gets the value of the progress property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getProgress() {
+ return progress;
+ }
+
+ /**
+ * Sets the value of the progress property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setProgress(Integer value) {
+ this.progress = value;
+ }
+
+ /**
+ * Gets the value of the startTime property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Sets the value of the startTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStartTime(String value) {
+ this.startTime = value;
+ }
+
+ /**
+ * Gets the value of the endTime property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * Sets the value of the endTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setEndTime(String value) {
+ this.endTime = value;
+ }
+
+ /**
+ * 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;
+ }
+
+}
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
new file mode 100644
index 0000000000..4698c785a9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for request-status-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="request-status-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="COMPLETE"/>
+ * &lt;enumeration value="FAILED"/>
+ * &lt;enumeration value="IN_PROGRESS"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "request-status-type")
+@XmlEnum
+public enum RequestStatusType {
+
+ COMPLETE,
+ FAILED,
+ IN_PROGRESS,
+ PENDING,
+ TIMEOUT;
+
+ public String value() {
+ return name();
+ }
+
+ public static RequestStatusType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
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
new file mode 100644
index 0000000000..c9876487d6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java
@@ -0,0 +1,261 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="model-invariant-uuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="is-base" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "modelName",
+ "modelVersion",
+ "modelInvariantUuid",
+ "isBase",
+ "id",
+ "description",
+ "asdcServiceModelVersion"
+})
+@XmlRootElement(name = "vf-module-model-name")
+public class VfModuleModelName {
+
+ @XmlElement(name="model-name", required = true)
+ protected String modelName;
+ @XmlElement(name="model-version", required = true)
+ protected String modelVersion;
+ @XmlElement(name="model-invariant-uuid", required = true)
+ protected String modelInvariantUuid;
+ @XmlElement(name="is-base", required = true)
+ protected Boolean isBase;
+ @XmlElement(name="id", required = true)
+ protected String id;
+ @XmlElement(name="description", required = true)
+ protected String description;
+ @XmlElement(name="asdc-service-model-version", required = true)
+ protected String asdcServiceModelVersion;
+
+ /**
+ * Gets the value of the modelName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getModelName() {
+ return modelName;
+ }
+
+ /**
+ * Sets the value of the modelName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setModelName(String value) {
+ this.modelName = value;
+ }
+
+ /**
+ * Gets the value of the modelVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ /**
+ * Sets the value of the modelVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setModelVersion(String value) {
+ this.modelVersion = value;
+ }
+
+ /**
+ * Gets the value of the modelInvariantUuid property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ /**
+ * Sets the value of the modelInvariantUuid property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setModelInvariantUuid(String value) {
+ this.modelInvariantUuid = value;
+ }
+
+ /**
+ * Gets the value of the isBase property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean getIsBase() {
+ return isBase;
+ }
+
+ /**
+ * Sets the value of the isBase property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setIsBase(Boolean value) {
+ this.isBase = value;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the description property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ /**
+ * Gets the value of the asdcServiceModelVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAsdcServiceModelVersion() {
+ return asdcServiceModelVersion;
+ }
+
+ /**
+ * Sets the value of the asdcServiceModelVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAsdcServiceModelVersion(String value) {
+ this.asdcServiceModelVersion = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..790a5e80ef
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vf-module-model-name" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vfModuleModelName"
+})
+@XmlRootElement(name = "vf-module-model-names")
+public class VfModuleModelNames {
+
+ @XmlElement(name = "vf-module-model-name")
+ protected List<VfModuleModelName> vfModuleModelName;
+
+ /**
+ * Gets the value of the vfModuleModelName property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the vnfType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVfModuleModelName().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VfModuleModelName }
+ *
+ *
+ */
+ public List<VfModuleModelName> getVfModuleModelName() {
+ if (vfModuleModelName == null) {
+ vfModuleModelName = new ArrayList<VfModuleModelName>();
+ }
+ return this.vfModuleModelName;
+ }
+
+}
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
new file mode 100644
index 0000000000..bfc0d84e43
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java
@@ -0,0 +1,689 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="service-instance-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="backout-on-failure" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ * &lt;choice>
+ * &lt;element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="service-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;choice>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="aic-cloud-region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="prov-status" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;element name="persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;element name="is-base-vf-module" type="{http://www.w3.org/2001/XMLSchema}Boolean"/ minOccurs="0">
+ * &lt;element name="vnf-persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;element name="vnf-persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfId",
+ "vfModuleId",
+ "vnfName",
+ "vfModuleName",
+ "vnfType",
+ "vfModuleModelName",
+ "asdcServiceModelVersion",
+ "serviceInstanceId",
+ "backoutOnFailure",
+ "serviceType",
+ "serviceId",
+ "aicNodeClli",
+ "aicCloudRegion",
+ "tenantId",
+ "provStatus",
+ "volumeGroupName",
+ "volumeGroupId",
+ // BEGIN - elements valid only on BPMN interface
+ "personaModelId",
+ "personaModelVersion",
+ "isBaseVfModule",
+ "vnfPersonaModelId",
+ "vnfPersonaModelVersion"
+ // END - elements valid only on BPMN interface
+})
+@XmlRootElement(name = "vnf-inputs")
+public class VnfInputs {
+
+ @XmlElement(name = "vnf-id")
+ protected String vnfId;
+ @XmlElement(name = "vf-module-id")
+ protected String vfModuleId;
+ @XmlElement(name = "vnf-name")
+ protected String vnfName;
+ @XmlElement(name = "vf-module-name")
+ protected String vfModuleName;
+ @XmlElement(name = "vnf-type")
+ protected String vnfType;
+ @XmlElement(name = "vf-module-model-name")
+ protected String vfModuleModelName;
+ @XmlElement(name = "asdc-service-model-version")
+ protected String asdcServiceModelVersion;
+ @XmlElement(name = "service-instance-id")
+ protected String serviceInstanceId;
+ @XmlElement(name = "backout-on-failure")
+ protected Boolean backoutOnFailure;
+ @XmlElement(name = "service-type")
+ protected String serviceType;
+ @XmlElement(name = "service-id")
+ protected String serviceId;
+ @XmlElement(name = "aic-node-clli")
+ protected String aicNodeClli;
+ @XmlElement(name = "aic-cloud-region")
+ protected String aicCloudRegion;
+ @XmlElement(name = "tenant-id", required = true)
+ protected String tenantId;
+ @XmlElement(name = "prov-status")
+ protected String provStatus;
+ @XmlElement(name = "volume-group-name")
+ protected String volumeGroupName;
+ @XmlElement(name = "volume-group-id")
+ protected String volumeGroupId;
+ @XmlElement(name = "persona-model-id")
+ protected String personaModelId;
+ @XmlElement(name = "persona-model-version")
+ protected String personaModelVersion;
+ @XmlElement(name = "is-base-vf-module")
+ protected Boolean isBaseVfModule;
+ @XmlElement(name = "vnf-persona-model-id")
+ protected String vnfPersonaModelId;
+ @XmlElement(name = "vnf-persona-model-version")
+ protected String vnfPersonaModelVersion;
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ /**
+ * Gets the value of the vnfName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ /**
+ * Sets the value of the vnfName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfName(String value) {
+ this.vnfName = value;
+ }
+
+ /**
+ * Gets the value of the vnfType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ /**
+ * Sets the value of the vnfType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfType(String value) {
+ this.vnfType = value;
+ }
+
+ /**
+ * Gets the value of the serviceInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ /**
+ * Sets the value of the serviceInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceInstanceId(String value) {
+ this.serviceInstanceId = value;
+ }
+
+ /**
+ * Gets the value of the serviceType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ /**
+ * Sets the value of the serviceType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceType(String value) {
+ this.serviceType = value;
+ }
+
+ /**
+ * Gets the value of the serviceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ /**
+ * Sets the value of the serviceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceId (String value) {
+ this.serviceId = value;
+ }
+
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the aicCloudRegion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicCloudRegion() {
+ return aicCloudRegion;
+ }
+
+ /**
+ * Sets the value of the aicCloudRegion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicCloudRegion(String value) {
+ this.aicCloudRegion = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+ /**
+ * Gets the value of the provStatus property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ /**
+ * Sets the value of the provStatus property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setProvStatus(String value) {
+ this.provStatus = value;
+ }
+
+ /**
+ * Gets the value of the volumeGroupName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupName() {
+ return volumeGroupName;
+ }
+
+ /**
+ * Sets the value of the volumeGroupName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupName(String value) {
+ this.volumeGroupName = value;
+ }
+
+ /**
+ * Gets the value of the volumeGroupId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ /**
+ * Sets the value of the volumeGroupId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupId(String value) {
+ this.volumeGroupId = value;
+ }
+
+ /**
+ * Gets the value of the vfModuleId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ /**
+ * Sets the value of the vfModuleId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVfModuleId(String value) {
+ this.vfModuleId = value;
+ }
+
+ /**
+ * Gets the value of the vfModuleName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVfModuleName() {
+ return vfModuleName;
+ }
+
+ /**
+ * Sets the value of the vfModuleName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVfModuleName(String value) {
+ this.vfModuleName = value;
+ }
+
+ /**
+ * Gets the value of the vfModuleModelName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVfModuleModelName() {
+ return vfModuleModelName;
+ }
+
+ /**
+ * Sets the value of the vfModuleModelName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVfModuleModelName(String value) {
+ this.vfModuleModelName = value;
+ }
+
+ /**
+ * Gets the value of the asdcServiceModelVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAsdcServiceModelVersion() {
+ return asdcServiceModelVersion;
+ }
+
+ /**
+ * Sets the value of the asdcServiceModelVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAsdcServiceModelVersion(String value) {
+ this.asdcServiceModelVersion = value;
+ }
+
+ /**
+ * Gets the value of the backoutOnFailure property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean getBackoutOnFailure() {
+ return backoutOnFailure;
+ }
+
+ /**
+ * Sets the value of the backoutOnFailure property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setBackoutOnFailure(Boolean value) {
+ this.backoutOnFailure = value;
+ }
+
+ /**
+ * Gets the value of the personaModelId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPersonaModelId() {
+ return personaModelId;
+ }
+
+ /**
+ * Sets the value of the personaModelId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPersonaModelId(String value) {
+ this.personaModelId = value;
+ }
+
+ /**
+ * Gets the value of the personaModelVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPersonaModelVersion() {
+ return personaModelVersion;
+ }
+
+ /**
+ * Sets the value of the personaModelVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPersonaModelVersion(String value) {
+ this.personaModelVersion = value;
+ }
+
+
+ /**
+ * Gets the value of the isBaseVfModule property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean getIsBaseVfModule() {
+ return isBaseVfModule;
+ }
+
+ /**
+ * Sets the value of the isBaseVfModule property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setIsBaseVfModule(Boolean value) {
+ this.isBaseVfModule = value;
+ }
+
+ /**
+ * Gets the value of the vnfPersonaModelId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfPersonaModelId() {
+ return vnfPersonaModelId;
+ }
+
+ /**
+ * Sets the value of the vnfPersonaModelId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfPersonaModelId(String value) {
+ this.vnfPersonaModelId = value;
+ }
+
+ /**
+ * Gets the value of the vnfPersonaModelVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfPersonaModelVersion() {
+ return vnfPersonaModelVersion;
+ }
+
+ /**
+ * Sets the value of the vnfPersonaModelVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfPersonaModelVersion(String value) {
+ this.vnfPersonaModelVersion = value;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..acb2a0a290
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java
@@ -0,0 +1,291 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfId",
+ "vfModuleId",
+ "vnfName",
+ "vfModuleName",
+ "aicNodeClli",
+ "tenantId",
+ "volumeGroupName",
+ "volumeGroupId"
+})
+@XmlRootElement(name = "vnf-outputs")
+public class VnfOutputs {
+
+ @XmlElement(name = "vnf-id", required = true)
+ protected String vnfId;
+ @XmlElement(name = "vf-module-id")
+ protected String vfModuleId;
+ @XmlElement(name = "vnf-name", required = true)
+ protected String vnfName;
+ @XmlElement(name = "vf-module-name", required = true)
+ protected String vfModuleName;
+ @XmlElement(name = "aic-node-clli", required = true)
+ protected String aicNodeClli;
+ @XmlElement(name = "tenant-id", required = true)
+ protected String tenantId;
+ @XmlElement(name = "volume-group-name")
+ protected String volumeGroupName;
+ @XmlElement(name = "volume-group-id")
+ protected String volumeGroupId;
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ /**
+ * Gets the value of the vfModuleId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ /**
+ * Sets the value of the vfModuleId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVfModuleId(String value) {
+ this.vfModuleId = value;
+ }
+
+
+
+ /**
+ * Gets the value of the vnfName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ /**
+ * Sets the value of the vnfName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfName(String value) {
+ this.vnfName = value;
+ }
+
+ /**
+ * Gets the value of the vfModuleName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVfModuleName() {
+ return vfModuleName;
+ }
+
+ /**
+ * Sets the value of the vfModuleName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVfModuleName(String value) {
+ this.vfModuleName = value;
+ }
+
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+ /**
+ * Gets the value of the volumeGroupName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupName() {
+ return volumeGroupName;
+ }
+
+ /**
+ * Sets the value of the volumeGroupName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupName(String value) {
+ this.volumeGroupName = value;
+ }
+
+ /**
+ * Gets the value of the volumeGroupId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ /**
+ * Sets the value of the volumeGroupId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupId(String value) {
+ this.volumeGroupId = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..bd210a5aca
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java
@@ -0,0 +1,179 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-info"/>
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-inputs"/>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-params" minOccurs="0"/>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-outputs" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestInfo",
+ "vnfInputs",
+ "vnfParams",
+ "vnfOutputs"
+})
+@XmlRootElement(name = "vnf-request")
+public class VnfRequest {
+
+ @XmlElement(name = "request-info", required = true)
+ protected RequestInfo requestInfo;
+ @XmlElement(name = "vnf-inputs")
+ protected VnfInputs vnfInputs;
+ @XmlElement(name = "vnf-params")
+ protected Object vnfParams;
+ @XmlElement(name = "vnf-outputs")
+ protected VnfOutputs vnfOutputs;
+
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Gets the value of the vnfInputs property.
+ *
+ * @return
+ * possible object is
+ * {@link VnfInputs }
+ *
+ */
+ public VnfInputs getVnfInputs() {
+ return vnfInputs;
+ }
+
+ /**
+ * Sets the value of the vnfInputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VnfInputs }
+ *
+ */
+ public void setVnfInputs(VnfInputs value) {
+ this.vnfInputs = value;
+ }
+
+ /**
+ * Gets the value of the vnfParams property.
+ *
+ * @return
+ * possible object is
+ * {@link Object }
+ *
+ */
+ public Object getVnfParams() {
+ return vnfParams;
+ }
+
+ /**
+ * Sets the value of the vnfParams property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Object }
+ *
+ */
+ public void setVnfParams(Object value) {
+ this.vnfParams = value;
+ }
+
+ /**
+ * Gets the value of the vnfOutputs property.
+ *
+ * @return
+ * possible object is
+ * {@link VnfOutputs }
+ *
+ */
+ public VnfOutputs getVnfOutputs() {
+ return vnfOutputs;
+ }
+
+ /**
+ * Sets the value of the vnfOutputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VnfOutputs }
+ *
+ */
+ public void setVnfOutputs(VnfOutputs value) {
+ this.vnfOutputs = value;
+ }
+
+ }
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
new file mode 100644
index 0000000000..65aa9c1d99
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-request" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfRequest"
+})
+@XmlRootElement(name = "vnf-requests")
+public class VnfRequests {
+
+ @XmlElement(name = "vnf-request")
+ protected List<VnfRequest> vnfRequest;
+
+ /**
+ * Gets the value of the vnfRequest property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the vnfRequest property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVnfRequest().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VnfRequest }
+ *
+ *
+ */
+ public List<VnfRequest> getVnfRequest() {
+ if (vnfRequest == null) {
+ vnfRequest = new ArrayList<VnfRequest>();
+ }
+ return this.vnfRequest;
+ }
+
+}
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
new file mode 100644
index 0000000000..9ddd4ca6db
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "type",
+ "id",
+ "description"
+})
+@XmlRootElement(name = "vnf-type")
+public class VnfType {
+
+ @XmlElement(required = true)
+ protected String type;
+ @XmlElement(required = true)
+ protected String id;
+ @XmlElement(required = true)
+ protected String description;
+
+ /**
+ * 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 id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the description property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..473695c179
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.vnfbeans;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfType"
+})
+@XmlRootElement(name = "vnf-types")
+public class VnfTypes {
+
+ @XmlElement(name = "vnf-type")
+ protected List<VnfType> vnfType;
+
+ /**
+ * Gets the value of the vnfType property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the vnfType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVnfType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VnfType }
+ *
+ *
+ */
+ public List<VnfType> getVnfType() {
+ if (vnfType == null) {
+ vnfType = new ArrayList<VnfType>();
+ }
+ return this.vnfType;
+ }
+
+}
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
new file mode 100644
index 0000000000..700d7a9064
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/infra/vnf-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.openecomp.mso.apihandlerinfra.vnfbeans;
+
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
new file mode 100644
index 0000000000..9e2c3ac525
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ActionType.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for action-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="action-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="CREATE"/>
+ * &lt;enumeration value="UPDATE"/>
+ * &lt;enumeration value="DELETE"/>
+ * &lt;enumeration value="CREATE_VF_MODULE_VOL"/>
+ * &lt;enumeration value="UPDATE_VF_MODULE_VOL"/>
+ * &lt;enumeration value="DELETE_VF_MODULE_VOL"/>
+ * &lt;enumeration value="NOT_PROVIDED"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "action-type")
+@XmlEnum
+public enum ActionType {
+
+ CREATE,
+ UPDATE,
+ DELETE,
+ CREATE_VF_MODULE_VOL,
+ UPDATE_VF_MODULE_VOL,
+ DELETE_VF_MODULE_VOL,
+ NOT_PROVIDED;
+
+ public String value() {
+ return name();
+ }
+
+ public static ActionType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
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
new file mode 100644
index 0000000000..24b620eb6b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.openecomp.mso.apihandlerinfra.vnfbeans1 package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _VolumeParams_QNAME = new QName("http://ecomp.att.com/mso/infra/volume-request/v1", "volume-params");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link RequestInfo }
+ *
+ */
+ public RequestInfo createRequestInfo() {
+ return new RequestInfo();
+ }
+
+ /**
+ * Create an instance of {@link VolumeRequest }
+ *
+ */
+ public VolumeRequest createVolumeRequest() {
+ return new VolumeRequest();
+ }
+
+ /**
+ * Create an instance of {@link VolumeInputs }
+ *
+ */
+ public VolumeInputs createVolumeInputs() {
+ return new VolumeInputs();
+ }
+
+ /**
+ * Create an instance of {@link VolumeOutputs }
+ *
+ */
+ public VolumeOutputs createVolumeOutputs() {
+ return new VolumeOutputs();
+ }
+
+ /**
+ * Create an instance of {@link VolumeRequests }
+ *
+ */
+ public VolumeRequests createVolumeRequests() {
+ return new VolumeRequests();
+ }
+
+
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://ecomp.att.com/mso/infra/volume-request/v1", name = "volume-params")
+ public JAXBElement<Object> createVolumeParams(Object value) {
+ return new JAXBElement<Object>(_VolumeParams_QNAME, Object.class, null, value);
+ }
+
+}
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
new file mode 100644
index 0000000000..40e809c9fa
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java
@@ -0,0 +1,286 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="action" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}action-type"/>
+ * &lt;element name="request-status" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
+ * &lt;element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="end-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestId",
+ "action",
+ "requestStatus",
+ "statusMessage",
+ "progress",
+ "startTime",
+ "endTime",
+ "source"
+})
+@XmlRootElement(name = "request-info")
+public class RequestInfo {
+
+ @XmlElement(name = "request-id")
+ protected String requestId;
+ @XmlElement(required = true)
+ protected ActionType action;
+ @XmlElement(name = "request-status")
+ protected RequestStatusType requestStatus;
+ @XmlElement(name = "status-message")
+ protected String statusMessage;
+ protected Integer progress;
+ @XmlElement(name = "start-time")
+ protected String startTime;
+ @XmlElement(name = "end-time")
+ protected String endTime;
+ protected String source;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the action property.
+ *
+ * @return
+ * possible object is
+ * {@link ActionType }
+ *
+ */
+ public ActionType getAction() {
+ return action;
+ }
+
+ /**
+ * Sets the value of the action property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ActionType }
+ *
+ */
+ public void setAction(ActionType value) {
+ this.action = value;
+ }
+
+ /**
+ * Gets the value of the requestStatus property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestStatusType }
+ *
+ */
+ public RequestStatusType getRequestStatus() {
+ return requestStatus;
+ }
+
+ /**
+ * Sets the value of the requestStatus property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestStatusType }
+ *
+ */
+ public void setRequestStatus(RequestStatusType value) {
+ this.requestStatus = value;
+ }
+
+ /**
+ * Gets the value of the statusMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ /**
+ * Sets the value of the statusMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStatusMessage(String value) {
+ this.statusMessage = value;
+ }
+
+ /**
+ * Gets the value of the progress property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getProgress() {
+ return progress;
+ }
+
+ /**
+ * Sets the value of the progress property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setProgress(Integer value) {
+ this.progress = value;
+ }
+
+ /**
+ * Gets the value of the startTime property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Sets the value of the startTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStartTime(String value) {
+ this.startTime = value;
+ }
+
+ /**
+ * Gets the value of the endTime property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * Sets the value of the endTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setEndTime(String value) {
+ this.endTime = value;
+ }
+
+ /**
+ * 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;
+ }
+
+}
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
new file mode 100644
index 0000000000..dfa36894a7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestStatusType.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for request-status-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="request-status-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="COMPLETE"/>
+ * &lt;enumeration value="FAILED"/>
+ * &lt;enumeration value="IN_PROGRESS"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "request-status-type")
+@XmlEnum
+public enum RequestStatusType {
+
+ COMPLETE,
+ FAILED,
+ IN_PROGRESS,
+ PENDING,
+ TIMEOUT;
+
+ public String value() {
+ return name();
+ }
+
+ public static RequestStatusType fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
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
new file mode 100644
index 0000000000..55acf3270e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeInputs.java
@@ -0,0 +1,435 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="service-instance-id" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ * &lt;choice>
+ * &lt;element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="service-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;choice>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="aic-cloud-region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfType",
+ "vnfId",
+ "vfModuleModelName",
+ "asdcServiceModelVersion",
+ "serviceInstanceId",
+ "backoutOnFailure",
+ "serviceType",
+ "serviceId",
+ "aicNodeClli",
+ "aicCloudRegion",
+ "tenantId",
+ "volumeGroupName",
+ "volumeGroupId"
+})
+@XmlRootElement(name = "volume-inputs")
+public class VolumeInputs {
+ @XmlElement(name = "vnf-type", required = true)
+ protected String vnfType;
+ @XmlElement(name = "vnf-id")
+ protected String vnfId;
+ @XmlElement(name = "vf-module-model-name")
+ protected String vfModuleModelName;
+ @XmlElement(name = "asdc-service-model-version")
+ protected String asdcServiceModelVersion;
+ @XmlElement(name = "service-instance-id", required = true)
+ protected String serviceInstanceId;
+ @XmlElement(name = "backout-on-failure")
+ protected Boolean backoutOnFailure;
+ @XmlElement(name = "service-type")
+ protected String serviceType;
+ @XmlElement(name = "service-id")
+ protected String serviceId;
+ @XmlElement(name = "aic-node-clli", required = true)
+ protected String aicNodeClli;
+ @XmlElement(name = "aic-cloud-region")
+ protected String aicCloudRegion;
+ @XmlElement(name = "tenant-id", required = true)
+ protected String tenantId;
+ @XmlElement(name = "volume-group-name")
+ protected String volumeGroupName;
+ @XmlElement(name = "volume-group-id")
+ protected String volumeGroupId;
+
+ /**
+ * Gets the value of the volumeGroupId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ /**
+ * Sets the value of the volumeGroupId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupId(String value) {
+ this.volumeGroupId = value;
+ }
+
+ /**
+ * Gets the value of the volumeGroupName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupName() {
+ return volumeGroupName;
+ }
+
+ /**
+ * Sets the value of the volumeGroupName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupName(String value) {
+ this.volumeGroupName = value;
+ }
+
+ /**
+ * Gets the value of the vnfType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ /**
+ * Sets the value of the vnfType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfType(String value) {
+ this.vnfType = value;
+ }
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ /**
+ * Gets the value of the serviceInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ /**
+ * Sets the value of the serviceInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceInstanceId(String value) {
+ this.serviceInstanceId = value;
+ }
+
+ /**
+ * Gets the value of the serviceType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ /**
+ * Sets the value of the serviceType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceType(String value) {
+ this.serviceType = value;
+ }
+
+ /**
+ * Gets the value of the serviceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ /**
+ * Sets the value of the serviceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceId (String value) {
+ this.serviceId = value;
+ }
+
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the aicCloudRegion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicCloudRegion() {
+ return aicCloudRegion;
+ }
+
+ /**
+ * Sets the value of the aicCloudRegion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicCloudRegion(String value) {
+ this.aicCloudRegion = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+ /**
+ * Gets the value of the vfModuleModelName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVfModuleModelName() {
+ return vfModuleModelName;
+ }
+
+ /**
+ * Sets the value of the vfModuleModelName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVfModuleModelName(String value) {
+ this.vfModuleModelName = value;
+ }
+
+ /**
+ * Gets the value of the asdcServiceModelVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAsdcServiceModelVersion() {
+ return asdcServiceModelVersion;
+ }
+
+ /**
+ * Sets the value of the asdcServiceModelVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAsdcServiceModelVersion(String value) {
+ this.asdcServiceModelVersion = value;
+ }
+
+ /**
+ * Gets the value of the backoutOnFailure property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean getBackoutOnFailure() {
+ return backoutOnFailure;
+ }
+
+ /**
+ * Sets the value of the backoutOnFailure property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setBackoutOnFailure(Boolean value) {
+ this.backoutOnFailure = value;
+ }
+
+
+
+
+}
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
new file mode 100644
index 0000000000..be0d844d0a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeOutputs.java
@@ -0,0 +1,233 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfType",
+ "serviceType",
+ "aicNodeClli",
+ "tenantId",
+ "volumeGroupName",
+ "volumeGroupId"
+})
+@XmlRootElement(name = "volume-outputs")
+public class VolumeOutputs {
+ @XmlElement(name = "vnf-type", required = true)
+ protected String vnfType;
+ @XmlElement(name = "service-type")
+ protected String serviceType;
+ @XmlElement(name = "aic-node-clli", required = true)
+ protected String aicNodeClli;
+ @XmlElement(name = "tenant-id", required = true)
+ protected String tenantId;
+ @XmlElement(name = "volume-group-name")
+ protected String volumeGroupName;
+ @XmlElement(name = "volume-group-id")
+ protected String volumeGroupId;
+
+ /**
+ * Gets the value of the volumeId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ /**
+ * Sets the value of the volumeGroupId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupId(String value) {
+ this.volumeGroupId = value;
+ }
+
+ /**
+ * Gets the value of the volumeGroupName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVolumeGroupName() {
+ return volumeGroupName;
+ }
+
+ /**
+ * Sets the value of the volumeGroupName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVolumeGroupName(String value) {
+ this.volumeGroupName = value;
+ }
+
+ /**
+ * Gets the value of the vnfType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ /**
+ * Sets the value of the vnfType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfType(String value) {
+ this.vnfType = value;
+ }
+
+ /**
+ * Gets the value of the serviceType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ /**
+ * Sets the value of the serviceType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceType(String value) {
+ this.serviceType = value;
+ }
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+
+}
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
new file mode 100644
index 0000000000..9ec3d7e4d5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java
@@ -0,0 +1,179 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}request-info"/>
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-inputs"/>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-params" minOccurs="0"/>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-outputs" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestInfo",
+ "volumeInputs",
+ "volumeParams",
+ "volumeOutputs"
+})
+@XmlRootElement(name = "volume-request")
+public class VolumeRequest {
+
+ @XmlElement(name = "request-info", required = true)
+ protected RequestInfo requestInfo;
+ @XmlElement(name = "volume-inputs")
+ protected VolumeInputs volumeInputs;
+ @XmlElement(name = "volume-params")
+ protected Object volumeParams;
+ @XmlElement(name = "volume-outputs")
+ protected VolumeOutputs volumeOutputs;
+
+ /**
+ * 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;
+ }
+
+
+ /**
+ * Gets the value of the volumeInputs property.
+ *
+ * @return
+ * possible object is
+ * {@link VolumeInputs }
+ *
+ */
+ public VolumeInputs getVolumeInputs() {
+ return volumeInputs;
+ }
+
+ /**
+ * Sets the value of the volumeInputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VolumeInputs }
+ *
+ */
+ public void setVolumeInputs(VolumeInputs value) {
+ this.volumeInputs = value;
+ }
+
+ /**
+ * Gets the value of the volumeParams property.
+ *
+ * @return
+ * possible object is
+ * {@link Object }
+ *
+ */
+ public Object getVolumeParams() {
+ return volumeParams;
+ }
+
+ /**
+ * Sets the value of the volumeParams property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Object }
+ *
+ */
+ public void setVolumeParams(Object value) {
+ this.volumeParams = value;
+ }
+
+ /**
+ * Gets the value of the volumeOutputs property.
+ *
+ * @return
+ * possible object is
+ * {@link VolumeOutputs }
+ *
+ */
+ public VolumeOutputs getVolumeOutputs() {
+ return volumeOutputs;
+ }
+
+ /**
+ * Sets the value of the volumeOutputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VolumeOutputs }
+ *
+ */
+ public void setVolumeOutputs(VolumeOutputs value) {
+ this.volumeOutputs = value;
+ }
+
+}
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
new file mode 100644
index 0000000000..04fc16e822
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.volumebeans;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-request" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "volumeRequest"
+})
+@XmlRootElement(name = "volume-requests")
+public class VolumeRequests {
+
+ @XmlElement(name = "volume-request")
+ protected List<VolumeRequest> volumeRequest;
+
+ /**
+ * Gets the value of the volumeRequest property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the vnfRequest property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVolumeRequest().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VolumeRequest }
+ *
+ *
+ */
+ public List<VolumeRequest> getVolumeRequest() {
+ if (volumeRequest == null) {
+ volumeRequest = new ArrayList<VolumeRequest>();
+ }
+ return this.volumeRequest;
+ }
+
+}
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
new file mode 100644
index 0000000000..3678024b75
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/infra/volume-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.openecomp.mso.apihandlerinfra.volumebeans;
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties
new file mode 100644
index 0000000000..96c9e6fa18
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP MSO
+# ================================================================================
+# 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=========================================================
+###
+
+# -- welcome --
+welcomeTitle=JSF Blank Application
+
+welcomeHeading=Welcome!
+
+welcomeMessage=This is a JSF blank application. \
+ You can find the application.properties file with this message in the src/resources folder.