Merge "Add correlationId to ServiceInstancesRequest"
authorSeshu Kumar M <seshu.kumar.m@huawei.com>
Tue, 22 May 2018 10:00:15 +0000 (10:00 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 22 May 2018 10:00:15 +0000 (10:00 +0000)
1  2 
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java

@@@ -43,6 -43,7 +43,7 @@@ 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.RequestClientParamater;
  import org.openecomp.mso.apihandler.common.ResponseHandler;
  import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest;
  import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
@@@ -82,8 -83,6 +83,6 @@@ public class E2EServiceInstances 
        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
                
                // Define RecipeLookupResult info here instead of query DB for efficiency
                String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance";
-               int recipeTimeout = 180;
  
                RequestClient requestClient = null;
                HttpResponse response = null;
                        requestClient = RequestClientFactory.getRequestClient(workflowUrl, MsoPropertiesUtils.loadMsoProperties());
  
                        JSONObject jjo = new JSONObject(requestJSON);
-                       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 serviceType = e2eCompareModelReq.getServiceType();
-                       response = requestClient.post(requestId, false, recipeTimeout, action.name(), serviceId, null, null, null,
-                                       null, null, serviceType, null, null, null, bpmnRequest, null);
+                       RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
+                                       setBaseVfModule(false).setRecipeTimeout(180).setRequestAction(action.name()).
+                                       setServiceInstanceId(instanceIdMap.get("serviceId")).setServiceType(e2eCompareModelReq.getServiceType()).
+                                       setRequestDetails(jjo.toString()).build();
+                       response = requestClient.post(requestClientParamater);
  
                        msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                                        "Successfully received response from BPMN engine", "BPMN", workflowUrl, null);
                HttpResponse response = null;
  
                long subStartTime = System.currentTimeMillis();
-               // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
                try {
                        requestClient = RequestClientFactory.getRequestClient(
                                        recipeLookupResult.getOrchestrationURI(),
  
                        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, null, serviceInstanceType,
-                                       null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
+                       RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
+                                       setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).
+                                       setRequestAction(action.name()).setServiceType(e2eDelReq.getServiceType()).
+                                       setRequestDetails(jjo.toString()).setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+                       response = requestClient.post(requestClientParamater);
  
                        msoLogger.recordMetricEvent(subStartTime,
                                        MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                        return response;
                }
                
-               //check for the current operation status
- //            Response resp = checkE2ESvcInstStatus(action, serviceId, startTime, msoRequest);
- //            if(resp != null && resp.getStatus() != 200) {
- //                    return resp;
- //            }
-               
                CatalogDatabase db = null;
                RecipeLookupResult recipeLookupResult = null;
                try {
                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());
+                       RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
+                                       setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()).
+                                       setServiceInstanceId(serviceId).setServiceType(serviceInstanceType).
+                                       setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)).
+                                       setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
  
-                       response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
-                                       serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson,
-                                       recipeLookupResult.getRecipeParamXsd());
+                       response = requestClient.post(requestClientParamater);
  
                        msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                                        "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
                        return response;
                }
  
-               String serviceInstanceType = e2eSir.getService().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());
+                       RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
+                                       setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()).
+                                       setServiceInstanceId("").setServiceType(e2eSir.getService().getServiceType()).
+                                       setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)).
+                                       setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
  
-                       response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
-                                       serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson,
-                                       recipeLookupResult.getRecipeParamXsd());
+                       response = requestClient.post(requestClientParamater);
  
                        msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                                        "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
          HttpResponse response = null;
  
          long subStartTime = System.currentTimeMillis();
-         // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
          try {
              requestClient = RequestClientFactory.getRequestClient(
                      recipeLookupResult.getOrchestrationURI(),
              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 = e2eScaleReq.getService().getServiceType();
-             response = requestClient.post(requestId, false,
-                                       recipeLookupResult.getRecipeTimeout(), action.name(),
-                                       serviceId, null, null, null, null, null, serviceInstanceType,
-                                       null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
+                       RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId).
+                                       setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()).
+                                       setServiceInstanceId(instanceIdMap.get("serviceId")).
+                                       setServiceType(e2eScaleReq.getService().getServiceType()).
+                                       setRequestDetails(jjo.toString()).
+                                       setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+             response = requestClient.post(requestClientParamater);
  
              msoLogger.recordMetricEvent(subStartTime,
                      MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                        HashMap<String, String> instanceIdMap) {
                // BPMN accepted the request, the request is in progress
                if (bpelStatus == HttpStatus.SC_ACCEPTED) {
 -                      String camundaJSONResponseBody = respHandler.getResponseBody();
 +                      String camundaJSONResponseBody = respHandler.getContent();
                        msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody);
                        msoLogger.recordAuditEvent(startTime,
                                        MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                } else {
                        List<String> variables = new ArrayList<>();
                        variables.add(bpelStatus + "");
 -                      String camundaJSONResponseBody = respHandler.getResponseBody();
 +                      String camundaJSONResponseBody = respHandler.getContent();
                        if (camundaJSONResponseBody != null
                                        && !camundaJSONResponseBody.isEmpty()) {
                                Response resp = msoRequest.buildServiceErrorResponse(
@@@ -20,6 -20,7 +20,7 @@@
   */
  package org.openecomp.mso.apihandlerinfra;
  
+ import java.io.IOException;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
@@@ -42,6 -43,7 +43,7 @@@ import org.openecomp.mso.apihandler.com
  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.RequestClientParamater;
  import org.openecomp.mso.apihandler.common.ResponseHandler;
  import org.openecomp.mso.apihandler.common.ValidationException;
  import org.openecomp.mso.serviceinstancebeans.ModelInfo;
@@@ -690,37 -692,7 +692,7 @@@ public class ServiceInstances 
                }
  
                db.close();
-               String serviceInstanceId = "";
-               String vnfId = "";
-               String vfModuleId = "";
-               String volumeGroupId = "";
-               String networkId = "";
-               ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
-               if(siReq.getServiceInstanceId () != null){
-                       serviceInstanceId = siReq.getServiceInstanceId ();
-               }
-               if(siReq.getVnfInstanceId () != null){
-                       vnfId = siReq.getVnfInstanceId ();
-               }
-               if(siReq.getVfModuleInstanceId () != null){
-                       vfModuleId = siReq.getVfModuleInstanceId ();
-               }
-               if(siReq.getVolumeGroupInstanceId () != null){
-                       volumeGroupId = siReq.getVolumeGroupInstanceId ();
-               }
-               if(siReq.getNetworkInstanceId () != null){
-                       networkId = siReq.getNetworkInstanceId ();
-               }
-               requestId = msoRequest.getRequestId ();
-               msoLogger.debug ("requestId is: " + requestId);
+               msoLogger.debug ("requestId is: " + msoRequest.getRequestId());
                msoLogger.debug ("About to insert a record");
  
                try {
                        return response;
                }
                
-               return postBPELRequest(action, requestId, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), recipeLookupResult.getRecipeTimeout(), 
-                                                               isBaseVfModule, serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, null,
-                                                               msoRequest.getServiceInstanceType(), msoRequest.getVnfType(), msoRequest.getVfModuleType(), msoRequest.getNetworkType());
+               return postBPELRequest(action, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(),
+                               recipeLookupResult.getRecipeTimeout(), isBaseVfModule);
        }
  
-       private Response postBPELRequest(Action action, String requestId, long startTime, MsoRequest msoRequest,
-                                                                       String orchestrationUri, int timeOut, Boolean isBaseVfModule,
-                                                                       String serviceInstanceId, String vnfId, String vfModuleId, String volumeGroupId, String networkId,
-                                                                       String configurationId, String serviceInstanceType, String vnfType, String vfModuleType, String networkType) {
+       private RequestClientParamater buildRequestClientParameter(MsoRequest msoRequest, boolean isBaseVfModule,
+                       int timeOut, String requestAction) throws IOException {
+               return new RequestClientParamater.Builder().
+                               setRequestId(msoRequest.getRequestId()).
+                               setBaseVfModule(isBaseVfModule).setRecipeTimeout(timeOut).
+                               setRequestAction(requestAction).
+                               setServiceInstanceId(msoRequest.getServiceInstancesRequest().getServiceInstanceId()).
+                               setCorrelationId(msoRequest.getServiceInstancesRequest().getCorrelationId()).
+                               setVnfId(msoRequest.getServiceInstancesRequest().getVnfInstanceId()).
+                               setVfModuleId(msoRequest.getServiceInstancesRequest().getVfModuleInstanceId()).
+                               setVolumeGroupId(msoRequest.getServiceInstancesRequest().getVolumeGroupInstanceId()).
+                               setNetworkId(msoRequest.getServiceInstancesRequest().getNetworkInstanceId()).
+                               setConfigurationId(msoRequest.getServiceInstancesRequest().getConfigurationId()).
+                               setServiceType(msoRequest.getServiceInstanceType()).
+                               setVnfType(msoRequest.getVnfType()).
+                               setVfModuleType(msoRequest.getVfModuleType()).
+                               setNetworkType(msoRequest.getNetworkType()).
+                               setRequestDetails(msoRequest.getRequestJSON()).build();
+       }
+       private Response postBPELRequest(Action action, long startTime, MsoRequest msoRequest,
+                       String orchestrationUri, int timeOut, Boolean isBaseVfModule) {
                RequestClient requestClient = null;
                HttpResponse response = null;
                long subStartTime = System.currentTimeMillis();
  
                        System.out.println("URL : " + requestClient.getUrl ());
  
-                       response = requestClient.post(requestId, isBaseVfModule, timeOut, action.name (),
-                                       serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
-                                       msoRequest.getServiceInstanceType (),
-                                       msoRequest.getVnfType (), msoRequest.getVfModuleType (),
-                                       msoRequest.getNetworkType (), msoRequest.getRequestJSON(), null);
+                       response = requestClient.post(buildRequestClientParameter(msoRequest, isBaseVfModule, timeOut, action.name()));
                        msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationUri, null);
                } catch (Exception e) {
                        msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationUri, null);
  
                // BPEL accepted the request, the request is in progress
                if (bpelStatus == HttpStatus.SC_ACCEPTED) {
 -                      String camundaJSONResponseBody = respHandler.getResponseBody ();
 +                      String camundaJSONResponseBody = respHandler.getContent();
                        msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody);
                        msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
                        (RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (),
                } else {
                        List<String> variables = new ArrayList<>();
                        variables.add(bpelStatus + "");
 -                      String camundaJSONResponseBody = respHandler.getResponseBody ();
 +                      String camundaJSONResponseBody = respHandler.getContent();
                        if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
                                msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
                                Response resp =  msoRequest.buildServiceErrorResponse(bpelStatus,
                RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters();
                if(reqParam!=null && reqParam.isaLaCarte()!=null && reqParam.isaLaCarte() && recipe==null){
                        return null;
 +              } else if (recipe==null) {
 +                      //aLaCarte wasn't sent, so we'll try the default
 +                      serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName);
 +                      if (serviceRecord == null) {
 +                              serviceRecord = db.getServiceByModelName(defaultServiceModelName);
 +                      }
 +                      recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
                }
  
 -              //aLaCarte wasn't sent, so we'll try the default
 -              serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName);
 -              if (serviceRecord == null) {
 -                      serviceRecord = db.getServiceByModelName(defaultServiceModelName);
 -              }
 -
 -              recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
                if(modelInfo.getModelVersionId() == null) {
                        modelInfo.setModelVersionId(serviceRecord.getModelUUID());
                }
                return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());          
        }
  
        private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
  
                String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
                        return response;
                        
                }
-               
-               String serviceInstanceId = "";
-               String configurationId = "";
-               ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
-               if(siReq.getServiceInstanceId () != null){
-                       serviceInstanceId = siReq.getServiceInstanceId ();
-               }
-               if(siReq.getConfigurationId() != null){
-                       configurationId = siReq.getConfigurationId();
-               }
  
                requestId = msoRequest.getRequestId ();
                msoLogger.debug ("requestId is: " + requestId);
                        return response;
                }
  
-               return postBPELRequest(action, requestId, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false, 
-                                                               serviceInstanceId, null, null, null, null, configurationId, null, null, null, null);
+               return postBPELRequest(action, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false);
        }
  }
@@@ -40,12 -40,12 +40,12 @@@ import org.junit.Test
  import org.openecomp.mso.apihandler.common.CamundaClient;
  import org.openecomp.mso.apihandler.common.RequestClient;
  import org.openecomp.mso.apihandler.common.RequestClientFactory;
+ import org.openecomp.mso.apihandler.common.RequestClientParamater;
  import org.openecomp.mso.apihandler.common.ValidationException;
  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.properties.MsoDatabaseException;
  import org.openecomp.mso.properties.MsoJavaProperties;
  import org.openecomp.mso.properties.MsoPropertiesFactory;
  import org.openecomp.mso.requestsdb.OperationStatus;
@@@ -194,17 -194,12 +194,12 @@@ public class E2EServiceInstancesTest 
  
                new MockUp<CamundaClient>() {
                        @Mock
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                       int recipeTimeout, String requestAction,
-                                       String serviceInstanceId, String vnfId, String vfModuleId,
-                                       String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                       String vnfType, String vfModuleType, String networkType,
-                                       String requestDetails, String recipeParamXsd) {
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {
                                ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                                HttpResponse resp = new BasicHttpResponse(pv, 202,
                                                "test response");
                                BasicHttpEntity entity = new BasicHttpEntity();
 -                              String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                              String body = "{\"content\":\"success\",\"message\":\"success\"}";
                                InputStream instream = new ByteArrayInputStream(body.getBytes());
                                entity.setContent(instream);
                                resp.setEntity(entity);
  
                new MockUp<CamundaClient>() {
                        @Mock
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                       int recipeTimeout, String requestAction,
-                                       String serviceInstanceId, String vnfId, String vfModuleId,
-                                       String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                       String vnfType, String vfModuleType, String networkType,
-                                       String requestDetails, String recipeParamXsd) {
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {
                                ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                                HttpResponse resp = new BasicHttpResponse(pv, 500,
                                                "test response");
                                BasicHttpEntity entity = new BasicHttpEntity();
 -                              String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                              String body = "{\"content\":\"success\",\"message\":\"success\"}";
                                InputStream instream = new ByteArrayInputStream(body.getBytes());
                                entity.setContent(instream);
                                resp.setEntity(entity);
  
                new MockUp<CamundaClient>() {
                        @Mock
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                       int recipeTimeout, String requestAction,
-                                       String serviceInstanceId, String vnfId, String vfModuleId,
-                                       String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                       String vnfType, String vfModuleType, String networkType,
-                                       String requestDetails, String recipeParamXsd) {
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {
                                ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                                HttpResponse resp = new BasicHttpResponse(pv, 500,
                                                "test response");
                                BasicHttpEntity entity = new BasicHttpEntity();
 -                              String body = "{\"response\":\"\",\"message\":\"success\"}";
 +                              String body = "{\"content\":\"\",\"message\":\"success\"}";
                                InputStream instream = new ByteArrayInputStream(body.getBytes());
                                entity.setContent(instream);
                                resp.setEntity(entity);
  
                new MockUp<CamundaClient>() {
                        @Mock
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                       int recipeTimeout, String requestAction,
-                                       String serviceInstanceId, String vnfId, String vfModuleId,
-                                       String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                       String vnfType, String vfModuleType, String networkType,
-                                       String requestDetails, String recipeParamXsd) {
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {
                                HttpResponse resp = null;
                                return resp;
                        }
  
          final MockUp<CamundaClient> mockCmaundaClient = new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction, String serviceInstanceId,
-                                      String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
-                                      String serviceType, String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd)
-                     throws ClientProtocolException, IOException {
+             public HttpResponse post(RequestClientParamater requestClientParamater) {
                  ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                  HttpResponse resp = new BasicHttpResponse(pv, 200, "test response");
                  BasicHttpEntity entity = new BasicHttpEntity();
 -                String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                String body = "{\"content\":\"success\",\"message\":\"success\"}";
                  InputStream instream = new ByteArrayInputStream(body.getBytes());
                  entity.setContent(instream);
                  resp.setEntity(entity);
  
                new MockUp<CamundaClient>() {
                        @Mock
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                       int recipeTimeout, String requestAction,
-                                       String serviceInstanceId, String vnfId, String vfModuleId,
-                                       String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                       String vnfType, String vfModuleType, String networkType,
-                                       String requestDetails, String recipeParamXsd) {
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {
                                ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                                HttpResponse resp = new BasicHttpResponse(pv, 202,
                                                "test response");
                                BasicHttpEntity entity = new BasicHttpEntity();
 -                              String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                              String body = "{\"content\":\"success\",\"message\":\"success\"}";
                                InputStream instream = new ByteArrayInputStream(body.getBytes());
                                entity.setContent(instream);
                                resp.setEntity(entity);
  
                new MockUp<CamundaClient>() {
                        @Mock
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                       int recipeTimeout, String requestAction,
-                                       String serviceInstanceId, String vnfId, String vfModuleId,
-                                       String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                       String vnfType, String vfModuleType, String networkType,
-                                       String requestDetails, String recipeParamXsd) {
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {
                                ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                                HttpResponse resp = new BasicHttpResponse(pv, 202,
                                                "test response");
                                BasicHttpEntity entity = new BasicHttpEntity();
 -                              String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                              String body = "{\"content\":\"success\",\"message\":\"success\"}";
                                InputStream instream = new ByteArrayInputStream(body.getBytes());
                                entity.setContent(instream);
                                resp.setEntity(entity);
  
          new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction,
-                                      String serviceInstanceId, String vnfId, String vfModuleId,
-                                      String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                      String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd) {
+             public HttpResponse post(RequestClientParamater requestClientParamater) {
                  ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                  HttpResponse resp = new BasicHttpResponse(pv, 202,
                          "test response");
                  BasicHttpEntity entity = new BasicHttpEntity();
 -                String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                String body = "{\"content\":\"success\",\"message\":\"success\"}";
                  InputStream instream = new ByteArrayInputStream(body.getBytes());
                  entity.setContent(instream);
                  resp.setEntity(entity);
  
          new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction,
-                                      String serviceInstanceId, String vnfId, String vfModuleId,
-                                      String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                      String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd) {
+             public HttpResponse post(RequestClientParamater requestClientParamater) {
                  ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                  HttpResponse resp = new BasicHttpResponse(pv, 202,
                          "test response");
                  BasicHttpEntity entity = new BasicHttpEntity();
 -                String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                String body = "{\"content\":\"success\",\"message\":\"success\"}";
                  InputStream instream = new ByteArrayInputStream(body.getBytes());
                  entity.setContent(instream);
                  resp.setEntity(entity);
  
          new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction,
-                                      String serviceInstanceId, String vnfId, String vfModuleId,
-                                      String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                      String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd) {
+             public HttpResponse post(RequestClientParamater requestClientParamater) {
                  ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                  HttpResponse resp = new BasicHttpResponse(pv, 202,
                          "test response");
                  BasicHttpEntity entity = new BasicHttpEntity();
 -                String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                String body = "{\"content\":\"success\",\"message\":\"success\"}";
                  InputStream instream = new ByteArrayInputStream(body.getBytes());
                  entity.setContent(instream);
                  resp.setEntity(entity);
  
          MockUp<CamundaClient> client = new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction,
-                                      String serviceInstanceId, String vnfId, String vfModuleId,
-                                      String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                      String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd) throws Exception {
+             public HttpResponse post(RequestClientParamater requestClientParamater) throws Exception {
                  throw new Exception();
              }
          };
  
          new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                  int recipeTimeout, String requestAction, String serviceInstanceId,
-                  String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
-                  String serviceType, String vnfType, String vfModuleType, String networkType,
-                  String requestDetails, String recipeParamXsd)
-                     throws ClientProtocolException, IOException {
+             public HttpResponse post(RequestClientParamater requestClientParamater) throws IOException {
                  throw new ClientProtocolException();
              }
          };
  
          new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction, String serviceInstanceId,
-                                      String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
-                                      String serviceType, String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd)
-                     throws ClientProtocolException, IOException {
+             public HttpResponse post(RequestClientParamater requestClientParamater) {
                  ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                  HttpResponse resp = new BasicHttpResponse(pv, 202,
                          "compareModelwithTargetVersion, test response");
                  BasicHttpEntity entity = new BasicHttpEntity();
 -                String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                String body = "{\"content\":\"success\",\"message\":\"success\"}";
                  InputStream instream = new ByteArrayInputStream(body.getBytes());
                  entity.setContent(instream);
                  resp.setEntity(entity);
  
          final MockUp<CamundaClient> mockCamundaClient = new MockUp<CamundaClient>() {
              @Mock
-             public HttpResponse post(String requestId, boolean isBaseVfModule,
-                                      int recipeTimeout, String requestAction,
-                                      String serviceInstanceId, String vnfId, String vfModuleId,
-                                      String volumeGroupId, String networkId, String configurationId, String serviceType,
-                                      String vnfType, String vfModuleType, String networkType,
-                                      String requestDetails, String recipeParamXsd) {
+             public HttpResponse post(RequestClientParamater requestClientParamater) {
                  ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
                  HttpResponse resp = new BasicHttpResponse(pv, 202,
                          "test response");
                  BasicHttpEntity entity = new BasicHttpEntity();
 -                String body = "{\"response\":\"success\",\"message\":\"success\"}";
 +                String body = "{\"content\":\"success\",\"message\":\"success\"}";
                  InputStream instream = new ByteArrayInputStream(body.getBytes());
                  entity.setContent(instream);
                  resp.setEntity(entity);
  package org.openecomp.mso.apihandlerinfra;\r
  \r
  \r
+ import static org.junit.Assert.assertTrue;\r
\r
+ import java.io.ByteArrayInputStream;\r
+ import java.io.InputStream;\r
+ import java.util.Collections;\r
+ import java.util.HashMap;\r
+ import java.util.List;\r
+ import javax.ws.rs.core.Response;\r
+ import mockit.Mock;\r
+ import mockit.MockUp;\r
  import org.apache.http.HttpResponse;\r
  import org.apache.http.ProtocolVersion;\r
  import org.apache.http.entity.BasicHttpEntity;\r
@@@ -30,33 -40,23 +40,23 @@@ import org.hibernate.criterion.Order
  import org.junit.BeforeClass;\r
  import org.junit.Ignore;\r
  import org.junit.Test;\r
\r
- import javax.ws.rs.core.Response;\r
\r
- import static org.junit.Assert.assertFalse;\r
- import static org.junit.Assert.assertTrue;\r
- import static org.junit.Assert.fail;\r
\r
- import java.io.ByteArrayInputStream;\r
- import java.io.InputStream;\r
- import java.util.Collections;\r
- import java.util.HashMap;\r
- import java.util.List;\r
\r
  import org.openecomp.mso.apihandler.common.CamundaClient;\r
  import org.openecomp.mso.apihandler.common.RequestClient;\r
  import org.openecomp.mso.apihandler.common.RequestClientFactory;\r
+ import org.openecomp.mso.apihandler.common.RequestClientParamater;\r
  import org.openecomp.mso.db.catalog.CatalogDatabase;\r
- import org.openecomp.mso.db.catalog.beans.*;\r
+ import org.openecomp.mso.db.catalog.beans.Service;\r
+ import org.openecomp.mso.db.catalog.beans.ServiceRecipe;\r
+ import org.openecomp.mso.db.catalog.beans.VfModule;\r
+ import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;\r
+ import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;\r
+ import org.openecomp.mso.db.catalog.beans.VnfRecipe;\r
+ import org.openecomp.mso.db.catalog.beans.VnfResource;\r
  import org.openecomp.mso.properties.MsoJavaProperties;\r
- import org.openecomp.mso.properties.MsoPropertiesException;\r
  import org.openecomp.mso.properties.MsoPropertiesFactory;\r
  import org.openecomp.mso.requestsdb.InfraActiveRequests;\r
  import org.openecomp.mso.requestsdb.RequestsDatabase;\r
  \r
- import mockit.Mock;\r
- import mockit.MockUp;\r
\r
  public class ServiceInstanceTest {\r
  \r
        /*** Create Service Instance Test Cases ***/\r
          \r
          new MockUp<CamundaClient>() {\r
              @Mock\r
-             public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                               String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                               String requestDetails, String recipeParamXsd){ \r
+             public HttpResponse post(RequestClientParamater requestClientParamater) {\r
                ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
                HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
                BasicHttpEntity entity = new BasicHttpEntity();\r
 -              String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
 +              String body = "{\"content\":\"success\",\"message\":\"success\"}";\r
                InputStream instream = new ByteArrayInputStream(body.getBytes());\r
                entity.setContent(instream);\r
                resp.setEntity(entity);\r
          \r
          new MockUp<CamundaClient>() {\r
              @Mock\r
-             public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                               String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                               String requestDetails, String recipeParamXsd){ \r
+             public HttpResponse post(RequestClientParamater requestClientParamater) {\r
                ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
                HttpResponse resp = new BasicHttpResponse(pv,500, "test response");\r
                BasicHttpEntity entity = new BasicHttpEntity();\r
 -              String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
 +              String body = "{\"content\":\"success\",\"message\":\"success\"}";\r
                InputStream instream = new ByteArrayInputStream(body.getBytes());\r
                entity.setContent(instream);\r
                resp.setEntity(entity);\r
          \r
          new MockUp<CamundaClient>() {\r
              @Mock\r
-             public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                               String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                               String requestDetails, String recipeParamXsd){ \r
+             public HttpResponse post(RequestClientParamater requestClientParamater) {\r
                ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
                HttpResponse resp = new BasicHttpResponse(pv,500, "test response");\r
                BasicHttpEntity entity = new BasicHttpEntity();\r
 -              String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
 +              String body = "{\"content\":\"success\",\"message\":\"success\"}";\r
                InputStream instream = new ByteArrayInputStream(body.getBytes());\r
                entity.setContent(instream);\r
                resp.setEntity(entity);\r
          \r
          new MockUp<CamundaClient>() {\r
              @Mock\r
-             public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                               String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                               String requestDetails, String recipeParamXsd){ \r
+             public HttpResponse post(RequestClientParamater requestClientParamater){\r
                return null;\r
              }\r
          };\r
  \r
                new MockUp<CamundaClient>() {\r
                        @Mock\r
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                                                                        int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                                                                        String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                                                                        String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                                                                        String requestDetails, String recipeParamXsd){\r
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {\r
                                ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
                                HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
                                BasicHttpEntity entity = new BasicHttpEntity();\r
  \r
 -                              final String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
 +                              final String body = "{\"content\":\"success\",\"message\":\"success\"}";\r
                                InputStream instream = new ByteArrayInputStream(body.getBytes());\r
                                entity.setContent(instream);\r
                                resp.setEntity(entity);\r
  \r
                new MockUp<CamundaClient>() {\r
                        @Mock\r
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                                                                        int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                                                                        String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                                                                        String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                                                                        String requestDetails, String recipeParamXsd){\r
+                       public HttpResponse post(RequestClientParamater requestClientParamater){\r
                                ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
                                HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
                                BasicHttpEntity entity = new BasicHttpEntity();\r
  \r
 -                              final String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
 +                              final String body = "{\"content\":\"success\",\"message\":\"success\"}";\r
                                InputStream instream = new ByteArrayInputStream(body.getBytes());\r
                                entity.setContent(instream);\r
                                resp.setEntity(entity);\r
  \r
                new MockUp<CamundaClient>() {\r
                        @Mock\r
-                       public HttpResponse post(String requestId, boolean isBaseVfModule,\r
-                                                                        int recipeTimeout, String requestAction, String serviceInstanceId,\r
-                                                                        String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
-                                                                        String serviceType, String vnfType, String vfModuleType, String networkType,\r
-                                                                        String requestDetails, String recipeParamXsd){\r
+                       public HttpResponse post(RequestClientParamater requestClientParamater) {\r
                                ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
                                HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
                                BasicHttpEntity entity = new BasicHttpEntity();\r
  \r
 -                              final String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
 +                              final String body = "{\"content\":\"success\",\"message\":\"success\"}";\r
                                InputStream instream = new ByteArrayInputStream(body.getBytes());\r
                                entity.setContent(instream);\r
                                resp.setEntity(entity);\r