diff --git a/LICENSE.txt b/LICENSE.txt
index bb235ff..2bb9ad2 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,39 +1,176 @@
-/*
-* ============LICENSE_START==========================================
-* ===================================================================
-* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-* ===================================================================
-*
-* Unless otherwise specified, all software contained herein is licensed
-* under the Apache License, Version 2.0 (the “License”);
-* you may not use this software 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.
-*
-*
-*
-* Unless otherwise specified, all documentation contained herein is licensed
-* under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-* you may not use this documentation except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*             https://creativecommons.org/licenses/by/4.0/
-*
-* Unless required by applicable law or agreed to in writing, documentation
-* 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============================================
-*
-* ECOMP is a trademark and service mark of AT&T Intellectual Property.
-*
-*/
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
index cd6522b..d0d3999 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
@@ -69,6 +69,7 @@
 import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryException;
 import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryExceptionCategory;
 import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryAllottedResourceCustomization;
+import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryResourceRecipe;
 import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceCsar;
 import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
 import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceNetworks;
@@ -77,6 +78,7 @@
 import org.openecomp.mso.db.catalog.CatalogDatabase;
 import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
 import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.Recipe;
 import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
 import org.openecomp.mso.db.catalog.beans.ToscaCsar;
 import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
@@ -481,7 +483,7 @@
     @GET
     @Path("serviceToscaCsar")
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    public Response ServiceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
+    public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
         int respStatus = HttpStatus.SC_OK;
         String entity = "";
         try (CatalogDatabase db = CatalogDatabase.getInstance()) {
@@ -515,4 +517,58 @@
                 .build();
         }
     }
+    
+    /**
+     * Get the resource recipe info from catalog
+     * <br>
+     * 
+     * @param rmUuid resource model uuid
+     * @return the recipe information of the resource.
+     * @since ONAP Beijing Release
+     */
+    @GET
+    @Path("resourceRecipe")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
+        int respStatus = HttpStatus.SC_OK;
+        CatalogDatabase db = CatalogDatabase.getInstance();
+        String entity = "";
+        try{
+            if(rmUuid != null && !"".equals(rmUuid)){
+                LOGGER.debug ("Query recipe by resource model uuid: " + rmUuid);
+                //check vnf and network and ar, the resource could be any resource.
+                Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action);
+                if(null == recipe){
+                    recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action);
+                }
+                if(null == recipe){
+                    recipe = db.getArRecipeByModuleUuid(rmUuid, action);
+                }
+                if(recipe != null){
+                    QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
+                    entity = resourceRecipe.JSON2(false, false);
+                }
+                else{
+                    respStatus = HttpStatus.SC_NOT_FOUND;
+                }
+            }else{
+                throw(new Exception("Incoming parameter is null or blank"));
+            }           
+            LOGGER.debug ("Query recipe exit");
+            return Response
+                    .status(respStatus)
+                    .entity(entity) 
+                    .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+                    .build();
+        }catch(Exception e){
+            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR,  rmUuid, "", "resourceRecipe", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e);
+            CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+            return Response
+                    .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+                    .entity(new GenericEntity<CatalogQueryException>(excResp) {})
+                    .build();
+        }finally {
+            db.close();
+        }
+    }
 }
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
new file mode 100644
index 0000000..5be6970
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.adapters.catalogdb.catalogrest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.mso.db.catalog.beans.Recipe;
+
+/**
+ * serivce csar query support 
+ * <br>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version     ONAP Beijing Release  2018-02-28
+ */
+public class QueryResourceRecipe extends CatalogQuery{
+    
+    private Recipe resourceRecipe;
+    
+    public QueryResourceRecipe(Recipe resourceRecipe){
+        this.resourceRecipe =resourceRecipe;
+    }
+
+    private final String template =
+            "\t{\n"+
+            "\t\t\"id\"                     : <ID>,\n"+
+            "\t\t\"action\"                 : <ACTION>,\n"+
+            "\t\t\"orchestrationUri\"       : <ORCHESTRATION_URI>,\n"+
+            "\t\t\"recipeTimeout\"          : <RECIPE_TIMEOUT>,\n"+
+            "\t\t\"paramXSD\"               : <PARAM_XSD>,\n"+
+            "\t\t\"description\"            : <DESCRIPTION>\n"+
+            "\t}";
+    
+    @Override
+    public String toString() {
+
+        return resourceRecipe.toString();
+    }
+
+    @Override
+    public String JSON2(boolean isArray, boolean isEmbed) {
+        Map<String, String> valueMap = new HashMap<>();
+        put(valueMap, "ID", null == resourceRecipe ? null : resourceRecipe.getId());
+        put(valueMap, "ACTION", null == resourceRecipe ? null : resourceRecipe.getAction());
+        put(valueMap, "ORCHESTRATION_URI", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
+        put(valueMap, "RECIPE_TIMEOUT", null == resourceRecipe ? null : resourceRecipe.getRecipeTimeout());
+        put(valueMap, "PARAM_XSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD());
+        put(valueMap, "DESCRIPTION", null == resourceRecipe ? null : resourceRecipe.getDescription());
+        return this.setTemplate(template, valueMap);
+    }
+
+}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 0b404d7..99f6e86 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -333,7 +333,7 @@
      * 
      * @param serviceId
      * @param operationId
-     * @param resourceUUID
+     * @param resourceTemplateUUID
      * @return
      * @throws MsoRequestsDbException
      * @since   ONAP Amsterdam Release
@@ -350,7 +350,7 @@
      * 
      * @param serviceId
      * @param operationId
-     * @param resourceUUID
+     * @param resourceTemplateUUID
      * @param operationType
      * @param resourceInstanceID
      * @param jobId
@@ -363,13 +363,13 @@
      */
     @Override
     public void updateResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID,
-            String operType, String resourceInstanceID, String jobId, String status, String progress,
+            String operationType, String resourceInstanceID, String jobId, String status, String progress,
             String errorCode, String statusDescription) throws MsoRequestsDbException {
          ResourceOperationStatus resStatus = new ResourceOperationStatus();
          resStatus.setServiceId(serviceId);
          resStatus.setOperationId(operationId);
          resStatus.setResourceTemplateUUID(resourceTemplateUUID);
-         resStatus.setOperType(operType);
+         resStatus.setOperType(operationType);
          resStatus.setResourceInstanceID(resourceInstanceID);
          resStatus.setJobId(jobId);
          resStatus.setStatus(status);
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
index 48da1ab..5f779dd 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
@@ -60,7 +60,7 @@
     /**
      * Create a NS <br>
      * 
-     * @param servletReq the http request
+     * @param data the http request
      * @return
      * @since ONAP Amsterdam Release
      */
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
index 61966d0..30d42ae 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
@@ -39,7 +39,7 @@
      * </p>
      * 
      * @param errorCode error status
-     * @param errorDetail error detail
+     * @param errorMsg error detail
      * @since ONAP Amsterdam Release 2017-9-6
      */
     public ApplicationException(int errorCode, String errorMsg) {
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
index c79d09e..13727bd 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
@@ -47,7 +47,7 @@
    * Assert String parameter.<br/>
    * 
    * @param paramValue parameter data
-   * @param name of parameter
+   * @param paramName parameter name
    * @since ONAP Amsterdam Release 2017-9-6
    */
   public static void assertStringNotNull(String paramValue, String paramName)
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
index 95d3bf6..759ceed 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
@@ -60,7 +60,7 @@
     /**
      * mock get request body <br>
      * 
-     * @param request
+     * @param fileName
      * @return
      * @since ONAP Amsterdam Release
      */
@@ -71,7 +71,6 @@
     /**
      * Mock the request body form a file <br>
      * 
-     * @param fileName
      * @since ONAP Amsterdam Release
      */
     private void mockRestfulUtil() {
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index 4842580..5c65429 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -371,8 +371,9 @@
      * @param cloudSiteId CLLI code of the cloud site in which to delete
      * @param tenantId Openstack tenant identifier
      * @param vnfName VNF Name or Openstack ID
+     * @param messageId
      * @param msoRequest Request tracking information for logs
-     * @param notificationURL the target URL for asynchronous response
+     * @param notificationUrl the target URL for asynchronous response
      */
     @Override
     public void deleteVnfA (String cloudSiteId,
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
index 3452a10..856b713 100755
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
@@ -145,7 +145,7 @@
      * @param tenantId The cloud tenant in which to delete the VDU.
      * @param vduInstanceId The unique id of the deployment to delete.
      * @param timeoutMinutes Timeout after which the delete action will be cancelled
-     * @param deleteBlueprint Flag to also delete the blueprint
+     * @param keepBlueprintLoaded Flag to also delete the blueprint
      * 
      * @return A VduInfo object, representing the state of the instance just prior to deletion.
      * 
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
index 295dddd..430bd10 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
@@ -78,7 +78,7 @@
     
     /**
      * Check that controllers list needs to be updated or not.
-     * @param return true if the list has been updated
+     * return true if the list has been updated
      */
     private boolean updateControllersListIfNeeded ()  {
     	boolean updateNeeded=false;
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
index dd6e56a..921e0ee 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -1203,4 +1203,25 @@
 		}
 
 	}
+	
+    /**
+     * get resource recipe by resource model uuid and action
+     */
+    public JSONObject getResourceRecipe(Execution execution, String resourceModelUuid, String action) {
+        String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
+        JSONObject responseJson = null
+        try {
+            msoLogger.debug("ENDPOINT: " + endPoint)
+            String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
+
+            if (catalogDbResponse != null) {
+                responseJson = new JSONObject(catalogDbResponse)
+            }
+        }
+        catch (Exception e) {
+            utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+        }
+
+        return responseJson
+    }
 }
\ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
index 5972c76..2ad1e30 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
@@ -38,11 +38,10 @@
     public static final String AES = "AES";
 
     /**
-    * encrypt a value and generate a keyfile
+     * encrypt a value and generate a keyfile
      * if the keyfile is not found then a new one is created
-    * @throws GeneralSecurityException
-     * @throws IOException
-     */
+     * @throws GeneralSecurityException
+     * */
     public static String encrypt(String value, String keyString) throws GeneralSecurityException
     {
         SecretKeySpec sks = getSecretKeySpec(keyString);
@@ -53,9 +52,8 @@
     }
 
     /**
-    * decrypt a value
+     * decrypt a value
      * @throws GeneralSecurityException
-     * @throws IOException
      */
     public static String decrypt(String message, String keyString) throws GeneralSecurityException
     {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
index 765bf61..f7db52b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
@@ -71,7 +71,7 @@
 	}
 
 	/**
-	 * @param inputClass
+	 * @param action
 	 * @return
 	 * @throws ClassNotFoundException
 	 * @throws InstantiationException
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
index 124e2c3..f54eba4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
@@ -42,7 +42,7 @@
 
 	@Override
 	protected void initializeHeaderMap(Map<String, String> headerMap) {
-		headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes()));
+		headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));
 	}
 
 	@Override
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
index c746c0d..df30e43 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
@@ -27,8 +27,8 @@
 	/**
 	 * Issues a health diagnostic request for a given vnf to SDN-O
 	 * 
-	 * @param vnfName
-	 * @param uuid
+	 * @param vnfId
+	 * @param requestingUserId
 	 * @throws IOException
 	 * @throws Exception
 	 */
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
index b71f708..6f0095f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
@@ -1829,7 +1829,7 @@
 		/**
 		 * Constructor
 		 * @param contentType the HTTP content type (optional)
-		 * @param type the callback message type (optional)
+		 * @param messageType the callback message type (optional)
 		 * @param content the content
 		 */
 		public CallbackData(String contentType, String messageType, String content) {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
index 6059a35..b627205 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
@@ -238,7 +238,6 @@
 	 * Reads properties from the specified file, updates the property file cache, and
 	 * returns the properties in a map.
 	 * @param file the file to read
-	 * @param reload true if this is a reload event
 	 * @return a map of properties
 	 */
 	private Map<String, String> readProperties(File file) throws IOException {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java
index b972d6a..a1719a9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java
@@ -176,7 +176,7 @@
 	 * PropertyConfiguration, just like they do when a property file is updated on
 	 * a real MSO system. This method will optionally wait for the new properties
 	 * to be loaded.  Timeout results in an IOException.
-	 * @param values new properties
+	 * @param properties new properties
 	 * @param wait maximum amount of time to wait for new properties to be loaded,
 	 *             in milliseconds.  A value of zero means, "Do not wait."
 	 * @throws IOException
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java
index a09f5a7..20903c0 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java
@@ -146,7 +146,6 @@
 	 * 
 	 * default setter for this field deprecated
 	 * @param modelName << serviceResources.modelInfo.modelName
-	 * @param modelInstanceName
 	 */
 	public void constructVnfType(String modelName) {
 		this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
index 2612c38..b0152a1 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
@@ -117,7 +117,7 @@
 	 * to convert a JSONObject to an XML Doc. The intent of this is to
 	 * correctly generate XML from JSON including TAGs for JSONArrays
 	 *
-	 * @param  jsonObj	org.json.JSON object to be converted to XML
+	 * @param  obj object to be converted to XML
 	 * @param  tagName 	optional XML tagname supplied primarily during recursive calls
 	 * @return String containing the XML translation
 	 */
@@ -913,7 +913,7 @@
 	 * and puts it in a Java List<String>.
 	 *
 	 * @param execution
-	 * @param stringArray - the getJsonValue of a json array of strings
+	 * @param jsonArrayOfStrings - the getJsonValue of a json array of strings
 	 *
 	 * @return List - a java list containing the strings
 	 *
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java
index 177fafc..c48b671 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java
@@ -93,7 +93,7 @@
 	 * aai:endpoint becomes URN_aai_endpoint <br/>
 	 * ae:internal-reporting becomes URN_ae_internal_reporting <br/>
 	 * 
-	 * @param name the URN
+	 * @param urn the URN
 	 * @return a normalized identifier
 	 */
 	public static String createIdentifierFromURN(String urn) {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
index f5b9f8d..1fc43ba 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
@@ -130,7 +130,7 @@
 
 	/**
 	 * Encodes a value so it can be used inside an XML text element.
-	 * @param s the string to encode
+	 * @param value the string to encode
 	 * @return the encoded string
 	 */
 	public static String encode(Object value) {
@@ -171,7 +171,7 @@
 	
 	/**
 	 * Encodes a value so it can be used inside an XML attribute.
-	 * @param s the string to encode
+	 * @param value the string to encode
 	 * @return the encoded string
 	 */
 	public static String encodeAttr(Object value) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 54bd8cd..38a44ab 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -150,7 +150,7 @@
 
     private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) {
         logger.info("AbstractSdncOperationTask.getPostStringBody begin!");
-        String postBody = new String(postBodyTemplate);
+        String postBody = postBodyTemplate;
         postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode());
         postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId());
         postBody = postBody.replace("$operType", resourceOperationStatus.getOperType());
@@ -166,7 +166,7 @@
 
     private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) {
         logger.info("AbstractSdncOperationTask.getGetStringBody begin!");
-        String getBody = new String(getBodyTemplate);
+        String getBody = getBodyTemplate;
         getBody = getBody.replace("$operationId", operationId);
         getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID);
         getBody = getBody.replace("$serviceId", serviceId);
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
index 87f5786..3170e49 100644
--- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
@@ -242,16 +242,16 @@
     /**
      * Creates a RESTClient with the RESTConfig object.
      *
-     * @param RESTConfig config to use for sending request
+     * @param restConfig config to use for sending request
      *
      * @throws RESTException if unable to create a RESTClient
      */
-    public RESTClient(RESTConfig cfg) throws RESTException {
+    public RESTClient(RESTConfig restConfig) throws RESTException {
         this.headers = new LinkedHashMap<>();
         this.parameters = new LinkedHashMap<>();
-        this.URL = cfg.getURL();
-        this.proxyHost = cfg.getProxyHost();
-        this.proxyPort = cfg.getProxyPort();
+        this.URL = restConfig.getURL();
+        this.proxyHost = restConfig.getProxyHost();
+        this.proxyPort = restConfig.getProxyPort();
     }
 
     /**
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
index 7b559df..db58c5a 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
@@ -598,8 +598,8 @@
 		assertFalse(msoProperties.equals(msoProperties2));
 		assertTrue(msoProperties.equals(msoProperties));
 		assertFalse(msoProperties.equals(null));
-		assertFalse(msoProperties.equals(new String()));
-		
+		assertFalse(msoProperties.toString().isEmpty());
+
 		// Test a reload with timer set to 1 in PATH_MSO_JSON_PROP2
 		msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
 
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
index 371d316..9258cab 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
@@ -60,7 +60,8 @@
 			if(encryptedCredentials != null){
 				String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
 				if(userCredentials != null){
-					post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+					post.addHeader("Authorization", "Basic " + DatatypeConverter
+                        .printBase64Binary(userCredentials.getBytes()));
 				}
 			}
 		}
@@ -83,7 +84,8 @@
 			if(encryptedCredentials != null){
 				String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
 				if(userCredentials != null){
-					post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+					post.addHeader("Authorization", "Basic " + DatatypeConverter
+                        .printBase64Binary(userCredentials.getBytes()));
 				}
 			}
 		}
@@ -115,7 +117,8 @@
 			if(encryptedCredentials != null){
 				String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
 				if(userCredentials != null){
-					post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+					post.addHeader("Authorization", "Basic " + DatatypeConverter
+                        .printBase64Binary(userCredentials.getBytes()));
 				}
 			}
 		}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
index 364169d..4b179da 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
@@ -52,7 +52,8 @@
 			if(encryptedCredentials != null){
 				String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
 				if(userCredentials != null){
-					post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+					post.addHeader("Authorization", "Basic " + DatatypeConverter
+                        .printBase64Binary(userCredentials.getBytes()));
 				}
 			}
 		}
@@ -90,7 +91,8 @@
 			if(encryptedCredentials != null){
 				String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
 				if(userCredentials != null){
-					get.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+					get.addHeader("Authorization", "Basic " + DatatypeConverter
+                        .printBase64Binary(userCredentials.getBytes()));
 				}
 			}
 		}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index 0914516..c51c61e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -1,940 +1,1155 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.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.hibernate.Session;
-import org.json.JSONObject;
-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.Messages;
-import org.openecomp.mso.apihandlerinfra.MsoException;
-import org.openecomp.mso.apihandlerinfra.MsoRequest;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.DelE2ESvcResp;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoDatabaseException;
-import org.openecomp.mso.requestsdb.OperationStatus;
-import org.openecomp.mso.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.utils.UUIDChecker;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-
-@Path("/e2eServiceInstances")
-@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances")
-public class E2EServiceInstances {
-
-	private HashMap<String, String> instanceIdMap = new HashMap<>();
-	private static MsoLogger msoLogger = MsoLogger
-			.getMsoLogger(MsoLogger.Catalog.APIH);
-	private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
-	public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-	private ServiceInstancesRequest sir = null;
-
-	public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
-	public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
-	public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
-
-	/**
-	 * POST Requests for E2E Service create Instance on a version provided
-	 */
-
-	@POST
-	@Path("/{version:[vV][3-5]}")
-	@Consumes(MediaType.APPLICATION_JSON)
-	@Produces(MediaType.APPLICATION_JSON)
-	@ApiOperation(value = "Create a E2E Service Instance on a version provided", response = Response.class)
-	public Response createE2EServiceInstance(String request,
-			@PathParam("version") String version) {
-
-		return processE2EserviceInstances(request, Action.createInstance, null,
-				version);
-	}
-
-	/**
-	 * DELETE Requests for E2E Service delete Instance on a specified version
-	 * and serviceId
-	 */
-
-	@DELETE
-	@Path("/{version:[vV][3-5]}/{serviceId}")
-	@Consumes(MediaType.APPLICATION_JSON)
-	@Produces(MediaType.APPLICATION_JSON)
-	@ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
-	public Response deleteE2EServiceInstance(String request,
-			@PathParam("version") String version,
-			@PathParam("serviceId") String serviceId) {
-
-		instanceIdMap.put("serviceId", serviceId);
-
-		return deleteE2EserviceInstances(request, Action.deleteInstance,
-				instanceIdMap, version);
-	}
-
-	@GET
-	@Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
-	@ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
-	@Produces(MediaType.APPLICATION_JSON)
-	public Response getE2EServiceInstances(
-			@PathParam("serviceId") String serviceId,
-			@PathParam("version") String version,
-			@PathParam("operationId") String operationId) {
-		return getE2EServiceInstances(serviceId, operationId);
-	}
-
-	private Response getE2EServiceInstances(String serviceId, String operationId) {
-		RequestsDatabase requestsDB = RequestsDatabase.getInstance();
-
-		GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
-
-		MsoRequest msoRequest = new MsoRequest(serviceId);
-
-		long startTime = System.currentTimeMillis();
-
-		OperationStatus operationStatus = null;
-
-		try {
-			operationStatus = requestsDB.getOperationStatus(serviceId,
-					operationId);
-
-		} 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 (operationStatus == null) {
-			Response resp = msoRequest.buildServiceErrorResponse(
-					HttpStatus.SC_NO_CONTENT, MsoException.ServiceException,
-					"E2E serviceId " + serviceId + " 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 serviceId");
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-					MsoLogger.ResponseCode.DataNotFound,
-					"Null response from RequestDB when searching by serviceId");
-			msoLogger.debug("End of the transaction, the final response is: "
-					+ (String) resp.getEntity());
-			return resp;
-
-		}
-
-		e2eServiceResponse.setOperationStatus(operationStatus);
-
-		return Response.status(200).entity(e2eServiceResponse).build();
-	}
-
-	private Response deleteE2EserviceInstances(String requestJSON,
-			Action action, HashMap<String, String> instanceIdMap, String version) {
-		// TODO should be a new one or the same service instance Id
-		String requestId = instanceIdMap.get("serviceId");
-		long startTime = System.currentTimeMillis();
-		msoLogger.debug("requestId is: " + requestId);
-		E2EServiceInstanceDeleteRequest e2eDelReq = null;
-
-		MsoRequest msoRequest = new MsoRequest(requestId);
-
-		ObjectMapper mapper = new ObjectMapper();
-		try {
-			e2eDelReq = mapper.readValue(requestJSON,
-					E2EServiceInstanceDeleteRequest.class);
-
-		} catch (Exception e) {
-
-			msoLogger.debug("Mapping of request to JSON object failed : ", e);
-			Response response = msoRequest.buildServiceErrorResponse(
-					HttpStatus.SC_BAD_REQUEST,
-					MsoException.ServiceException,
-					"Mapping of request to JSON object failed.  "
-							+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
-					null);
-			msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
-					MSO_PROP_APIHANDLER_INFRA, "", "",
-					MsoLogger.ErrorCode.SchemaError, requestJSON, e);
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-					MsoLogger.ResponseCode.SchemaError,
-					"Mapping of request to JSON object failed");
-			msoLogger.debug("End of the transaction, the final response is: "
-					+ (String) response.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return response;
-		}
-
-		CatalogDatabase db = null;
-		RecipeLookupResult recipeLookupResult = null;
-		try {
-			db = CatalogDatabase.getInstance();
-			//TODO  Get the service template model version uuid from AAI.
-			recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action);
-		} 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
-					+ (String) response.getEntity());
-			return response;
-		} finally {
-			closeCatalogDB(db);
-		}
-		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
-					+ (String) response.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return response;
-		}
-
-		RequestClient requestClient = null;
-		HttpResponse response = null;
-
-		long subStartTime = System.currentTimeMillis();
-		// String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
-
-		try {
-			requestClient = RequestClientFactory.getRequestClient(
-					recipeLookupResult.getOrchestrationURI(),
-					MsoPropertiesUtils.loadMsoProperties());
-
-			JSONObject jjo = new JSONObject(requestJSON);
-			jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
-
-			String bpmnRequest = jjo.toString();
-
-			// Capture audit event
-			msoLogger
-					.debug("MSO API Handler Posting call to BPEL engine for url: "
-							+ requestClient.getUrl());
-			String serviceId = instanceIdMap.get("serviceId");
-			String serviceInstanceType = e2eDelReq.getServiceType();
-			response = requestClient.post(requestId, false,
-					recipeLookupResult.getRecipeTimeout(), action.name(),
-					serviceId, null, null, null, null, serviceInstanceType,
-					null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
-
-			msoLogger.recordMetricEvent(subStartTime,
-					MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-					"Successfully received response from BPMN engine", "BPMN",
-					recipeLookupResult.getOrchestrationURI(), null);
-		} catch (Exception e) {
-			msoLogger.recordMetricEvent(subStartTime,
-					MsoLogger.StatusCode.ERROR,
-					MsoLogger.ResponseCode.CommunicationError,
-					"Exception while communicate with BPMN engine", "BPMN",
-					recipeLookupResult.getOrchestrationURI(), null);
-			Response resp = msoRequest.buildServiceErrorResponse(
-					HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
-					"Failed calling bpmn " + e.getMessage(),
-					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
-			alarmLogger.sendAlarm("MsoConfigurationError",
-					MsoAlarmLogger.CRITICAL,
-					Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
-			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
-					MSO_PROP_APIHANDLER_INFRA, "", "",
-					MsoLogger.ErrorCode.AvailabilityError,
-					"Exception while communicate with BPMN engine");
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-					MsoLogger.ResponseCode.CommunicationError,
-					"Exception while communicate with BPMN engine");
-			msoLogger.debug("End of the transaction, the final response is: "
-					+ (String) resp.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return resp;
-		}
-
-		if (response == null) {
-			Response resp = msoRequest.buildServiceErrorResponse(
-					HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
-					"bpelResponse is null",
-					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
-			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
-					MSO_PROP_APIHANDLER_INFRA, "", "",
-					MsoLogger.ErrorCode.BusinessProcesssError,
-					"Null response from BPEL");
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-					MsoLogger.ResponseCode.InternalError,
-					"Null response from BPMN");
-			msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return resp;
-		}
-
-		ResponseHandler respHandler = new ResponseHandler(response,
-				requestClient.getType());
-		int bpelStatus = respHandler.getStatus();
-
-		return beplStatusUpdate(requestId, startTime, msoRequest,
-				requestClient, respHandler, bpelStatus, action, instanceIdMap);
-	}
-
-	private Response processE2EserviceInstances(String requestJSON, Action action,
-			HashMap<String, String> instanceIdMap, String version) {
-
-		String requestId = UUIDChecker.generateUUID(msoLogger);
-		long startTime = System.currentTimeMillis();
-		msoLogger.debug("requestId is: " + requestId);
-		E2EServiceInstanceRequest e2eSir = null;
-
-		MsoRequest msoRequest = new MsoRequest(requestId);
-		ObjectMapper mapper = new ObjectMapper();
-		try {
-			e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
-
-		} catch (Exception e) {
-          //TODO update the service name
-          this.createOperationStatusRecordForError(action, requestId);
-		  
-			msoLogger.debug("Mapping of request to JSON object failed : ", e);
-			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
-					MsoException.ServiceException, "Mapping of request to JSON object failed.  " + e.getMessage(),
-					ErrorNumbers.SVC_BAD_PARAMETER, null);
-			msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
-					MsoLogger.ErrorCode.SchemaError, requestJSON, e);
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
-					"Mapping of request to JSON object failed");
-			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
-			return response;
-		}
-
-		mapReqJsonToSvcInstReq(e2eSir, requestJSON);
-		sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
-		try {
-			msoRequest.parse(sir, instanceIdMap, action, version);
-		} catch (Exception e) {
-			msoLogger.debug("Validation failed: ", e);
-			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
-					MsoException.ServiceException, "Error parsing request.  " + e.getMessage(),
-					ErrorNumbers.SVC_BAD_PARAMETER, null);
-			if (msoRequest.getRequestId() != null) {
-				msoLogger.debug("Logging failed message to the database");
-				//TODO update the service name
-		          this.createOperationStatusRecordForError(action, requestId);
-			}
-			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;
-		}
-		
-		OperationStatus dup = null;
-		String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
-		String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
-		try {
-			if (!(instanceName == null && "service".equals(requestScope)
-					&& (action == Action.createInstance || action == Action.activateInstance))) {
-			  //TODO : Need to check for the duplicate record from the operation status,
-			  //TODO : commenting this check for unblocking current testing for now...  induces dead code...
-				dup = chkDuplicateServiceNameInOperStatus( instanceName);
-			}
-		} 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.getProgress() + " (ServiceId - "
-					+ dup.getServiceId() + "). The existing request must finish or be cleaned up before proceeding.";
-
-			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
-					MsoException.ServiceException, dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
-
-			msoLogger.warn(MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError,
-					"Duplicate request - Subscriber already has a request for this service");
-			
-			
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
-					dupMessage);
-			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return response;
-		}
-		
-		CatalogDatabase db = null;
-		RecipeLookupResult recipeLookupResult = null;
-		try {
-			db = CatalogDatabase.getInstance();
-			recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getTemplateId(), action);
-		} 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));
-			
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
-					"Exception while communciate with DB");
-			msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return response;
-		} finally {
-			closeCatalogDB(db);
-		}
-
-		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);
-		
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
-					"No recipe found in DB");
-			msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return response;
-		}
-//		try {
-//			msoRequest.createRequestRecord(Status.PENDING, action);
-//			//createOperationStatusRecord(action, requestId);
-//		} 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;
-//		}
-
-		String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
-
-		String serviceId = "";
-		RequestClient requestClient = null;
-		HttpResponse response = null;
-
-		long subStartTime = System.currentTimeMillis();
-		String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
-
-		try {
-			requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
-					MsoPropertiesUtils.loadMsoProperties());
-
-			// Capture audit event
-			msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
-
-			response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
-					serviceId, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, recipeLookupResult.getRecipeParamXsd());
-
-			msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-					"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
-					null);
-		} catch (Exception e) {
-			msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
-					MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
-					recipeLookupResult.getOrchestrationURI(), null);
-			Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
-					MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
-					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
-			alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
-					Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
-			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
-					MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
-					"Exception while communicate with BPMN engine");
-			msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
-			createOperationStatusRecordForError(action, requestId);
-			return resp;
-		}
-
-		if (response == null) {
-			Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
-					MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
-			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
-					MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
-			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
-					"Null response from BPMN");
-			msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
-			return resp;
-		}
-
-		ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
-		int bpelStatus = respHandler.getStatus();
-
-		return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
-	}
-
-	private void closeCatalogDB(CatalogDatabase db) {
-		if (db != null) {
-			db.close();
-		}
-	}
-
-	private Response beplStatusUpdate(String requestId, long startTime,
-			MsoRequest msoRequest, RequestClient requestClient,
-			ResponseHandler respHandler, int bpelStatus, Action action,
-			HashMap<String, String> instanceIdMap) {
-		// BPMN accepted the request, the request is in progress
-		if (bpelStatus == HttpStatus.SC_ACCEPTED) {
-			String camundaJSONResponseBody = respHandler.getResponseBody();
-			msoLogger
-					.debug("Received from Camunda: " + camundaJSONResponseBody);
-
-			// currently only for delete case we update the status here
-			if (action == Action.deleteInstance) {
-				ObjectMapper mapper = new ObjectMapper();
-				try {
-					DelE2ESvcResp jo = mapper.readValue(
-							camundaJSONResponseBody, DelE2ESvcResp.class);
-					String operationId = jo.getOperationId();
-    				this.createOperationStatusRecord("DELETE", requestId,
-								operationId);
-				} catch (Exception ex) {
-					msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
-							requestClient.getUrl(), "", "",
-							MsoLogger.ErrorCode.BusinessProcesssError,
-							"Response from BPEL engine is failed with HTTP Status="
-									+ bpelStatus);
-				}
-			}
-			msoLogger.recordAuditEvent(startTime,
-					MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-					"BPMN accepted the request, the request is in progress");
-			msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
-			return Response.status(HttpStatus.SC_ACCEPTED)
-					.entity(camundaJSONResponseBody).build();
-		} else {
-			List<String> variables = new ArrayList<>();
-			variables.add(bpelStatus + "");
-			String camundaJSONResponseBody = respHandler.getResponseBody();
-			if (camundaJSONResponseBody != null
-					&& !camundaJSONResponseBody.isEmpty()) {
-				Response resp = msoRequest.buildServiceErrorResponse(
-						bpelStatus, MsoException.ServiceException,
-						"Request Failed due to BPEL error with HTTP Status= %1 "
-								+ '\n' + camundaJSONResponseBody,
-						ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
-				msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
-						requestClient.getUrl(), "", "",
-						MsoLogger.ErrorCode.BusinessProcesssError,
-						"Response from BPEL engine is failed with HTTP Status="
-								+ bpelStatus);
-				msoLogger.recordAuditEvent(startTime,
-						MsoLogger.StatusCode.ERROR,
-						MsoLogger.ResponseCode.InternalError,
-						"Response from BPMN engine is failed");
-				msoLogger.debug(END_OF_THE_TRANSACTION
-						+ (String) resp.getEntity());
-				return resp;
-			} else {
-				Response resp = msoRequest
-						.buildServiceErrorResponse(
-								bpelStatus,
-								MsoException.ServiceException,
-								"Request Failed due to BPEL error with HTTP Status= %1",
-								ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
-								variables);
-				msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
-						requestClient.getUrl(), "", "",
-						MsoLogger.ErrorCode.BusinessProcesssError,
-						"Response from BPEL engine is empty");
-				msoLogger.recordAuditEvent(startTime,
-						MsoLogger.StatusCode.ERROR,
-						MsoLogger.ResponseCode.InternalError,
-						"Response from BPEL engine is empty");
-				msoLogger.debug(END_OF_THE_TRANSACTION
-						+ (String) resp.getEntity());
-				return resp;
-			}
-		}
-	}
-
-	/**
-	 * Getting recipes from catalogDb
-	 * 
-	 * @param db the catalog db
-	 * @param serviceModelUUID the service model version uuid
-	 * @param action the action for the service
-	 * @return the service recipe result
-	 */
-	private RecipeLookupResult getServiceInstanceOrchestrationURI(
-			CatalogDatabase db, String serviceModelUUID, Action action) {
-
-		RecipeLookupResult recipeLookupResult = getServiceURI(db, serviceModelUUID, action);
-
-		if (recipeLookupResult != null) {
-			msoLogger.debug("Orchestration URI is: "
-					+ recipeLookupResult.getOrchestrationURI()
-					+ ", recipe Timeout is: "
-					+ Integer.toString(recipeLookupResult.getRecipeTimeout()));
-		} else {
-			msoLogger.debug("No matching recipe record found");
-		}
-		return recipeLookupResult;
-	}
-
-	/**
-	 * Getting recipes from catalogDb
-	 * If Service recipe is not set, use default recipe, if set , use special recipe.
-	 * @param db the catalog db
-	 * @param serviceModelUUID the service version uuid
-	 * @param action the action of the service.
-	 * @return the service recipe result.
-	 */
-	private RecipeLookupResult getServiceURI(CatalogDatabase db, String serviceModelUUID, Action action) {
-
-		String defaultServiceModelName = "UUI_DEFAULT";
-
-		Service defaultServiceRecord = db
-				.getServiceByModelName(defaultServiceModelName);
-		ServiceRecipe defaultRecipe = db.getServiceRecipeByModelUUID(
-		        defaultServiceRecord.getModelUUID(), action.name());
-		//set recipe as default generic recipe
-		ServiceRecipe recipe = defaultRecipe;
-		//check the service special recipe 
-		if(null != serviceModelUUID && ! serviceModelUUID.isEmpty()){
-		      ServiceRecipe serviceSpecialRecipe = db.getServiceRecipeByModelUUID(
-		              serviceModelUUID, action.name());
-		      if(null != serviceSpecialRecipe){
-		          //set service special recipe.
-		          recipe = serviceSpecialRecipe;
-		      }
-		}	
-		
-		if (recipe == null) {
-			return null;
-		}
-		return new RecipeLookupResult(recipe.getOrchestrationUri(),
-				recipe.getRecipeTimeout(), recipe.getServiceParamXSD());
-
-	}
-
-	/**
-	 * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and
-	 * passing it to camunda engine.
-	 * 
-	 * @param e2eSir
-	 * @return
-	 */
-	private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir,
-			String requestJSON) {
-
-		sir = new ServiceInstancesRequest();
-
-		String returnString = null;
-		RequestDetails requestDetails = new RequestDetails();
-		ModelInfo modelInfo = new ModelInfo();
-
-		// ModelInvariantId
-		modelInfo.setModelInvariantId(e2eSir.getService().getServiceDefId());
-
-		// modelNameVersionId
-		modelInfo.setModelNameVersionId(e2eSir.getService().getTemplateId());
-
-		// String modelInfoValue =
-		// e2eSir.getService().getParameters().getNodeTemplateName();
-		// String[] arrayOfInfo = modelInfoValue.split(":");
-		// String modelName = arrayOfInfo[0];
-		// String modelVersion = arrayOfInfo[1];
-
-		// TODO: To ensure, if we dont get the values from the UUI
-		String modelName = "voLTE";
-		String modelVersion = "1.0";
-		// modelName
-		modelInfo.setModelName(modelName);
-
-		// modelVersion
-		modelInfo.setModelVersion(modelVersion);
-
-		// modelType
-		modelInfo.setModelType(ModelType.service);
-
-		// setting modelInfo to requestDetails
-		requestDetails.setModelInfo(modelInfo);
-
-		SubscriberInfo subscriberInfo = new SubscriberInfo();
-
-		// globalsubscriberId
-		subscriberInfo.setGlobalSubscriberId(e2eSir.getService()
-				.getParameters().getGlobalSubscriberId());
-
-		// subscriberName
-		subscriberInfo.setSubscriberName(e2eSir.getService().getParameters()
-				.getSubscriberName());
-
-		// setting subscriberInfo to requestDetails
-		requestDetails.setSubscriberInfo(subscriberInfo);
-
-		RequestInfo requestInfo = new RequestInfo();
-
-		// instanceName
-		requestInfo.setInstanceName(e2eSir.getService().getName());
-
-		// source
-		requestInfo.setSource("UUI");
-
-		// suppressRollback
-		requestInfo.setSuppressRollback(true);
-
-		// setting requestInfo to requestDetails
-		requestDetails.setRequestInfo(requestInfo);
-
-		RequestParameters requestParameters = new RequestParameters();
-
-		// subscriptionServiceType
-		requestParameters.setSubscriptionServiceType("MOG");
-
-		// Userparams
-		List<E2EUserParam> userParams;
-		// userParams =
-		// e2eSir.getService().getParameters().getRequestParameters().getUserParams();
-		List<Map<String, String>> userParamList = new ArrayList<>();
-		Map<String, String> userParamMap = new HashMap<>();
-		// complete json request updated in the camunda
-		userParamMap.put("UUIRequest", requestJSON);
-		userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
-
-		// Map<String, String> userParamMap3 = null;
-		// for (E2EUserParam userp : userParams) {
-		// userParamMap.put(userp.getName(), userp.getValue());
-		//
-		// }
-		userParamList.add(userParamMap);
-		requestParameters.setUserParams(userParamList);
-
-		// setting requestParameters to requestDetails
-		requestDetails.setRequestParameters(requestParameters);
-
-		sir.setRequestDetails(requestDetails);
-
-		// converting to string
-		ObjectMapper mapper = new ObjectMapper();
-		try {
-			returnString = mapper.writeValueAsString(sir);
-		} catch (IOException e) {
-			msoLogger
-					.debug("Exception while converting ServiceInstancesRequest object to string",
-							e);
-		}
-
-		return returnString;
-	}
-
-	private void createOperationStatusRecordForError(Action action,
-			String requestId) throws MsoDatabaseException {
-
-		AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
-		Session session = null;
-		try {
-
-			session = requestsDbSessionFactoryManager.getSessionFactory()
-					.openSession();
-			session.beginTransaction();
-
-			OperationStatus os = new OperationStatus();
-			os.setOperation(action.name());
-			os.setOperationContent("");
-			os.setOperationId("");
-			os.setProgress("100");
-			os.setReason("");
-			os.setResult("error");
-			os.setServiceId(requestId);
-			os.setUserId("");
-			Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
-			Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
-			os.setFinishedAt(endTimeStamp);
-			os.setOperateAt(startTimeStamp);
-
-			session.save(os);
-			session.getTransaction().commit();
-
-		} catch (Exception e) {
-			msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
-					MsoLogger.ErrorCode.DataError,
-					"Exception when creation record request in Operation", e);
-			throw new MsoDatabaseException(
-					"Data did inserted in Operatus Status Table for failure", e);
-		} finally {
-			if (null != session) {
-				session.close();
-			}
-		}
-	}
-
-	private void createOperationStatusRecord(String actionNm, String serviceId,
-			String operationId) throws MsoDatabaseException {
-
-		AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
-		Session session = null;
-		try {
-
-			session = requestsDbSessionFactoryManager.getSessionFactory()
-					.openSession();
-			session.beginTransaction();
-
-			OperationStatus os = new OperationStatus();
-			os.setOperation(actionNm);
-			os.setOperationContent("");
-			os.setOperationId(operationId);
-			os.setProgress("0");
-			os.setReason("");
-			os.setResult("processing");
-			os.setServiceId(serviceId);
-			// TODO : to be updated...
-			os.setUserId("");
-			Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
-			Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
-			os.setFinishedAt(endTimeStamp);
-			os.setOperateAt(startTimeStamp);
-
-			session.save(os);
-			session.getTransaction().commit();
-
-		} catch (Exception e) {
-			msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
-					MsoLogger.ErrorCode.DataError,
-					"Exception when creation record request in Operation", e);
-			throw new MsoDatabaseException(
-					"Data did inserted in Operatus Status Table", e);
-		} finally {
-			if (null != session) {
-				session.close();
-			}
-		}
-	}
-
-	private OperationStatus chkDuplicateServiceInOperStatus(String serviceId) {
-		OperationStatus dupServiceName = (RequestsDatabase.getInstance())
-				.getOperationStatusByServiceId(serviceId);
-
-		return dupServiceName;
-	}
-
-	private OperationStatus chkDuplicateServiceNameInOperStatus(
-			String serviceName) {
-		OperationStatus dupServiceName = (RequestsDatabase.getInstance())
-				.getOperationStatusByServiceName(serviceName);
-
-		return dupServiceName;
-	}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+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.hibernate.Session;
+import org.json.JSONObject;
+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.Messages;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.MsoRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.DelE2ESvcResp;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoDatabaseException;
+import org.openecomp.mso.requestsdb.OperationStatus;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/e2eServiceInstances")
+@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances")
+public class E2EServiceInstances {
+
+	private HashMap<String, String> instanceIdMap = new HashMap<>();
+	private static MsoLogger msoLogger = MsoLogger
+			.getMsoLogger(MsoLogger.Catalog.APIH);
+	private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+	public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+	private ServiceInstancesRequest sir = null;
+
+	public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+	public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
+	public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
+
+	/**
+	 * POST Requests for E2E Service create Instance on a version provided
+	 */
+
+	@POST
+	@Path("/{version:[vV][3-5]}")
+	@Consumes(MediaType.APPLICATION_JSON)
+	@Produces(MediaType.APPLICATION_JSON)
+	@ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class)
+	public Response createE2EServiceInstance(String request,
+			@PathParam("version") String version) {
+
+		return processE2EserviceInstances(request, Action.createInstance, null,
+				version);
+	}
+	
+	/**
+	 * PUT Requests for E2E Service update Instance on a version provided
+	 */
+
+	@PUT
+	@Path("/{version:[vV][3-5]}/{serviceId}")
+	@Consumes(MediaType.APPLICATION_JSON)
+	@Produces(MediaType.APPLICATION_JSON)
+	@ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId", response = Response.class)
+	public Response updateE2EServiceInstance(String request,
+			@PathParam("version") String version,
+			@PathParam("serviceId") String serviceId) {
+		
+		instanceIdMap.put("serviceId", serviceId);
+
+		return updateE2EserviceInstances(request, Action.updateInstance, instanceIdMap,
+				version);
+	}
+
+	/**
+	 * DELETE Requests for E2E Service delete Instance on a specified version
+	 * and serviceId
+	 */
+
+	@DELETE
+	@Path("/{version:[vV][3-5]}/{serviceId}")
+	@Consumes(MediaType.APPLICATION_JSON)
+	@Produces(MediaType.APPLICATION_JSON)
+	@ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
+	public Response deleteE2EServiceInstance(String request,
+			@PathParam("version") String version,
+			@PathParam("serviceId") String serviceId) {
+
+		instanceIdMap.put("serviceId", serviceId);
+
+		return deleteE2EserviceInstances(request, Action.deleteInstance,
+				instanceIdMap, version);
+	}
+
+	@GET
+	@Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
+	@ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
+	@Produces(MediaType.APPLICATION_JSON)
+	public Response getE2EServiceInstances(
+			@PathParam("serviceId") String serviceId,
+			@PathParam("version") String version,
+			@PathParam("operationId") String operationId) {
+		return getE2EServiceInstances(serviceId, operationId);
+	}
+
+	private Response getE2EServiceInstances(String serviceId, String operationId) {
+		RequestsDatabase requestsDB = RequestsDatabase.getInstance();
+
+		GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
+
+		MsoRequest msoRequest = new MsoRequest(serviceId);
+
+		long startTime = System.currentTimeMillis();
+
+		OperationStatus operationStatus = null;
+
+		try {
+			operationStatus = requestsDB.getOperationStatus(serviceId,
+					operationId);
+
+		} 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 (operationStatus == null) {
+			Response resp = msoRequest.buildServiceErrorResponse(
+					HttpStatus.SC_NO_CONTENT, MsoException.ServiceException,
+					"E2E serviceId " + serviceId + " 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 serviceId");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.DataNotFound,
+					"Null response from RequestDB when searching by serviceId");
+			msoLogger.debug("End of the transaction, the final response is: "
+					+ (String) resp.getEntity());
+			return resp;
+
+		}
+
+		e2eServiceResponse.setOperationStatus(operationStatus);
+
+		return Response.status(200).entity(e2eServiceResponse).build();
+	}
+
+	private Response deleteE2EserviceInstances(String requestJSON,
+			Action action, HashMap<String, String> instanceIdMap, String version) {
+		// TODO should be a new one or the same service instance Id
+		String requestId = instanceIdMap.get("serviceId");
+		long startTime = System.currentTimeMillis();
+		msoLogger.debug("requestId is: " + requestId);
+		E2EServiceInstanceDeleteRequest e2eDelReq = null;
+
+		MsoRequest msoRequest = new MsoRequest(requestId);
+
+		ObjectMapper mapper = new ObjectMapper();
+		try {
+			e2eDelReq = mapper.readValue(requestJSON,
+					E2EServiceInstanceDeleteRequest.class);
+
+		} catch (Exception e) {
+
+			msoLogger.debug("Mapping of request to JSON object failed : ", e);
+			Response response = msoRequest.buildServiceErrorResponse(
+					HttpStatus.SC_BAD_REQUEST,
+					MsoException.ServiceException,
+					"Mapping of request to JSON object failed.  "
+							+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
+					null);
+			msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+					MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.SchemaError,
+					"Mapping of request to JSON object failed");
+			msoLogger.debug("End of the transaction, the final response is: "
+					+ (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		}
+
+		CatalogDatabase db = null;
+		RecipeLookupResult recipeLookupResult = null;
+		try {
+			db = CatalogDatabase.getInstance();
+			//TODO  Get the service template model version uuid from AAI.
+			recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action);
+		} 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
+					+ (String) response.getEntity());
+			return response;
+		} finally {
+			closeCatalogDB(db);
+		}
+		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
+					+ (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		}
+
+		RequestClient requestClient = null;
+		HttpResponse response = null;
+
+		long subStartTime = System.currentTimeMillis();
+		// String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+		try {
+			requestClient = RequestClientFactory.getRequestClient(
+					recipeLookupResult.getOrchestrationURI(),
+					MsoPropertiesUtils.loadMsoProperties());
+
+			JSONObject jjo = new JSONObject(requestJSON);
+			jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+
+			String bpmnRequest = jjo.toString();
+
+			// Capture audit event
+			msoLogger
+					.debug("MSO API Handler Posting call to BPEL engine for url: "
+							+ requestClient.getUrl());
+			String serviceId = instanceIdMap.get("serviceId");
+			String serviceInstanceType = e2eDelReq.getServiceType();
+			response = requestClient.post(requestId, false,
+					recipeLookupResult.getRecipeTimeout(), action.name(),
+					serviceId, null, null, null, null, serviceInstanceType,
+					null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
+
+			msoLogger.recordMetricEvent(subStartTime,
+					MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+					"Successfully received response from BPMN engine", "BPMN",
+					recipeLookupResult.getOrchestrationURI(), null);
+		} catch (Exception e) {
+			msoLogger.recordMetricEvent(subStartTime,
+					MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.CommunicationError,
+					"Exception while communicate with BPMN engine", "BPMN",
+					recipeLookupResult.getOrchestrationURI(), null);
+			Response resp = msoRequest.buildServiceErrorResponse(
+					HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+					"Failed calling bpmn " + e.getMessage(),
+					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+			alarmLogger.sendAlarm("MsoConfigurationError",
+					MsoAlarmLogger.CRITICAL,
+					Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+					MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.AvailabilityError,
+					"Exception while communicate with BPMN engine");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.CommunicationError,
+					"Exception while communicate with BPMN engine");
+			msoLogger.debug("End of the transaction, the final response is: "
+					+ (String) resp.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return resp;
+		}
+
+		if (response == null) {
+			Response resp = msoRequest.buildServiceErrorResponse(
+					HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+					"bpelResponse is null",
+					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+					MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.BusinessProcesssError,
+					"Null response from BPEL");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.InternalError,
+					"Null response from BPMN");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return resp;
+		}
+
+		ResponseHandler respHandler = new ResponseHandler(response,
+				requestClient.getType());
+		int bpelStatus = respHandler.getStatus();
+
+		return beplStatusUpdate(requestId, startTime, msoRequest,
+				requestClient, respHandler, bpelStatus, action, instanceIdMap);
+	}
+
+	private Response updateE2EserviceInstances(String requestJSON, Action action,
+			HashMap<String, String> instanceIdMap, String version) {
+
+		String requestId = instanceIdMap.get("serviceId");
+		long startTime = System.currentTimeMillis();
+		msoLogger.debug("requestId is: " + requestId);
+		E2EServiceInstanceRequest e2eSir = null;
+
+		MsoRequest msoRequest = new MsoRequest(requestId);
+		ObjectMapper mapper = new ObjectMapper();
+		try {
+			e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
+
+		} catch (Exception e) {
+          
+          this.createOperationStatusRecordForError(action, requestId);
+		  
+			msoLogger.debug("Mapping of request to JSON object failed : ", e);
+			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+					MsoException.ServiceException, "Mapping of request to JSON object failed.  " + e.getMessage(),
+					ErrorNumbers.SVC_BAD_PARAMETER, null);
+			msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+					"Mapping of request to JSON object failed");
+			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+			return response;
+		}
+
+		mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+		sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+		try {
+			msoRequest.parse(sir, instanceIdMap, action, version);
+		} catch (Exception e) {
+			msoLogger.debug("Validation failed: ", e);
+			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+					MsoException.ServiceException, "Error parsing request.  " + e.getMessage(),
+					ErrorNumbers.SVC_BAD_PARAMETER, null);
+			if (msoRequest.getRequestId() != null) {
+				msoLogger.debug("Logging failed message to the database");
+				this.createOperationStatusRecordForError(action, requestId);
+			}
+			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;
+		}
+		
+		//check for the current operation status
+		Response resp = checkE2ESvcInstStatus(action, requestId, startTime, msoRequest);
+		if(resp != null && resp.getStatus() != 200) {
+			return resp;
+		}
+		
+		CatalogDatabase db = null;
+		RecipeLookupResult recipeLookupResult = null;
+		try {
+			db = CatalogDatabase.getInstance();
+			recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getTemplateId(), action);
+		} 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));
+			
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+					"Exception while communciate with DB");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		} finally {
+			closeCatalogDB(db);
+		}
+
+		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);
+		
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+					"No recipe found in DB");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		}
+
+		String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
+
+		String serviceId = "";
+		RequestClient requestClient = null;
+		HttpResponse response = null;
+
+		long subStartTime = System.currentTimeMillis();
+		String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+		try {
+			requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+					MsoPropertiesUtils.loadMsoProperties());
+
+			// Capture audit event
+			msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+
+			response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
+					serviceId, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, recipeLookupResult.getRecipeParamXsd());
+
+			msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+					"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
+					null);
+		} catch (Exception e) {
+			msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+					recipeLookupResult.getOrchestrationURI(), null);
+			Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+					MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+			alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
+					Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+					"Exception while communicate with BPMN engine");
+			msoLogger.debug("End of the transaction, the final response is: " + (String) getBPMNResp.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return getBPMNResp;
+		}
+
+		if (response == null) {
+			Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+					MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+					"Null response from BPMN");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity());
+			return getBPMNResp;
+		}
+
+		ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+		int bpelStatus = respHandler.getStatus();
+
+		return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
+	}
+
+	private Response checkE2ESvcInstStatus(Action action, String requestId, long startTime, MsoRequest msoRequest) {
+		OperationStatus curStatus = null;
+//		String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+		String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+		try {
+			if (!(requestId == null && "service".equals(requestScope) && (action == Action.updateInstance))) {			    
+				curStatus = chkSvcInstOperStatusbySvcId(requestId);
+			}
+		} catch (Exception e) {
+			msoLogger.error(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.DataError, "Error during current operation status 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 current operation status check");
+			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+			return response;
+		}
+
+		if (curStatus != null && !curStatus.getProgress().equals("100")) {
+			String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "
+					+ "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "
+					+ curStatus.getServiceName()
+					+ "). The existing request must finish or be cleaned up before proceeding.";
+
+			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
+					MsoException.ServiceException, chkMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+					chkMessage);
+
+			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+
+			createOperationStatusRecordForError(action, requestId);
+
+			return response;
+		}
+		
+		return Response.status(200).entity(null).build();
+	}
+	
+	private Response processE2EserviceInstances(String requestJSON, Action action,
+			HashMap<String, String> instanceIdMap, String version) {
+
+		String requestId = UUIDChecker.generateUUID(msoLogger);
+		long startTime = System.currentTimeMillis();
+		msoLogger.debug("requestId is: " + requestId);
+		E2EServiceInstanceRequest e2eSir = null;
+
+		MsoRequest msoRequest = new MsoRequest(requestId);
+		ObjectMapper mapper = new ObjectMapper();
+		try {
+			e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
+
+		} catch (Exception e) {
+          //TODO update the service name
+          this.createOperationStatusRecordForError(action, requestId);
+		  
+			msoLogger.debug("Mapping of request to JSON object failed : ", e);
+			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+					MsoException.ServiceException, "Mapping of request to JSON object failed.  " + e.getMessage(),
+					ErrorNumbers.SVC_BAD_PARAMETER, null);
+			msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+					"Mapping of request to JSON object failed");
+			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+			return response;
+		}
+
+		mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+		sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+		try {
+			msoRequest.parse(sir, instanceIdMap, action, version);
+		} catch (Exception e) {
+			msoLogger.debug("Validation failed: ", e);
+			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+					MsoException.ServiceException, "Error parsing request.  " + e.getMessage(),
+					ErrorNumbers.SVC_BAD_PARAMETER, null);
+			if (msoRequest.getRequestId() != null) {
+				msoLogger.debug("Logging failed message to the database");
+				//TODO update the service name
+		          this.createOperationStatusRecordForError(action, requestId);
+			}
+			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;
+		}
+		
+		OperationStatus dup = null;
+		String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+		String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+		try {
+			if (!(instanceName == null && "service".equals(requestScope)
+					&& (action == Action.createInstance || action == Action.activateInstance))) {
+			  //TODO : Need to check for the duplicate record from the operation status,
+			  //TODO : commenting this check for unblocking current testing for now...  induces dead code...
+				dup = chkDuplicateServiceNameInOperStatus( instanceName);
+			}
+		} 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.getProgress() + " (ServiceId - "
+					+ dup.getServiceId() + "). The existing request must finish or be cleaned up before proceeding.";
+
+			Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
+					MsoException.ServiceException, dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+
+			msoLogger.warn(MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError,
+					"Duplicate request - Subscriber already has a request for this service");
+			
+			
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+					dupMessage);
+			msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		}
+		
+		CatalogDatabase db = null;
+		RecipeLookupResult recipeLookupResult = null;
+		try {
+			db = CatalogDatabase.getInstance();
+			recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getTemplateId(), action);
+		} 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));
+			
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+					"Exception while communciate with DB");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		} finally {
+			closeCatalogDB(db);
+		}
+
+		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);
+		
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+					"No recipe found in DB");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return response;
+		}
+//		try {
+//			msoRequest.createRequestRecord(Status.PENDING, action);
+//			//createOperationStatusRecord(action, requestId);
+//		} 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;
+//		}
+
+		String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
+
+		String serviceId = "";
+		RequestClient requestClient = null;
+		HttpResponse response = null;
+
+		long subStartTime = System.currentTimeMillis();
+		String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+		try {
+			requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+					MsoPropertiesUtils.loadMsoProperties());
+
+			// Capture audit event
+			msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+
+			response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
+					serviceId, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, recipeLookupResult.getRecipeParamXsd());
+
+			msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+					"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
+					null);
+		} catch (Exception e) {
+			msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+					MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+					recipeLookupResult.getOrchestrationURI(), null);
+			Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+					MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+					ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+			alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
+					Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+					"Exception while communicate with BPMN engine");
+			msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+			createOperationStatusRecordForError(action, requestId);
+			return resp;
+		}
+
+		if (response == null) {
+			Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+					MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+			msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+					MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+			msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+					"Null response from BPMN");
+			msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
+			return resp;
+		}
+
+		ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+		int bpelStatus = respHandler.getStatus();
+
+		return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
+	}
+
+	private void closeCatalogDB(CatalogDatabase db) {
+		if (db != null) {
+			db.close();
+		}
+	}
+
+	private Response beplStatusUpdate(String requestId, long startTime,
+			MsoRequest msoRequest, RequestClient requestClient,
+			ResponseHandler respHandler, int bpelStatus, Action action,
+			HashMap<String, String> instanceIdMap) {
+		// BPMN accepted the request, the request is in progress
+		if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+			String camundaJSONResponseBody = respHandler.getResponseBody();
+			msoLogger
+					.debug("Received from Camunda: " + camundaJSONResponseBody);
+
+			// currently only for delete case we update the status here
+			if (action == Action.deleteInstance) {
+				ObjectMapper mapper = new ObjectMapper();
+				try {
+					DelE2ESvcResp jo = mapper.readValue(
+							camundaJSONResponseBody, DelE2ESvcResp.class);
+					String operationId = jo.getOperationId();
+    				this.createOperationStatusRecord("DELETE", requestId,
+								operationId);
+				} catch (Exception ex) {
+					msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+							requestClient.getUrl(), "", "",
+							MsoLogger.ErrorCode.BusinessProcesssError,
+							"Response from BPEL engine is failed with HTTP Status="
+									+ bpelStatus);
+				}
+			}
+			msoLogger.recordAuditEvent(startTime,
+					MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+					"BPMN accepted the request, the request is in progress");
+			msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
+			return Response.status(HttpStatus.SC_ACCEPTED)
+					.entity(camundaJSONResponseBody).build();
+		} else {
+			List<String> variables = new ArrayList<>();
+			variables.add(bpelStatus + "");
+			String camundaJSONResponseBody = respHandler.getResponseBody();
+			if (camundaJSONResponseBody != null
+					&& !camundaJSONResponseBody.isEmpty()) {
+				Response resp = msoRequest.buildServiceErrorResponse(
+						bpelStatus, MsoException.ServiceException,
+						"Request Failed due to BPEL error with HTTP Status= %1 "
+								+ '\n' + camundaJSONResponseBody,
+						ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
+				msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+						requestClient.getUrl(), "", "",
+						MsoLogger.ErrorCode.BusinessProcesssError,
+						"Response from BPEL engine is failed with HTTP Status="
+								+ bpelStatus);
+				msoLogger.recordAuditEvent(startTime,
+						MsoLogger.StatusCode.ERROR,
+						MsoLogger.ResponseCode.InternalError,
+						"Response from BPMN engine is failed");
+				msoLogger.debug(END_OF_THE_TRANSACTION
+						+ (String) resp.getEntity());
+				return resp;
+			} else {
+				Response resp = msoRequest
+						.buildServiceErrorResponse(
+								bpelStatus,
+								MsoException.ServiceException,
+								"Request Failed due to BPEL error with HTTP Status= %1",
+								ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+								variables);
+				msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+						requestClient.getUrl(), "", "",
+						MsoLogger.ErrorCode.BusinessProcesssError,
+						"Response from BPEL engine is empty");
+				msoLogger.recordAuditEvent(startTime,
+						MsoLogger.StatusCode.ERROR,
+						MsoLogger.ResponseCode.InternalError,
+						"Response from BPEL engine is empty");
+				msoLogger.debug(END_OF_THE_TRANSACTION
+						+ (String) resp.getEntity());
+				return resp;
+			}
+		}
+	}
+
+	/**
+	 * Getting recipes from catalogDb
+	 * 
+	 * @param db the catalog db
+	 * @param serviceModelUUID the service model version uuid
+	 * @param action the action for the service
+	 * @return the service recipe result
+	 */
+	private RecipeLookupResult getServiceInstanceOrchestrationURI(
+			CatalogDatabase db, String serviceModelUUID, Action action) {
+
+		RecipeLookupResult recipeLookupResult = getServiceURI(db, serviceModelUUID, action);
+
+		if (recipeLookupResult != null) {
+			msoLogger.debug("Orchestration URI is: "
+					+ recipeLookupResult.getOrchestrationURI()
+					+ ", recipe Timeout is: "
+					+ Integer.toString(recipeLookupResult.getRecipeTimeout()));
+		} else {
+			msoLogger.debug("No matching recipe record found");
+		}
+		return recipeLookupResult;
+	}
+
+	/**
+	 * Getting recipes from catalogDb
+	 * If Service recipe is not set, use default recipe, if set , use special recipe.
+	 * @param db the catalog db
+	 * @param serviceModelUUID the service version uuid
+	 * @param action the action of the service.
+	 * @return the service recipe result.
+	 */
+	private RecipeLookupResult getServiceURI(CatalogDatabase db, String serviceModelUUID, Action action) {
+
+		String defaultServiceModelName = "UUI_DEFAULT";
+
+		Service defaultServiceRecord = db
+				.getServiceByModelName(defaultServiceModelName);
+		ServiceRecipe defaultRecipe = db.getServiceRecipeByModelUUID(
+		        defaultServiceRecord.getModelUUID(), action.name());
+		//set recipe as default generic recipe
+		ServiceRecipe recipe = defaultRecipe;
+		//check the service special recipe 
+		if(null != serviceModelUUID && ! serviceModelUUID.isEmpty()){
+		      ServiceRecipe serviceSpecialRecipe = db.getServiceRecipeByModelUUID(
+		              serviceModelUUID, action.name());
+		      if(null != serviceSpecialRecipe){
+		          //set service special recipe.
+		          recipe = serviceSpecialRecipe;
+		      }
+		}	
+		
+		if (recipe == null) {
+			return null;
+		}
+		return new RecipeLookupResult(recipe.getOrchestrationUri(),
+				recipe.getRecipeTimeout(), recipe.getServiceParamXSD());
+
+	}
+
+	/**
+	 * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and
+	 * passing it to camunda engine.
+	 * 
+	 * @param e2eSir
+	 * @return
+	 */
+	private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir,
+			String requestJSON) {
+
+		sir = new ServiceInstancesRequest();
+
+		String returnString = null;
+		RequestDetails requestDetails = new RequestDetails();
+		ModelInfo modelInfo = new ModelInfo();
+
+		// ModelInvariantId
+		modelInfo.setModelInvariantId(e2eSir.getService().getServiceDefId());
+
+		// modelNameVersionId
+		modelInfo.setModelNameVersionId(e2eSir.getService().getTemplateId());
+
+		// String modelInfoValue =
+		// e2eSir.getService().getParameters().getNodeTemplateName();
+		// String[] arrayOfInfo = modelInfoValue.split(":");
+		// String modelName = arrayOfInfo[0];
+		// String modelVersion = arrayOfInfo[1];
+
+		// TODO: To ensure, if we dont get the values from the UUI
+		String modelName = "voLTE";
+		String modelVersion = "1.0";
+		// modelName
+		modelInfo.setModelName(modelName);
+
+		// modelVersion
+		modelInfo.setModelVersion(modelVersion);
+
+		// modelType
+		modelInfo.setModelType(ModelType.service);
+
+		// setting modelInfo to requestDetails
+		requestDetails.setModelInfo(modelInfo);
+
+		SubscriberInfo subscriberInfo = new SubscriberInfo();
+
+		// globalsubscriberId
+		subscriberInfo.setGlobalSubscriberId(e2eSir.getService()
+				.getParameters().getGlobalSubscriberId());
+
+		// subscriberName
+		subscriberInfo.setSubscriberName(e2eSir.getService().getParameters()
+				.getSubscriberName());
+
+		// setting subscriberInfo to requestDetails
+		requestDetails.setSubscriberInfo(subscriberInfo);
+
+		RequestInfo requestInfo = new RequestInfo();
+
+		// instanceName
+		requestInfo.setInstanceName(e2eSir.getService().getName());
+
+		// source
+		requestInfo.setSource("UUI");
+
+		// suppressRollback
+		requestInfo.setSuppressRollback(true);
+
+		// setting requestInfo to requestDetails
+		requestDetails.setRequestInfo(requestInfo);
+
+		RequestParameters requestParameters = new RequestParameters();
+
+		// subscriptionServiceType
+		requestParameters.setSubscriptionServiceType("MOG");
+
+		// Userparams
+		List<E2EUserParam> userParams;
+		// userParams =
+		// e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+		List<Map<String, String>> userParamList = new ArrayList<>();
+		Map<String, String> userParamMap = new HashMap<>();
+		// complete json request updated in the camunda
+		userParamMap.put("UUIRequest", requestJSON);
+		userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
+
+		// Map<String, String> userParamMap3 = null;
+		// for (E2EUserParam userp : userParams) {
+		// userParamMap.put(userp.getName(), userp.getValue());
+		//
+		// }
+		userParamList.add(userParamMap);
+		requestParameters.setUserParams(userParamList);
+
+		// setting requestParameters to requestDetails
+		requestDetails.setRequestParameters(requestParameters);
+
+		sir.setRequestDetails(requestDetails);
+
+		// converting to string
+		ObjectMapper mapper = new ObjectMapper();
+		try {
+			returnString = mapper.writeValueAsString(sir);
+		} catch (IOException e) {
+			msoLogger
+					.debug("Exception while converting ServiceInstancesRequest object to string",
+							e);
+		}
+
+		return returnString;
+	}
+
+	private void createOperationStatusRecordForError(Action action,
+			String requestId) throws MsoDatabaseException {
+
+		AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+		Session session = null;
+		try {
+
+			session = requestsDbSessionFactoryManager.getSessionFactory()
+					.openSession();
+			session.beginTransaction();
+
+			OperationStatus os = new OperationStatus();
+			os.setOperation(action.name());
+			os.setOperationContent("");
+			os.setOperationId("");
+			os.setProgress("100");
+			os.setReason("");
+			os.setResult("error");
+			os.setServiceId(requestId);
+			os.setUserId("");
+			Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+			Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+			os.setFinishedAt(endTimeStamp);
+			os.setOperateAt(startTimeStamp);
+
+			session.save(os);
+			session.getTransaction().commit();
+
+		} catch (Exception e) {
+			msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
+					MsoLogger.ErrorCode.DataError,
+					"Exception when creation record request in Operation", e);
+			throw new MsoDatabaseException(
+					"Data did inserted in Operatus Status Table for failure", e);
+		} finally {
+			if (null != session) {
+				session.close();
+			}
+		}
+	}
+
+	private void createOperationStatusRecord(String actionNm, String serviceId,
+			String operationId) throws MsoDatabaseException {
+
+		AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+		Session session = null;
+		try {
+
+			session = requestsDbSessionFactoryManager.getSessionFactory()
+					.openSession();
+			session.beginTransaction();
+
+			OperationStatus os = new OperationStatus();
+			os.setOperation(actionNm);
+			os.setOperationContent("");
+			os.setOperationId(operationId);
+			os.setProgress("0");
+			os.setReason("");
+			os.setResult("processing");
+			os.setServiceId(serviceId);
+			// TODO : to be updated...
+			os.setUserId("");
+			Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+			Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+			os.setFinishedAt(endTimeStamp);
+			os.setOperateAt(startTimeStamp);
+
+			session.save(os);
+			session.getTransaction().commit();
+
+		} catch (Exception e) {
+			msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
+					MsoLogger.ErrorCode.DataError,
+					"Exception when creation record request in Operation", e);
+			throw new MsoDatabaseException(
+					"Data did inserted in Operatus Status Table", e);
+		} finally {
+			if (null != session) {
+				session.close();
+			}
+		}
+	}
+
+	private OperationStatus chkSvcInstOperStatusbySvcId(String serviceId) {
+		OperationStatus svcInstanceOperStatus = (RequestsDatabase.getInstance())
+				.getOperationStatusByServiceId(serviceId);
+
+		return svcInstanceOperStatus;
+	}
+
+	private OperationStatus chkDuplicateServiceNameInOperStatus(
+			String serviceName) {
+		OperationStatus dupServiceName = (RequestsDatabase.getInstance())
+				.getOperationStatusByServiceName(serviceName);
+
+		return dupServiceName;
+	}
 }
\ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 7f2f78d..d6b0b6b 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -699,7 +699,7 @@
      * update the resource operation
      * <br>
      * 
-     * @param operstatus the resource operation object
+     * @param operStatus the resource operation object
      * @since ONAP Amsterdam Release
      */
     public void updateResOperStatus(ResourceOperationStatus operStatus) {
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
index 46d0473..c556dda 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
@@ -36,6 +36,7 @@
 import org.openecomp.mso.db.AbstractSessionFactoryManager;
 import org.openecomp.mso.db.catalog.beans.AllottedResource;
 import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.ArRecipe;
 import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
 import org.openecomp.mso.db.catalog.beans.HeatFiles;
 import org.openecomp.mso.db.catalog.beans.HeatNestedTemplate;
@@ -87,6 +88,7 @@
     private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
     private static final String MODEL_ID = "modelId";
     private static final String MODEL_NAME = "modelName";
+    private static final String MODEL_VERSION = "version";
     private static final String TYPE = "type";
     private static final String MODEL_TYPE = "modelType";
     private static final String MODEL_VERSION_ID = "modelVersionId";
@@ -1129,6 +1131,8 @@
         return resultList.get(0);
     }
 
+    
+    
     /**
      * Return a VNF recipe that matches a given VNF_TYPE and ACTION
      *
@@ -1161,6 +1165,63 @@
         LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
         return resultList.get(0);
     }
+    
+    /**
+     * Return a VNF recipe that matches a given ModelName and Modelversion and ACTION
+     *
+     * @param modelName
+     * @param modelVersion
+     * @param action
+     * @return VnfRecipe object or null if none found
+     */
+    public VnfRecipe getVnfRecipeByNameVersion(String modelName, String modelVersion, String action) {
+        StringBuilder hql = new StringBuilder("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action ");
+
+        long startTime = System.currentTimeMillis();
+        LOGGER.debug("Catalog database - get VNF recipe with name " + modelName
+                                      + " and action "
+                                      + action);
+
+        Query query = getSession().createQuery(hql.toString());
+        query.setParameter(VNF_TYPE, modelName);
+        query.setParameter(MODEL_VERSION, modelVersion);
+        query.setParameter(ACTION, action);
+
+        @SuppressWarnings("unchecked")
+        List <VnfRecipe> resultList = query.list();
+
+        if (resultList.isEmpty()) {
+            LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null);
+            return null;
+        }
+
+        Collections.sort(resultList, new MavenLikeVersioningComparator());
+        Collections.reverse(resultList);
+
+        LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
+        return resultList.get(0);
+    }
+    
+    /**
+     * Return a Network recipe that matches a given MODEL_UUID and ACTION
+     *
+     * @param modelName
+     * @param action
+     * @return NetworkRecipe object or null if none found
+     */
+    public VnfRecipe getVnfRecipeByModuleUuid (String vnfModelUuid, String action) {
+        LOGGER.debug ("Catalog database - get vnf recipe with vnf resource model uuid " + vnfModelUuid
+                + " and action "
+                + action
+                );
+        VnfResource vnfResource = getVnfResourceByModelUuid(vnfModelUuid);
+        if(null == vnfResource){
+            return null;
+        }
+        
+        VnfRecipe recipe = this.getVnfRecipeByNameVersion(vnfResource.getModelName(), vnfResource.getModelVersion(), action);
+        return recipe;        
+    }
 
     /**
      * Return a VNF recipe that matches a given VF_MODULE_ID and ACTION
@@ -1577,7 +1638,7 @@
      * Return the VnfResourceCustomization object identified by the given modelCustomizationUuid 1707
      * Note that the corresponding VnfResource Object will be put in the VnfResourceCustomization bean
      *
-     * @param getVnfResourceCustomizationByModelVersionId
+     * @param modelVersionId
      * @return VnfResourceCustomization or null if not found
      */
     public VnfResourceCustomization getVnfResourceCustomizationByModelVersionId(String modelVersionId) {
@@ -1859,7 +1920,7 @@
      * Return the VnfResourceCustomization object identified by the given modelCustomizationUuid 1707
      * Note that the corresponding VnfResource Object will be put in the VnfResourceCustomization bean
      *
-     * @param modelCustomizationUuid
+     * @param modelUuid
      * @return VnfResourceCustomization or null if not found
      */
     public VnfResource getVnfResourceByModelUuid(String modelUuid) {
@@ -2767,7 +2828,7 @@
      * Return a VNF Module List that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME,
      * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION
      *
-     * @param vnfModuleType
+     * @param vfModuleType
      * @parm modelCustomizationUuid
      * @param asdcServiceModelVersion
      * @param modelVersion
@@ -3305,7 +3366,9 @@
     /**
      * Return a ServiceToResourceCustomization object 
      * 
-     * @param vfModuleModelUuid, heatFilesArtifactUuid
+     * @param serviceModelUuid
+     * @param resourceModelCustomizationUuid
+     * @param modelType
      * @return VfModuleToHeatFiles or null if none found
      */ 
     public ServiceToResourceCustomization getServiceToResourceCustomization(String serviceModelUuid, String resourceModelCustomizationUuid, String modelType) {
@@ -3331,7 +3394,7 @@
     /**
      * Return a Map<String, HeatFiles> for returning the heat files associated with a vfModule 1707
      * 
-     * @param parentHeatTemplateId
+     * @param vfModuleModelUuid
      * @return Map<String,Object> or null if none found
      */ 
     public Map <String, HeatFiles> getHeatFilesForVfModule(String vfModuleModelUuid) {
@@ -3547,7 +3610,7 @@
     /**
      * Retrieves a Heat environment from DB based on its unique key. 1707
      *
-     * @param name the environment artifact name
+     * @param artifactUuid the environment artifact name
      * @param version the environment resource version
      * @return the heat environment from DB or null if not found
      */
@@ -3780,7 +3843,7 @@
     /**
      * Return the newest version of a specific Tosca CSAR Record resource (queried by Name).
      *
-     * @param ToscaCsar
+     * @param artifactChecksum
      * @return ToscaCsar object or null if none found
      */
     public ToscaCsar getToscaCsar (String artifactChecksum) {
@@ -4343,9 +4406,7 @@
     /**
      * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID
      *
-     * @param networkType
-     * @param action
-     * @param serviceType
+     * @param modelUUID
      * @return NetworkRecipe object or null if none found
      */
     public NetworkResource getNetworkResourceByModelUuid(String modelUUID) {
@@ -4425,6 +4486,26 @@
         }
     }
 
+    /**
+     * Return a Network recipe that matches a given MODEL_UUID and ACTION
+     *
+     * @param modelName
+     * @param action
+     * @return NetworkRecipe object or null if none found
+     */
+    public NetworkRecipe getNetworkRecipeByModuleUuid (String networkModelUuid, String action) {
+        LOGGER.debug ("Catalog database - get network recipe with network model uuid " + networkModelUuid
+                + " and action "
+                + action
+                );
+        NetworkResource networkResource = getNetworkResourceByModelUuid(networkModelUuid);
+        if(null == networkResource){
+            return null;
+        }
+        
+        NetworkRecipe recipe = getNetworkRecipeByNameVersion(networkResource.getModelName(), networkResource.getModelVersion(), action);
+        return recipe;        
+    }
     
     /**
      * Return a Network recipe that matches a given MODEL_NAME and ACTION
@@ -4465,11 +4546,49 @@
     }
 
     /**
+     * get network recipe by module name and version and action.
+     * <br>
+     * 
+     * @param modelName
+     * @param modelVersion
+     * @param action
+     * @return
+     * @since ONAP Beijing Release
+     */
+    public NetworkRecipe getNetworkRecipeByNameVersion(String modelName, String modelVersion, String action) {
+
+        long startTime = System.currentTimeMillis ();
+        LOGGER.debug ("Catalog database - get network recipe with network model name " + modelName
+                                      +"model version " + modelVersion + " and action " + action);
+
+        try {
+            String hql = "FROM NetworkRecipe WHERE modelName = :modelName AND version=:version AND action = :action";
+
+            Query query = getSession ().createQuery (hql);
+            query.setParameter (MODEL_NAME, modelName);
+            query.setParameter (MODEL_VERSION, modelVersion);
+            query.setParameter (ACTION, action);
+
+            @SuppressWarnings("unchecked")
+            List <NetworkRecipe> resultList = query.list ();
+
+            if (resultList.isEmpty ()) {
+                return null;
+            }
+
+            Collections.sort (resultList, new MavenLikeVersioningComparator ());
+            Collections.reverse (resultList);
+
+            return resultList.get (0);
+        } finally {
+            LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkRecipe", null);
+        }
+    }
+    
+    /**
      * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID
      *
-     * @param networkType
-     * @param action
-     * @param serviceType
+     * @param modelCustomizationUuid
      * @return NetworkRecipe object or null if none found
      */
     public NetworkResource getNetworkResourceByModelCustUuid(String modelCustomizationUuid) {
@@ -4558,7 +4677,7 @@
     /**
      * Return a VnfComponents recipe that matches a given VF_MODULE_ID, VNF_COMPONENT_TYPE, ACTION
      *
-     * @param vfModuleId
+     * @param vfModuleModelUUId
      * @param vnfComponentType
      * @param action
      * @return VnfComponentsRecipe object or null if none found
@@ -4680,7 +4799,7 @@
     /**
      * Return a VfModule record that matches a given MODEL_NAME
      *
-     * @param modelName
+     * @param modelUUID
      * @return VfModule object or null if none found
      */
     public VfModule getVfModuleByModelUUID (String modelUUID) {
@@ -5009,4 +5128,67 @@
         }
         return theObjects;
     }
+    
+    
+    /**
+     * get allotted resource recipe by module name and version and action.
+     * <br>
+     * 
+     * @param modelName
+     * @param modelVersion
+     * @param action
+     * @return
+     * @since ONAP Beijing Release
+     */
+    public ArRecipe getArRecipeByNameVersion(String modelName, String modelVersion, String action) {
+
+        long startTime = System.currentTimeMillis ();
+        LOGGER.debug ("Catalog database - get ar recipe with ar model name " + modelName
+                                      +"model version " + modelVersion + " and action " + action);
+
+        try {
+            String hql = "FROM ArRecipe WHERE modelName = :modelName AND version=:version AND action = :action";
+
+            Query query = getSession ().createQuery (hql);
+            query.setParameter (MODEL_NAME, modelName);
+            query.setParameter (MODEL_VERSION, modelVersion);
+            query.setParameter (ACTION, action);
+
+            @SuppressWarnings("unchecked")
+            List <ArRecipe> resultList = query.list ();
+
+            if (resultList.isEmpty ()) {
+                return null;
+            }
+
+            Collections.sort (resultList, new MavenLikeVersioningComparator ());
+            Collections.reverse (resultList);
+
+            return resultList.get (0);
+        } finally {
+            LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkRecipe", null);
+        }
+    }
+    
+    /**
+     * Return a allotted resource recipe that matches a given MODEL_UUID and ACTION
+     *
+     * @param modelName
+     * @param action
+     * @return ArRecipe object or null if none found
+     */
+    public ArRecipe getArRecipeByModuleUuid (String ArModelUuid, String action) {
+        LOGGER.debug ("Catalog database - get ar recipe with ar model uuid " + ArModelUuid
+                + " and action "
+                + action
+                );
+        AllottedResource arResource = this.getAllottedResourceByModelUuid(ArModelUuid);
+        if(null == arResource){
+            return null;
+        }
+        
+        ArRecipe recipe = getArRecipeByNameVersion(arResource.getModelName(), arResource.getModelVersion(), action);
+        return recipe;        
+    }
+    
 }
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java
index 7f8c3db..7ef5a4a 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java
@@ -89,7 +89,7 @@
 	}
 
 	/**
-	 * @param versionStr the versionStr to set
+	 * @param schemaVersion the versionStr to set
 	 */
 	public void setSchemaVersion(String schemaVersion) {
 		this.schemaVersion = schemaVersion;
diff --git a/pom.xml b/pom.xml
index a1f9ca7..33c4abc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
     <module>status-control</module>
     <module>bpmn</module>
     <module>packages</module>
-    <module>aria</module>
+    <!--module>aria</module-->
   </modules>
   <properties>
     <project.mso.base.folder>.</project.mso.base.folder>
