support manual scale for NS 57/39557/1
authorguanwenyao <guanwenyao@chinamobile.com>
Wed, 28 Mar 2018 09:42:46 +0000 (17:42 +0800)
committerguanwenyao <guanwenyao@chinamobile.com>
Wed, 28 Mar 2018 09:43:29 +0000 (17:43 +0800)
Issue-ID: SO-423

Change-Id: I752e096806ec513250a8fb1bf51a2ed57fb05f6e
Signed-off-by: guanwenyao <guanwenyao@chinamobile.com>
31 files changed:
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java [new file with mode: 0644]
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java [new file with mode: 0644]
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java [new file with mode: 0644]
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java [new file with mode: 0644]
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
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/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java [new file with mode: 0644]

index 06a937a..8e16d1c 100644 (file)
@@ -37,6 +37,7 @@ import org.openecomp.mso.adapters.vfc.model.NsParameters;
 import org.openecomp.mso.adapters.vfc.model.NsProgressStatus;
 import org.openecomp.mso.adapters.vfc.model.ResponseDescriptor;
 import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
+import org.openecomp.mso.adapters.vfc.model.*;
 import org.openecomp.mso.adapters.vfc.util.JsonUtil;
 import org.openecomp.mso.adapters.vfc.util.RestfulUtil;
 import org.openecomp.mso.adapters.vfc.util.ValidateUtil;
@@ -70,6 +71,7 @@ public class VfcManager {
     nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL);
     nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL);
     nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
+       nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL);
   }
 
   public VfcManager() {
@@ -400,6 +402,73 @@ public class VfcManager {
     return rsp;
   }
 
+    /**
+     * Scale NS instance
+     * <br>
+     * 
+     * @param nsInstanceId The NS instance id
+     * @param segInput input parameters for current node from http request
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput)
+               throws ApplicationException {
+       // Call the NFVO to scale service
+        LOGGER.info("scale ns -> begin");
+
+        // Step1: Prepare restful parameters and options
+        VFCScaleData oRequest = new VFCScaleData();
+        oRequest.setNsInstanceId(nsInstanceId);
+        NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters();
+        oRequest.setScaleType(nsScaleParameters.getScaleType());
+        oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData());
+        String scaleReq = JsonUtil.marshal(oRequest);
+        
+        // Step2: prepare url and method type
+        String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE);
+        String methodType = CommonConstant.MethodType.POST;
+        LOGGER.info("scale ns request is {}", scaleReq);
+        // Step3: Call NFVO lcm to scale ns
+        RestfulResponse scaleRsp = RestfulUtil.send(url, methodType, scaleReq);
+        ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+                segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
+                segInput.getNsOperationKey().getNodeTemplateUUID());
+        ValidateUtil.assertObjectNotNull(scaleRsp);
+        if(!HttpCode.isSucess(scaleRsp.getStatus())) {
+            LOGGER.error("update segment operation status : fail to scale ns");
+            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+            nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
+            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
+            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS);
+        }
+        LOGGER.info("scale ns response status is {}", scaleRsp.getStatus());
+        LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent());
+
+        ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent());
+        @SuppressWarnings("unchecked")
+        Map<String, String> rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class);
+        String jobId = rsp.get(CommonConstant.JOB_ID);
+        if(ValidateUtil.isStrEmpty(jobId)) {
+            LOGGER.error("Invalid jobId from scale operation");
+            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+            nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
+            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
+            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+                    DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION);
+        }
+
+        LOGGER.info("update resource operation status job id -> begin");
+        // Step 4: update segment operation job id
+        nsOperInfo.setJobId(jobId);
+        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+        LOGGER.info("update segment operation job id -> end");
+        LOGGER.info("scale ns -> end");
+               
+        return scaleRsp;
+    }
+       
   /**
    * get url for the operation <br>
    * 
index 471ba43..57c68de 100644 (file)
@@ -42,6 +42,8 @@ public class CommonConstant {
 
     public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s";
 
+    public static final String NFVO_SCALE_URL = "/api/nslcm/v1/ns/%s/scale";
+
     /**
      * 
      * <br>
@@ -89,6 +91,8 @@ public class CommonConstant {
 
         public static final String DELETE = "delete";
 
+        public static final String SCALE = "scale";
+
         private Step() {
 
         }
@@ -122,6 +126,8 @@ public class CommonConstant {
 
         public static final String CREATE_NS_FAILED = "create ns failed";
 
+        public static final String SCALE_NS_FAILED = "scale ns failed";
+
         private StatusDesc() {
 
         }
index afaa901..48273f0 100644 (file)
@@ -52,6 +52,11 @@ public class DriverExceptionID {
 
   public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status";
 
+  public static final String FAIL_TO_SCALE_NS = "Fail to scale network service";
+
+  public static final String INVALID_RESPONSE_FROM_SCALE_OPERATION = "Invalid response from scale operation";
+
+
   private DriverExceptionID() {
 
   }
index 35dec4b..765ee52 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2018 CMCC 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.
@@ -47,9 +48,9 @@ public class NSResourceInputParameter {
 
     private NsParameters nsParameters;
 
+    private NsScaleParameters nsScaleParameters;
 
 
-    
     /**
      * @return Returns the nsServiceName.
      */
@@ -127,4 +128,12 @@ public class NSResourceInputParameter {
             return "";
         }
     }
+
+    public NsScaleParameters getNsScaleParameters() {
+        return nsScaleParameters;
+    }
+
+    public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
+        this.nsScaleParameters = nsScaleParameters;
+    }
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java
new file mode 100644 (file)
index 0000000..eb40cdd
--- /dev/null
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.adapters.vfc.model;
+
+import java.util.List;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class NsScaleParameters {
+
+    private List<ScaleNsByStepsData> scaleNsByStepsData;
+
+    private String scaleType;
+
+    /**
+     * @return Returns the scaleNsByStepsData.
+     */
+       public List<ScaleNsByStepsData> getScaleNsByStepsData() {
+               return scaleNsByStepsData;
+       }
+
+       /**
+        * @param scaleNsByStepsData The scaleNsByStepsData to set.
+        */
+       public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) {
+               this.scaleNsByStepsData = scaleNsByStepsData;
+       }
+
+       /**
+        * @return Returns the scale Type.
+        */
+       public String getScaleType() {
+               return scaleType;
+       }
+
+       /**
+        * @param scaleType The scaleType to set.
+        */
+       public void setScaleType(String scaleType) {
+               this.scaleType = scaleType;
+       }
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java
new file mode 100644 (file)
index 0000000..1d9e7aa
--- /dev/null
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.adapters.vfc.model;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ * request model for scale
+ * 
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class NsScaleReq extends NsScaleParameters {
+
+    String nsInstanceId;
+
+    /**
+     * @return Returns the nsInstanceId.
+     */
+    public String getNsInstanceId() {
+        return nsInstanceId;
+    }
+
+    /**
+     * @param nsInstanceId The nsInstanceId to set.
+     */
+    public void setNsInstanceId(String nsInstanceId) {
+        this.nsInstanceId = nsInstanceId;
+    }
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java
new file mode 100644 (file)
index 0000000..668b660
--- /dev/null
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.adapters.vfc.model;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class ScaleNsByStepsData {
+
+    /**
+     * scaling Direction
+     */
+    private String scalingDirection;
+    
+    /**
+     * aspect ID
+     */
+    private String aspectId;
+    
+    /**
+     * number of Steps
+     */
+    private Integer numberOfSteps;
+
+    /**
+     * @return Returns the scalingDirection.
+     */
+    public String getScalingDirection() {
+        return scalingDirection;
+    }
+
+    /**
+     * @param scalingDirection The scalingDirection to set.
+     */
+    public void setScalingDirection(String scalingDirection) {
+        this.scalingDirection = scalingDirection;
+    }
+
+    /**
+     * @return Returns the aspectId.
+     */
+       public String getAspectId() {
+               return aspectId;
+       }
+
+    /**
+     * @param aspectId The aspectId to set.
+     */
+       public void setAspectId(String aspectId) {
+               this.aspectId = aspectId;
+       }
+
+    /**
+     * @return Returns the numberOfSteps.
+     */
+       public Integer getNumberOfSteps() {
+               return numberOfSteps;
+       }
+
+    /**
+     * @param numberOfSteps The numberOfSteps to set.
+     */
+       public void setNumberOfSteps(int numberOfSteps) {
+               this.numberOfSteps = numberOfSteps;
+       }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java
new file mode 100644 (file)
index 0000000..437af5b
--- /dev/null
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.adapters.vfc.model;
+
+import java.util.List;
+
+/**
+ * aim to wrap List<ScaleNsByStepsData> as a new list
+ * then be provided for the usage of vfc json
+ *
+ * added on 2018/01/30 by Qihui Zhao from CMCC
+ * */
+
+public class ScaleNsData {
+
+    private List<ScaleNsByStepsData> scaleNsByStepsData;
+
+    /**
+     * @return Returns the scaleNsByStepsData.
+     */
+    public List<ScaleNsByStepsData> getScaleNsByStepsData() {
+        return scaleNsByStepsData;
+    }
+
+    /**
+     * @param scaleNsByStepsData The scaleNsByStepsData to set.
+     */
+    public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) {
+        this.scaleNsByStepsData = scaleNsByStepsData;
+    }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java
new file mode 100644 (file)
index 0000000..33460b4
--- /dev/null
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.adapters.vfc.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Object totally matches required VFC input json format
+ * JsonUtil.marshal will convert this Object to string
+ *
+ * added on 2018/01/30 by Qihui Zhao from CMCC*/
+
+public class VFCScaleData {
+
+    private String nsInstanceId;
+
+    private String scaleType;
+
+    private List<ScaleNsData> scaleNsData = new ArrayList<>();
+
+    /**
+     * @return Returns the nsInstanceId.
+     */
+    public String getNsInstanceId() {
+        return nsInstanceId;
+    }
+
+    /**
+     * @param nsInstanceId The nsInstanceId to set.
+     */
+    public void setNsInstanceId(String nsInstanceId) {
+        this.nsInstanceId = nsInstanceId;
+    }
+
+    /**
+     * @return Returns the scale Type.
+     */
+    public String getScaleType() {
+        return scaleType;
+    }
+
+    /**
+     * @param scaleType The scaleType to set.
+     */
+    public void setScaleType(String scaleType) {
+        this.scaleType = scaleType;
+    }
+
+    /**
+     *@return Returns the scaleNsDate.
+     */
+    public List<ScaleNsData> getScaleNsData(){return scaleNsData;}
+
+    /**
+     * The scaleNsData to set.
+     */
+    public void setScaleNsData(List<ScaleNsByStepsData> scaleNsByStepsData){
+        ScaleNsData scaleNsDataObj = new ScaleNsData();
+        scaleNsDataObj.setScaleNsByStepsData(scaleNsByStepsData);
+
+        this.scaleNsData.add(scaleNsDataObj);
+    }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
new file mode 100644 (file)
index 0000000..b45a52b
--- /dev/null
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONArray;
+import static org.apache.commons.lang3.StringUtils.*;
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.json.JSONObject;
+import org.springframework.web.util.UriUtils;
+
+/**
+ * This groovy class supports the <class>DoScaleServiceInstance.bpmn</class> process.
+ *
+ */
+public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
+
+    String Prefix = "DCRESI_"
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+
+    public void preProcessRequest(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        String msg = ""
+        utils.log("DEBUG", " ***** preProcessRequest *****", isDebugEnabled)
+
+        try {
+            String requestId = execution.getVariable("msoRequestId")
+            execution.setVariable("prefix", Prefix)
+
+            //Inputs
+            String globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+            String serviceType = execution.getVariable("serviceType")
+            String serviceInstanceName = execution.getVariable("serviceInstanceName")
+            String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+            execution.setVariable("serviceType", serviceType)
+
+            String resourceTemplateUUIDs = ""
+            String scaleNsRequest = execution.getVariable("bpmnRequest")
+            JSONObject jsonObject = new JSONObject(scaleNsRequest).getJSONObject("service")
+            JSONArray jsonArray = jsonObject.getJSONArray("resources")
+
+            for (int i = 0; i < jsonArray.size(); i++) {
+                JSONObject reqBodyJsonObj = jsonArray.getJSONObject(i)
+                String nsInstanceId = reqBodyJsonObj.getString("resourceInstanceId")
+                resourceTemplateUUIDs = resourceTemplateUUIDs + nsInstanceId + ":"
+            }
+
+            execution.setVariable("resourceTemplateUUIDs", resourceTemplateUUIDs)
+
+            if (serviceInstanceName == null) {
+                execution.setVariable("serviceInstanceName", "")
+            }
+            if (isBlank(serviceInstanceId)) {
+                msg = "Input serviceInstanceId is null"
+                utils.log("DEBUG", msg, isDebugEnabled)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            }
+        } catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            utils.log("DEBUG", msg, isDebugEnabled)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled)
+    }
+
+
+    public void preInitResourcesOperStatus(DelegateExecution execution){
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+        utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+        try{
+            String serviceId = execution.getVariable("serviceInstanceId")
+            String operationId = execution.getVariable("operationId")
+            String operationType = "SCALE"
+
+            // resourceTemplateUUIDs should be created ??
+            String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs")
+            utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
+            serviceId = UriUtils.encode(serviceId,"UTF-8")
+            execution.setVariable("serviceInstanceId", serviceId)
+            execution.setVariable("operationId", operationId)
+            execution.setVariable("operationType", operationType)
+
+            execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+
+            String payload =
+                    """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:ns="http://org.openecomp.mso/requestsdb">
+                        <soapenv:Header/>
+                        <soapenv:Body>
+                            <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+                            <serviceId>${serviceId}</serviceId>
+                            <operationId>${operationId}</operationId>
+                            <operationType>${operationType}</operationType>
+                            <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+                        </ns:initResourceOperationStatus>
+                    </soapenv:Body>
+                </soapenv:Envelope>"""
+
+            payload = utils.formatXml(payload)
+            execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+            utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+            utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+
+        }catch(Exception e){
+            utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
+            execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
+        }
+        utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+    }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
new file mode 100644 (file)
index 0000000..9e3f78b
--- /dev/null
@@ -0,0 +1,324 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONArray
+import org.json.JSONObject;
+
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.codehaus.jackson.map.ObjectMapper
+
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.rest.APIResponse;
+
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleResource
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsData
+
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NSResourceInputParameter
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsOperationKey
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsScaleParameters
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsParameters
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.LocationConstraint
+
+
+/**
+ * This groovy class supports the <class>DoScaleVFCNetworkServiceInstance.bpmn</class> process.
+ * flow for VFC Network Service Scale
+ */
+public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
+
+    String host = "http://mso.mso.testlab.openecomp.org:8080"
+
+    String scaleUrl = "/vfc/rest/v1/vfcadapter/ns/{nsInstanceId}/scale"
+
+    String queryJobUrl = "/vfc/rest/v1/vfcadapter/jobs/{jobId}"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+    JsonUtils jsonUtil = new JsonUtils()
+
+    /**
+     * Pre Process the BPMN Flow Request
+     * Inclouds:
+     * generate the nsOperationKey
+     * generate the nsParameters
+     */
+    public void preProcessRequest(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+
+        List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution)
+        String requestJsonStr = ""
+        int size = nsRIPList.size()
+        for (int i = 0; i < size; i++) {
+            NSResourceInputParameter nsRIP = nsRIPList.get(i)
+
+            if (i == size - 1) {
+                requestJsonStr += objectToJsonStr(nsRIP)
+            } else {
+                requestJsonStr += objectToJsonStr(nsRIP) + "|"
+            }
+        }
+
+        execution.setVariable("reqBody", requestJsonStr)
+
+        utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled)
+    }
+
+    /**
+     * scale NS task
+     */
+    public void scaleNetworkService(DelegateExecution execution) {
+
+        String saleNsRequest = execution.getVariable("reqBody")
+        String[] nsReqStr = saleNsRequest.split("\\|")
+
+        def jobIdArray = ['jobId001', 'jobId002'] as String[]
+
+        for (int i = 0; i < nsReqStr.length; i++) {
+            JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i])
+            String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId")
+            reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId")
+            String reqBody = reqBodyJsonObj.toString()
+
+            String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId)
+
+            APIResponse apiResponse = postRequest(execution, url, reqBody)
+
+            String returnCode = apiResponse.getStatusCode()
+            String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+            String jobId = "";
+            if (returnCode == "200") {
+                jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
+            }
+
+            execution.setVariable("jobId", jobIdArray[i])
+
+            String isScaleFinished = ""
+
+            // query the requested network service scale status, if finished, then start the next one, otherwise, wait
+            while (isScaleFinished != "finished"){
+                timeDelay()
+                queryNSProgress(execution)
+                isScaleFinished = execution.getVariable("operationStatus")
+            }
+        }
+    }
+
+    /**
+     * query NS task
+     */
+    private void queryNSProgress(DelegateExecution execution) {
+        String jobId = execution.getVariable("jobId")
+        String url = host + queryJobUrl.replaceAll("\\{jobId\\}", jobId)
+
+        NsOperationKey nsOperationKey = new NsOperationKey()
+        // is this net work service ID or E2E service ID?
+        nsOperationKey.setServiceId(execution.getVariable("serviceId"))
+        nsOperationKey.setServiceType(execution.getVariable("serviceType"))
+        nsOperationKey.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+        nsOperationKey.setNodeTemplateUUID(execution.getVariable("nodeTemplateUUID"))
+        nsOperationKey.setOperationId(execution.getVariable("operationId"))
+        String queryReqBody = objectToJsonStr(nsOperationKey)
+
+        APIResponse apiResponse = postRequest(execution,url, queryReqBody)
+
+        String returnCode = apiResponse.getStatusCode()
+        String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+
+        String operationStatus = "error"
+
+        if (returnCode == "200") {
+            operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")
+        }
+
+        execution.setVariable("operationStatus", operationStatus)
+    }
+
+    /**
+     * delay 5 sec
+     *
+     */
+    private void timeDelay() {
+        try {
+            Thread.sleep(5000)
+        } catch (InterruptedException e) {
+            taskProcessor.utils.log("ERROR", "Time Delay exception" + e, isDebugEnabled)
+        }
+    }
+
+    /**
+     * finish NS task
+     */
+    public void finishNSScale(DelegateExecution execution) {
+        //no need to do anything util now
+        System.out.println("Scale finished.")
+    }
+
+    /**
+     * post request
+     * url: the url of the request
+     * requestBody: the body of the request
+     */
+    private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****",  isDebugEnabled)
+        utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody,  isDebugEnabled)
+        APIResponse apiResponse = null
+        try{
+            RESTConfig config = new RESTConfig(url)
+            RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+//            RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+            apiResponse = client.httpPost(requestBody)
+            utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(),  isDebugEnabled)
+            utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ",  isDebugEnabled)
+        }catch(Exception e){
+            utils.log("ERROR","Exception occured while executing VFC Post Call. Exception is: \n" + e,  isDebugEnabled)
+            throw new BpmnError("MSOWorkflowException")
+        }
+        return apiResponse
+    }
+
+    /**
+     * create a Scale Resource object list from a NSScaleRequestJso nString
+     * This method is for the specific request from Scale Network Service BPMN workflow
+     * @param nsScaleRequestJsonString , a specific request Json string which conform to ?? class
+     * @return List < ScaleResource >
+     */
+    private List<ScaleResource> jsonGetNsResourceList(String nsScaleRequestJsonString) {
+        List<ScaleResource> list = new ArrayList<ScaleResource>()
+        JSONObject jsonObject = new JSONObject(nsScaleRequestJsonString)
+
+        JSONObject jsonResource = jsonObject.getJSONObject("service")
+        JSONArray arr = jsonResource.getJSONArray("resources")
+
+        for (int i = 0; i < arr.length(); i++) {
+            JSONObject tempResource = arr.getJSONObject(i)
+            ScaleResource resource = new ScaleResource()
+            resource.setResourceInstanceId(tempResource.getString("resourceInstanceId"))
+            resource.setScaleType(tempResource.getString("scaleType"))
+
+            JSONObject jsonScaleNsData = tempResource.getJSONObject("scaleNsData")
+            JSONObject jsonScaleNsByStepData = jsonScaleNsData.getJSONObject("scaleNsByStepsData")
+
+            ScaleNsData scaleNsData = new ScaleNsData()
+            ScaleNsByStepsData stepsData = new ScaleNsByStepsData()
+
+            stepsData.setAspectId(jsonScaleNsByStepData.getString("aspectId"))
+            stepsData.setScalingDirection(jsonScaleNsByStepData.getString("scalingDirection"))
+            stepsData.setNumberOfSteps(Integer.parseInt(jsonScaleNsByStepData.getString("numberOfSteps")))
+
+            scaleNsData.setScaleNsByStepsData(stepsData)
+            resource.setScaleNsData(scaleNsData)
+            list.add(resource)
+        }
+
+        return list
+    }
+
+    /**
+     * Convert a java class to JSON string
+     * @param obj
+     * @return
+     */
+    private String objectToJsonStr(Object obj) {
+        ObjectMapper mapper = new ObjectMapper()
+        String jsonStr = null
+        try {
+            jsonStr = mapper.writeValueAsString(obj)
+        } catch (IOException ioe) {
+            System.out.println(ioe.getMessage())
+        }
+        return jsonStr
+
+    }
+
+    /**
+     * create a NSResourceInputParameter list from a Scale Network request Json string
+     * @return
+     */
+    private List<NSResourceInputParameter> convertScaleNsReq2NSResInputParamList(DelegateExecution execution) {
+        String saleNsRequest = execution.getVariable("bpmnRequest")
+
+        //String requestId = execution.getVariable("msoRequestId")
+        //String serviceInstanceId = execution.getVariable("serviceInstanceId")
+        String serviceInstanceName = execution.getVariable("serviceInstanceName")
+        //String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID")
+        String serviceType = execution.getVariable("serviceType")
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String operationId = execution.getVariable("operationId")
+        String serviceId = execution.getVariable("serviceId")
+        String nsServiceDescription = execution.getVariable("requestDescription")
+
+        String resource = JsonUtils.getJsonValue(saleNsRequest, "service.resources")
+
+        // set nsScaleParameters properties
+        List<ScaleResource> scaleResourcesList = jsonGetNsResourceList(saleNsRequest)
+        List<NSResourceInputParameter> nsResourceInputParameterList = new ArrayList<NSResourceInputParameter>()
+
+        for (ScaleResource sr : scaleResourcesList) {
+            NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter()
+            NsOperationKey nsOperationKey = new NsOperationKey()
+            NsParameters nsParameters = new NsParameters()
+            NsScaleParameters nsScaleParameters = new NsScaleParameters()
+            nsParameters.setLocationConstraints(new ArrayList<LocationConstraint>())
+            nsParameters.setAdditionalParamForNs(new HashMap<String, Object>())
+
+            // set NsOperationKey properties
+            nsOperationKey.setGlobalSubscriberId(globalSubscriberId)
+            nsOperationKey.setServiceId(serviceId)
+            nsOperationKey.setServiceType(serviceType)
+            // for ns scale the resourceInstanceId is the nodeTemplateUUID
+            nsOperationKey.setNodeTemplateUUID(sr.getResourceInstanceId())
+            nsOperationKey.setOperationId(operationId)
+
+            nsScaleParameters.setScaleType(sr.getScaleType())
+            nsScaleParameters.setNsInstanceId(sr.getResourceInstanceId())
+
+            ScaleNsByStepsData scaleNsByStepsData = new ScaleNsByStepsData()
+            scaleNsByStepsData.setScalingDirection(sr.getScaleNsData().getScaleNsByStepsData().getScalingDirection())
+            scaleNsByStepsData.setNumberOfSteps(sr.getScaleNsData().getScaleNsByStepsData().getNumberOfSteps())
+            scaleNsByStepsData.setAspectId(sr.getScaleNsData().getScaleNsByStepsData().getAspectId())
+
+            List<ScaleNsByStepsData> scaleNsByStepsDataList = new ArrayList<ScaleNsByStepsData>()
+            scaleNsByStepsDataList.add(scaleNsByStepsData)
+            nsScaleParameters.setScaleNsByStepsData(scaleNsByStepsDataList)
+
+            nsResourceInputParameter.setNsOperationKey(nsOperationKey)
+            nsResourceInputParameter.setNsServiceName(serviceInstanceName)
+            nsResourceInputParameter.setNsServiceDescription(nsServiceDescription)
+            nsResourceInputParameter.setNsParameters(nsParameters)
+            nsResourceInputParameter.setNsScaleParameters(nsScaleParameters)
+
+            nsResourceInputParameterList.add(nsResourceInputParameter)
+        }
+        return nsResourceInputParameterList
+    }
+}
+
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
new file mode 100644 (file)
index 0000000..58f644d
--- /dev/null
@@ -0,0 +1,305 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+
+import static org.apache.commons.lang3.StringUtils.*
+import org.openecomp.mso.logger.MsoLogger
+import org.openecomp.mso.utils.UUIDChecker
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+
+import org.springframework.web.util.UriUtils
+
+
+/**
+ * This groovy class supports the <class>ScaleCustomE2EServiceInstance.bpmn</class> process.
+ *
+ */
+public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor {
+    String Prefix = "CRESI_"
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+    public void preProcessRequest(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        execution.setVariable("prefix", Prefix)
+        String msg = ""
+        utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+
+        try {
+
+            String siRequest = execution.getVariable("bpmnRequest")
+            utils.logAudit(siRequest)
+
+            String requestId = execution.getVariable("mso-request-id")
+            execution.setVariable("msoRequestId", requestId)
+            utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
+
+            String serviceInstanceId = execution.getVariable("serviceInstanceId")
+            if (isBlank(serviceInstanceId)) {
+                serviceInstanceId = "NULL".toString()
+            }
+            utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)
+            serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8")
+            execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+            // service instance ID is also service ID
+            execution.setVariable("serviceId", serviceInstanceId)
+            // service instance name
+            String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "service.serviceInstanceName")
+            execution.setVariable("serviceInstanceName", serviceInstanceName)
+
+            // service instance name
+            String serviceType = jsonUtil.getJsonValue(siRequest, "service.serviceType")
+            execution.setVariable("serviceType", serviceType)
+
+            // operationa ID (key)
+            //String operationKey = UUIDChecker.generateUUID(msoLogger)
+            String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
+            execution.setVariable("operationId", operationId)
+            utils.log("DEBUG", "Input Request:" + siRequest + " operationId:" + operationId, isDebugEnabled)
+
+
+            String resources = jsonUtil.getJsonValue(siRequest, "service.resources")
+            execution.setVariable("resources", resources)
+
+            // node template UUID
+            String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger)
+            execution.setVariable("nodeTemplateUUID", nodeTemplateUUID)
+
+            //subscriberInfo
+            String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "service.globalSubscriberId")
+            if (isBlank(globalSubscriberId)) {
+                msg = "Input globalSubscriberId' is null"
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("globalSubscriberId", globalSubscriberId)
+            }
+
+            String requestDescription = "request description for test"
+            execution.setVariable("requestDescription", requestDescription)
+            execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+
+        } catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            utils.log("DEBUG", msg, isDebugEnabled)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled)
+    }
+
+    public void sendSyncResponse(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+        try {
+            String operationId = execution.getVariable("operationId")
+            String serviceInstanceId = execution.getVariable("serviceInstanceId")
+            // RESTResponse for API Handler (APIH) Reply Task
+            String scaleServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${
+                operationId
+            }"}}""".trim()
+            utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest, isDebugEnabled)
+            sendWorkflowResponse(execution, 202, scaleServiceRestRequest)
+            execution.setVariable("sentSyncResponse", true)
+
+        } catch (Exception ex) {
+            String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+            utils.log("DEBUG", msg, isDebugEnabled)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        utils.log("DEBUG", " ***** Exit sendSyncResopnse *****", isDebugEnabled)
+    }
+
+
+    public void sendSyncError(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled)
+
+        try {
+            String errorMessage = ""
+            if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+                WorkflowException wfe = execution.getVariable("WorkflowException")
+                errorMessage = wfe.getErrorMessage()
+            } else {
+                errorMessage = "Sending Sync Error."
+            }
+
+            String buildworkflowException =
+                    """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+                                       <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+                                       <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+                                  </aetgt:WorkflowException>"""
+
+            utils.logAudit(buildworkflowException)
+            sendWorkflowResponse(execution, 500, buildworkflowException)
+
+        } catch (Exception ex) {
+            utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+        }
+
+    }
+
+    public void prepareCompletionRequest(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled)
+
+        try {
+            String requestId = execution.getVariable("msoRequestId")
+            String serviceInstanceId = execution.getVariable("serviceInstanceId")
+            String source = execution.getVariable("source")
+
+            String msoCompletionRequest =
+                    """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+                                                               xmlns:ns="http://org.openecomp/mso/request/types/v1">
+                                               <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+                                                       <request-id>${requestId}</request-id>
+                                                       <action>SCALE</action>
+                                                       <source>${source}</source>
+                                                  </request-info>
+                                               <status-message>Service Instance was scaled successfully.</status-message>
+                                               <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+                                                  <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name>
+                                       </aetgt:MsoCompletionRequest>"""
+
+            // Format Response
+            String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+            execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+            utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+
+        } catch (Exception ex) {
+            String msg = " Exception in prepareCompletion:" + ex.getMessage()
+            utils.log("DEBUG", msg, isDebugEnabled)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
+    }
+
+    public void prepareFalloutRequest(DelegateExecution execution) {
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled)
+
+        try {
+            WorkflowException wfex = execution.getVariable("WorkflowException")
+            utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled)
+            String requestId = execution.getVariable("msoRequestId")
+            String source = execution.getVariable("source")
+            String requestInfo =
+                    """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+                                       <request-id>${requestId}</request-id>
+                                       <action>SCALE</action>
+                                       <source>${source}</source>
+                                  </request-info>"""
+
+            String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
+            execution.setVariable("falloutRequest", falloutRequest)
+        } catch (Exception ex) {
+            utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
+            String errorException = "  Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest,  buildErrorResponse() - " + ex.getMessage()
+            String requestId = execution.getVariable("msoRequestId")
+            String falloutRequest =
+                    """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+                                                                                                xmlns:ns="http://org.openecomp/mso/request/types/v1"
+                                                                                                xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
+                                          <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+                                                 <request-id>${requestId}</request-id>
+                                                 <action>SCALE</action>
+                                                 <source>UUI</source>
+                                          </request-info>
+                                               <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+                                                       <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage>
+                                                       <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+                                               </aetgt:WorkflowException>
+                                       </aetgt:FalloutHandlerRequest>"""
+
+            execution.setVariable("falloutRequest", falloutRequest)
+        }
+        utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled)
+    }
+
+
+    /**
+     * Init the service Operation Status
+     */
+    public void prepareInitServiceOperationStatus(DelegateExecution execution){
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+        try{
+            String serviceId = execution.getVariable("serviceInstanceId")
+            String serviceName = execution.getVariable("serviceInstanceName")
+            String operationId = execution.getVariable("operationId")
+            String operationType = "SCALE"
+            String userId = ""
+            String result = "processing"
+            String progress = "0"
+            String reason = ""
+            String operationContent = "Prepare service scaling"
+            execution.setVariable("serviceInstanceId", serviceId)
+            execution.setVariable("operationId", operationId)
+            execution.setVariable("operationType", operationType)
+
+            def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+            execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+            utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+            String payload =
+                    """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:ns="http://org.openecomp.mso/requestsdb">
+                        <soapenv:Header/>
+                        <soapenv:Body>
+                            <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+                            <serviceId>${serviceId}</serviceId>
+                            <operationId>${operationId}</operationId>
+                            <serviceName>${serviceName}</serviceName>
+                            <operationType>${operationType}</operationType>
+                            <userId>${userId}</userId>
+                            <result>${result}</result>
+                            <operationContent>${operationContent}</operationContent>
+                            <progress>${progress}</progress>
+                            <reason>${reason}</reason>
+                        </ns:updateServiceOperationStatus>
+                    </soapenv:Body>
+                </soapenv:Envelope>"""
+
+            payload = utils.formatXml(payload)
+            execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+            utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+            utils.logAudit("Scale network service updateServiceOperStatusRequest Request: " + payload)
+
+        }catch(Exception e){
+            utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+            execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
+        }
+        utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+    }
+}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java
new file mode 100644 (file)
index 0000000..4185808
--- /dev/null
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel;
+
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class LocationConstraint {
+
+    /**
+     * vnf profile id
+     */
+    private String vnfProfileId;
+
+    /**
+     * location constraints: vimId
+     */
+    private VimLocation locationConstraints;
+
+    /**
+     * @return Returns the vnfProfileId.
+     */
+    public String getVnfProfileId() {
+        return vnfProfileId;
+    }
+
+    /**
+     * @param vnfProfileId The vnfProfileId to set.
+     */
+    public void setVnfProfileId(String vnfProfileId) {
+        this.vnfProfileId = vnfProfileId;
+    }
+
+
+    /**
+     * @return Returns the locationConstraints.
+     */
+    public VimLocation getLocationConstraints() {
+        return locationConstraints;
+    }
+
+
+    /**
+     * @param locationConstraints The locationConstraints to set.
+     */
+    public void setLocationConstraints(VimLocation locationConstraints) {
+        this.locationConstraints = locationConstraints;
+    }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
new file mode 100644 (file)
index 0000000..272f3fb
--- /dev/null
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel;
+
+
+import org.openecomp.mso.logger.MsoLogger;
+
+
+/**
+ * NS Create Input Parameter For VFC Adapter<br>
+ * <p>
+ * </p>
+ *
+ * @version ONAP Beijing Release 2018/2/5
+ */
+public class NSResourceInputParameter {
+
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+    private NsOperationKey nsOperationKey;
+
+    private String nsServiceName;
+
+    private String nsServiceDescription;
+
+    private NsParameters nsParameters;
+
+    private NsScaleParameters nsScaleParameters;
+
+
+
+
+    /**
+     * @return Returns the nsServiceName.
+     */
+    public String getNsServiceName() {
+        return nsServiceName;
+    }
+
+
+    /**
+     * @param nsServiceName The nsServiceName to set.
+     */
+    public void setNsServiceName(String nsServiceName) {
+        this.nsServiceName = nsServiceName;
+    }
+
+
+    /**
+     * @return Returns the nsServiceDescription.
+     */
+    public String getNsServiceDescription() {
+        return nsServiceDescription;
+    }
+
+
+    /**
+     * @param nsServiceDescription The nsServiceDescription to set.
+     */
+    public void setNsServiceDescription(String nsServiceDescription) {
+        this.nsServiceDescription = nsServiceDescription;
+    }
+
+    /**
+     * @return Returns the nsParameters.
+     */
+    public NsParameters getNsParameters() {
+        return nsParameters;
+    }
+
+    /**
+     * @param nsParameters The nsParameters to set.
+     */
+    public void setNsParameters(NsParameters nsParameters) {
+        this.nsParameters = nsParameters;
+    }
+
+    public NsOperationKey getNsOperationKey() {
+        return nsOperationKey;
+    }
+
+    public void setNsOperationKey(NsOperationKey nsOperationKey) {
+        this.nsOperationKey = nsOperationKey;
+    }
+
+    /**
+     * @return Returns the nsScaleParameters.
+     */
+    public NsScaleParameters getNsScaleParameters() {
+        return nsScaleParameters;
+    }
+
+    /**
+     * @param nsScaleParameters The nsScaleParameters to set.
+     */
+    public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
+        this.nsScaleParameters = nsScaleParameters;
+    }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java
new file mode 100644 (file)
index 0000000..7783d7a
--- /dev/null
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel;
+
+
+/**
+ * The operation key object for NS
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-09-15
+ */
+public class NsOperationKey {
+
+    /**
+     * The subscriber id
+     */
+    private String globalSubscriberId;
+
+    /**
+     * The serviceType
+     */
+    private String serviceType;
+
+    /**
+     * The service ID
+     */
+    private String serviceId;
+
+    /**
+     * The Operation ID
+     */
+    private String operationId;
+
+    /**
+     * the NS template uuid
+     */
+    private String nodeTemplateUUID;
+
+    /**
+     * @return Returns the globalSubscriberId.
+     */
+    public String getGlobalSubscriberId() {
+        return globalSubscriberId;
+    }
+
+    /**
+     * @param globalSubscriberId The globalSubscriberId to set.
+     */
+    public void setGlobalSubscriberId(String globalSubscriberId) {
+        this.globalSubscriberId = globalSubscriberId;
+    }
+
+    /**
+     * @return Returns the serviceType.
+     */
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    /**
+     * @param serviceType The serviceType to set.
+     */
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    /**
+     * <br>
+     *
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    public String getServiceId() {
+        return serviceId;
+    }
+
+    /**
+     * <br>
+     *
+     * @param serviceId
+     * @since ONAP Amsterdam Release
+     */
+    public void setServiceId(String serviceId) {
+        this.serviceId = serviceId;
+    }
+
+    /**
+     * <br>
+     *
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    public String getOperationId() {
+        return operationId;
+    }
+
+    /**
+     * <br>
+     *
+     * @param operationId
+     * @since ONAP Amsterdam Release
+     */
+    public void setOperationId(String operationId) {
+        this.operationId = operationId;
+    }
+
+    /**
+     * @return Returns the nodeTemplateUUID.
+     */
+    public String getNodeTemplateUUID() {
+        return nodeTemplateUUID;
+    }
+
+    /**
+     * @param nodeTemplateUUID The nodeTemplateUUID to set.
+     */
+    public void setNodeTemplateUUID(String nodeTemplateUUID) {
+        this.nodeTemplateUUID = nodeTemplateUUID;
+    }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java
new file mode 100644 (file)
index 0000000..9d38fee
--- /dev/null
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel;
+
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class NsParameters {
+
+    private List<LocationConstraint> locationConstraints;
+
+    private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
+    /**
+     * @return Returns the locationConstraints.
+     */
+    public List<LocationConstraint> getLocationConstraints() {
+        return locationConstraints;
+    }
+
+    /**
+     * @param locationConstraints The locationConstraints to set.
+     */
+    public void setLocationConstraints(List<LocationConstraint> locationConstraints) {
+        this.locationConstraints = locationConstraints;
+    }
+
+
+    /**
+     * @return Returns the additionalParamForNs.
+     */
+    public Map<String, Object> getAdditionalParamForNs() {
+        return additionalParamForNs;
+    }
+
+
+    /**
+     * @param additionalParamForNs The additionalParamForNs to set.
+     */
+    public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) {
+        this.additionalParamForNs = additionalParamForNs;
+    }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java
new file mode 100644 (file)
index 0000000..bdc1619
--- /dev/null
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel;
+
+import java.util.List;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class NsScaleParameters {
+
+    private List<ScaleNsByStepsData> scaleNsByStepsData;
+
+    private String scaleType;
+
+
+    private String nsInstanceId;
+
+    /**
+     * @return Returns the scaleNsByStepsData.
+     */
+    public List<ScaleNsByStepsData> getScaleNsByStepsData() {
+        return scaleNsByStepsData;
+    }
+
+    /**
+     * @param scaleNsByStepsData The scaleNsByStepsData to set.
+     */
+    public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) {
+        this.scaleNsByStepsData = scaleNsByStepsData;
+    }
+
+    /**
+     * @return Returns the scale Type.
+     */
+    public String getScaleType() {
+        return scaleType;
+    }
+
+    /**
+     * @param scaleType The scaleType to set.
+     */
+    public void setScaleType(String scaleType) {
+        this.scaleType = scaleType;
+    }
+
+    public String getNsInstanceId() {
+        return nsInstanceId;
+    }
+
+    public void setNsInstanceId(String nsInstanceId) {
+        this.nsInstanceId = nsInstanceId;
+    }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java
new file mode 100644 (file)
index 0000000..a0798c8
--- /dev/null
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.bpmn.infrastructure.vfcmodel;
+
+
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class ScaleNsByStepsData {
+
+    /**
+     * scaling Direction
+     */
+    private String scalingDirection;
+
+    /**
+     * aspect ID
+     */
+    private String aspectId;
+
+    /**
+     * number of Steps
+     */
+    private int numberOfSteps;
+
+    /**
+     * @return Returns the scalingDirection.
+     */
+    public String getScalingDirection() {
+        return scalingDirection;
+    }
+
+    /**
+     * @param scalingDirection The scalingDirection to set.
+     */
+    public void setScalingDirection(String scalingDirection) {
+        this.scalingDirection = scalingDirection;
+    }
+
+    /**
+     * @return Returns the aspectId.
+     */
+    public String getAspectId() {
+        return aspectId;
+    }
+
+    /**
+     * @param aspectId The aspectId to set.
+     */
+    public void setAspectId(String aspectId) {
+        this.aspectId = aspectId;
+    }
+
+    /**
+     * @return Returns the numberofSteps.
+     */
+    public int getNumberOfSteps() {
+        return numberOfSteps;
+    }
+
+    /**
+     * @param numberOfSteps The numberofSteps to set.
+     */
+    public void setNumberOfSteps(int numberOfSteps) {
+        this.numberOfSteps = numberOfSteps;
+    }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java
new file mode 100644 (file)
index 0000000..02e42ea
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.vfcmodel;
+
+
+public class ScaleNsData {
+
+    private ScaleNsByStepsData scaleNsByStepsData;
+
+    public ScaleNsByStepsData getScaleNsByStepsData() {
+        return scaleNsByStepsData;
+    }
+
+    public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) {
+        this.scaleNsByStepsData = scaleNsByStepsData;
+    }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java
new file mode 100644 (file)
index 0000000..1f49b02
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.vfcmodel;
+
+
+public class ScaleResource {
+
+    private String resourceInstanceId;
+
+    private String scaleType;
+
+    private ScaleNsData scaleNsData;
+
+    public String getResourceInstanceId() {
+        return resourceInstanceId;
+    }
+
+    public void setResourceInstanceId(String resourceInstanceId) {
+        this.resourceInstanceId = resourceInstanceId;
+    }
+
+    public String getScaleType() {
+        return scaleType;
+    }
+
+    public void setScaleType(String scaleType) {
+        this.scaleType = scaleType;
+    }
+
+    public ScaleNsData getScaleNsData() {
+        return scaleNsData;
+    }
+
+    public void setScaleNsData(ScaleNsData scaleNsData) {
+        this.scaleNsData = scaleNsData;
+    }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java
new file mode 100644 (file)
index 0000000..67252b4
--- /dev/null
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.bpmn.infrastructure.vfcmodel;
+
+
+/**
+ *
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version     ONAP Amsterdam Release  2017-10-18
+ */
+public class VimLocation {
+    private String vimId;
+
+
+    /**
+     * @return Returns the vimId.
+     */
+    public String getVimId() {
+        return vimId;
+    }
+
+
+    /**
+     * @param vimId The vimId to set.
+     */
+    public void setVimId(String vimId) {
+        this.vimId = vimId;
+    }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn
new file mode 100644 (file)
index 0000000..4ce6462
--- /dev/null
@@ -0,0 +1,379 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+  <bpmn:process id="ScaleCustomE2EServiceInstance" name="ScaleCustomE2EServiceInstance" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Scale SI Start Flow">
+      <bpmn:outgoing>SequenceFlow_0c2denm</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Task_03ivdxi" name="Pre Process Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0c2denm</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ntnafv</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi= new ScaleCustomE2EServiceInstance()
+csi.preProcessRequest(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_0oezp57" name="Send Sync Ack Response" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_14zd9we</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0er6ddi</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new  ScaleCustomE2EServiceInstance()
+csi.sendSyncResponse(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_13jdprk" name="success ?">
+      <bpmn:incoming>SequenceFlow_1fis1j1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_06f0dx5</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_19b0pmt</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="Task_1ogtanl" name="Prepare Completion Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_06f0dx5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1q6spfu</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new ScaleCustomE2EServiceInstance()
+csi.prepareCompletionRequest(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Task_1p5x1em" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" />
+        <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" />
+        <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" />
+        <camunda:in source="CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1q6spfu</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0mm4eqd</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:endEvent id="EndEvent_116d9ds" name="End">
+      <bpmn:incoming>SequenceFlow_0mm4eqd</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0mm4eqd" sourceRef="Task_1p5x1em" targetRef="EndEvent_116d9ds" />
+    <bpmn:sequenceFlow id="SequenceFlow_0c2denm" sourceRef="StartEvent_1" targetRef="Task_03ivdxi" />
+    <bpmn:sequenceFlow id="SequenceFlow_1ntnafv" sourceRef="Task_03ivdxi" targetRef="Task_1rsd8qa" />
+    <bpmn:sequenceFlow id="SequenceFlow_0er6ddi" sourceRef="Task_0oezp57" targetRef="CallActivity_1vpyqzt" />
+    <bpmn:sequenceFlow id="SequenceFlow_06f0dx5" name="yes" sourceRef="ExclusiveGateway_13jdprk" targetRef="Task_1ogtanl">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" )  != null && execution.getVariable("jobId" )  != "" )}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_19b0pmt" name="no" sourceRef="ExclusiveGateway_13jdprk" targetRef="EndEvent_1sz49w7">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" )  == null || execution.getVariable("jobId" )  == "" )}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:endEvent id="EndEvent_1sz49w7">
+      <bpmn:incoming>SequenceFlow_19b0pmt</bpmn:incoming>
+      <bpmn:errorEventDefinition errorRef="Error_196t4z3" />
+    </bpmn:endEvent>
+    <bpmn:subProcess id="SubProcess_0bwngpt" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_0yncnrj">
+        <bpmn:outgoing>SequenceFlow_04f826i</bpmn:outgoing>
+        <bpmn:errorEventDefinition />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1lp2j7l">
+        <bpmn:incoming>SequenceFlow_1t2ijcu</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_01p0bqh" name="Prepare Fallout Request" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_09z92mf</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_1sooz22</bpmn:outgoing>
+        <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new ScaleCustomE2EServiceInstance()
+csi.prepareFalloutRequest(execution)]]></bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:scriptTask id="ScriptTask_1quc7x4" name="Send Error Response" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_04f826i</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_09z92mf</bpmn:outgoing>
+        <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new  ScaleCustomE2EServiceInstance()
+csi.sendSyncError(execution)]]></bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_04f826i" sourceRef="StartEvent_0yncnrj" targetRef="ScriptTask_1quc7x4" />
+      <bpmn:sequenceFlow id="SequenceFlow_09z92mf" sourceRef="ScriptTask_1quc7x4" targetRef="ScriptTask_01p0bqh" />
+      <bpmn:sequenceFlow id="SequenceFlow_1t2ijcu" sourceRef="CallActivity_0miglgb" targetRef="EndEvent_1lp2j7l" />
+      <bpmn:sequenceFlow id="SequenceFlow_1sooz22" sourceRef="ScriptTask_01p0bqh" targetRef="CallActivity_0miglgb" />
+      <bpmn:callActivity id="CallActivity_0miglgb" name="Call FalloutHandler" calledElement="FalloutHandler">
+        <bpmn:extensionElements>
+          <camunda:in source="falloutRequest" target="FalloutHandlerRequest" />
+          <camunda:in source="mso-request-id" target="mso-request-id" />
+          <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+          <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" />
+          <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" />
+          <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" />
+        </bpmn:extensionElements>
+        <bpmn:incoming>SequenceFlow_1sooz22</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_1t2ijcu</bpmn:outgoing>
+      </bpmn:callActivity>
+    </bpmn:subProcess>
+    <bpmn:subProcess id="SubProcess_10vzjzh" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+      <bpmn:scriptTask id="ScriptTask_1jgr212" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_0gna7ys</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_0re5dm7</bpmn:outgoing>
+        <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:startEvent id="StartEvent_1awfo4s">
+        <bpmn:outgoing>SequenceFlow_0gna7ys</bpmn:outgoing>
+        <bpmn:errorEventDefinition />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_04azej9">
+        <bpmn:incoming>SequenceFlow_0re5dm7</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:sequenceFlow id="SequenceFlow_0gna7ys" name="" sourceRef="StartEvent_1awfo4s" targetRef="ScriptTask_1jgr212" />
+      <bpmn:sequenceFlow id="SequenceFlow_0re5dm7" name="" sourceRef="ScriptTask_1jgr212" targetRef="EndEvent_04azej9" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="CallActivity_1vpyqzt" name="Call DoScaleE2EServiceInstance&#10;" calledElement="DoScaleE2EServiceInstance">
+      <bpmn:extensionElements>
+        <camunda:out source="jobId" target="jobId" />
+        <camunda:in source="bpmnRequest" target="bpmnRequest" />
+        <camunda:out source="operationId" target="operationId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+        <camunda:in source="serviceId" target="serviceId" />
+        <camunda:in source="serviceType" target="serviceType" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="requestDescription" target="requestDescription" />
+        <camunda:in source="operationId" target="operationId" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0er6ddi</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1fis1j1</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1fis1j1" sourceRef="CallActivity_1vpyqzt" targetRef="ExclusiveGateway_13jdprk" />
+    <bpmn:sequenceFlow id="SequenceFlow_1q6spfu" sourceRef="Task_1ogtanl" targetRef="Task_1p5x1em" />
+    <bpmn:sequenceFlow id="SequenceFlow_030pfun" sourceRef="Task_1rsd8qa" targetRef="Task_01n9mqa" />
+    <bpmn:scriptTask id="Task_1rsd8qa" name="Init Service Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1ntnafv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_030pfun</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi= new ScaleCustomE2EServiceInstance()
+csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_14zd9we" sourceRef="Task_01n9mqa" targetRef="Task_0oezp57" />
+    <bpmn:serviceTask id="Task_01n9mqa" name="Update Service Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_030pfun</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_14zd9we</bpmn:outgoing>
+    </bpmn:serviceTask>
+  </bpmn:process>
+  <bpmn:error id="Error_196t4z3" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ScaleCustomE2EServiceInstance">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="-13" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-28" y="138" width="67" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0nye5g4_di" bpmnElement="Task_03ivdxi">
+        <dc:Bounds x="87" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_08uouf4_di" bpmnElement="Task_0oezp57">
+        <dc:Bounds x="560" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_13jdprk_di" bpmnElement="ExclusiveGateway_13jdprk" isMarkerVisible="true">
+        <dc:Bounds x="928" y="95" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="927" y="73" width="51" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_11xceoj_di" bpmnElement="Task_1ogtanl">
+        <dc:Bounds x="1068" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_1qhplvz_di" bpmnElement="Task_1p5x1em">
+        <dc:Bounds x="1068" y="281" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_116d9ds_di" bpmnElement="EndEvent_116d9ds">
+        <dc:Bounds x="1100" y="554" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1109" y="594" width="19" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0mm4eqd_di" bpmnElement="SequenceFlow_0mm4eqd">
+        <di:waypoint xsi:type="dc:Point" x="1118" y="361" />
+        <di:waypoint xsi:type="dc:Point" x="1118" y="554" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="451.5" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0c2denm_di" bpmnElement="SequenceFlow_0c2denm">
+        <di:waypoint xsi:type="dc:Point" x="23" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="87" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="10" y="99" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ntnafv_di" bpmnElement="SequenceFlow_1ntnafv">
+        <di:waypoint xsi:type="dc:Point" x="187" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="249" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="173" y="99" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0er6ddi_di" bpmnElement="SequenceFlow_0er6ddi">
+        <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="729" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="649.5" y="99" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_06f0dx5_di" bpmnElement="SequenceFlow_06f0dx5">
+        <di:waypoint xsi:type="dc:Point" x="978" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="1068" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1014" y="99" width="19" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_19b0pmt_di" bpmnElement="SequenceFlow_19b0pmt">
+        <di:waypoint xsi:type="dc:Point" x="953" y="145" />
+        <di:waypoint xsi:type="dc:Point" x="953" y="232" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="962" y="183" width="12" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_00ekif2_di" bpmnElement="EndEvent_1sz49w7">
+        <dc:Bounds x="935" y="232" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="953" y="272" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_0bwngpt_di" bpmnElement="SubProcess_0bwngpt" isExpanded="true">
+        <dc:Bounds x="168" y="326" width="679" height="194" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_0yncnrj_di" bpmnElement="StartEvent_0yncnrj">
+        <dc:Bounds x="183" y="412" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="66" y="453" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1lp2j7l_di" bpmnElement="EndEvent_1lp2j7l">
+        <dc:Bounds x="762" y="412" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="645" y="453" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_01p0bqh_di" bpmnElement="ScriptTask_01p0bqh">
+        <dc:Bounds x="441" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0miglgb_di" bpmnElement="CallActivity_0miglgb">
+        <dc:Bounds x="618" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1quc7x4_di" bpmnElement="ScriptTask_1quc7x4">
+        <dc:Bounds x="263" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_04f826i_di" bpmnElement="SequenceFlow_04f826i">
+        <di:waypoint xsi:type="dc:Point" x="219" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="241" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="241" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="262" y="430" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="121" y="430" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_09z92mf_di" bpmnElement="SequenceFlow_09z92mf">
+        <di:waypoint xsi:type="dc:Point" x="363" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="390" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="390" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="441" y="430" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="270" y="430" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1t2ijcu_di" bpmnElement="SequenceFlow_1t2ijcu">
+        <di:waypoint xsi:type="dc:Point" x="718" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="762" y="430" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="605" y="415" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1sooz22_di" bpmnElement="SequenceFlow_1sooz22">
+        <di:waypoint xsi:type="dc:Point" x="541" y="430" />
+        <di:waypoint xsi:type="dc:Point" x="618" y="430" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="447" y="415" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="SubProcess_10vzjzh_di" bpmnElement="SubProcess_10vzjzh" isExpanded="true">
+        <dc:Bounds x="294" y="593" width="394" height="188" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1jgr212_di" bpmnElement="ScriptTask_1jgr212">
+        <dc:Bounds x="442" y="648" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_1awfo4s_di" bpmnElement="StartEvent_1awfo4s">
+        <dc:Bounds x="327" y="670" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="210" y="711" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_04azej9_di" bpmnElement="EndEvent_04azej9">
+        <dc:Bounds x="603" y="670" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="486" y="711" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0gna7ys_di" bpmnElement="SequenceFlow_0gna7ys">
+        <di:waypoint xsi:type="dc:Point" x="363" y="688" />
+        <di:waypoint xsi:type="dc:Point" x="442" y="688" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="272" y="688" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0re5dm7_di" bpmnElement="SequenceFlow_0re5dm7">
+        <di:waypoint xsi:type="dc:Point" x="542" y="688" />
+        <di:waypoint xsi:type="dc:Point" x="603" y="688" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="444" y="688" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_1vpyqzt_di" bpmnElement="CallActivity_1vpyqzt">
+        <dc:Bounds x="729" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fis1j1_di" bpmnElement="SequenceFlow_1fis1j1">
+        <di:waypoint xsi:type="dc:Point" x="829" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="928" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="878.5" y="99" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1q6spfu_di" bpmnElement="SequenceFlow_1q6spfu">
+        <di:waypoint xsi:type="dc:Point" x="1118" y="160" />
+        <di:waypoint xsi:type="dc:Point" x="1118" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="214.5" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_030pfun_di" bpmnElement="SequenceFlow_030pfun">
+        <di:waypoint xsi:type="dc:Point" x="349" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="393" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="371" y="99" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_16ll9yo_di" bpmnElement="Task_1rsd8qa">
+        <dc:Bounds x="249" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_14zd9we_di" bpmnElement="SequenceFlow_14zd9we">
+        <di:waypoint xsi:type="dc:Point" x="493" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="526.5" y="99" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1kpeoxt_di" bpmnElement="Task_01n9mqa">
+        <dc:Bounds x="393" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn
new file mode 100644 (file)
index 0000000..fbb52a9
--- /dev/null
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+  <bpmn:process id="DoScaleE2EServiceInstance" name="DoScaleE2EServiceInstance" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_08ndnk6" name="Start Flow">
+      <bpmn:outgoing>SequenceFlow_1fhno84</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="ScriptTask_16yrgke" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1fhno84</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_194bhkx</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def ddsi = new DoScaleE2EServiceInstance()
+ddsi.preProcessRequest(execution)
+]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:endEvent id="EndEvent_1f5ursk">
+      <bpmn:incoming>SequenceFlow_1yee730</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_0vmzliy" name="Prepare Resource Oper Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_194bhkx</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0b5p6gy</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def ddsi = new DoScaleE2EServiceInstance()
+ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="ServiceTask_17d588b" name="Init Resource Oper Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0b5p6gy</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0nqrq1k</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:callActivity id="CallActivity_1jkl1i3" name="Call Network Service Scale" calledElement="DoScaleVFCServiceInstance">
+      <bpmn:extensionElements>
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceType" target="serviceType" />
+        <camunda:in source="serviceId" target="serviceId" />
+        <camunda:in source="operationId" target="operationId" />
+        <camunda:in source="resouceTemplateUUID" target="resouceTemplateUUID" />
+        <camunda:in source="resouceInstanceId" target="resouceInstanceId" />
+        <camunda:in source="resourceType" target="resourceType" />
+        <camunda:in source="operationType" target="operationType" />
+        <camunda:in source="nsScaleParams" target="nsScaleParams" />
+        <camunda:in source="bpmnRequest" target="bpmnRequest" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+        <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="requestDescription" target="requestDescription" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0nqrq1k</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1yee730</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1fhno84" sourceRef="StartEvent_08ndnk6" targetRef="ScriptTask_16yrgke" />
+    <bpmn:sequenceFlow id="SequenceFlow_194bhkx" sourceRef="ScriptTask_16yrgke" targetRef="ScriptTask_0vmzliy" />
+    <bpmn:sequenceFlow id="SequenceFlow_1yee730" sourceRef="CallActivity_1jkl1i3" targetRef="EndEvent_1f5ursk" />
+    <bpmn:sequenceFlow id="SequenceFlow_0nqrq1k" sourceRef="ServiceTask_17d588b" targetRef="CallActivity_1jkl1i3" />
+    <bpmn:sequenceFlow id="SequenceFlow_0b5p6gy" sourceRef="ScriptTask_0vmzliy" targetRef="ServiceTask_17d588b" />
+    <bpmn:subProcess id="SubProcess_19qmltk" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_0581c7y">
+        <bpmn:outgoing>SequenceFlow_0yyws1p</bpmn:outgoing>
+        <bpmn:errorEventDefinition />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_0k146bt">
+        <bpmn:incoming>SequenceFlow_0i814ke</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_0l79kxj" name="Log / Print Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_0yyws1p</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_0i814ke</bpmn:outgoing>
+        <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_0yyws1p" name="" sourceRef="StartEvent_0581c7y" targetRef="ScriptTask_0l79kxj" />
+      <bpmn:sequenceFlow id="SequenceFlow_0i814ke" name="" sourceRef="ScriptTask_0l79kxj" targetRef="EndEvent_0k146bt" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleE2EServiceInstance">
+      <bpmndi:BPMNShape id="StartEvent_08ndnk6_di" bpmnElement="StartEvent_08ndnk6">
+        <dc:Bounds x="96" y="129" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="90" y="170" width="50" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_16yrgke_di" bpmnElement="ScriptTask_16yrgke">
+        <dc:Bounds x="189" y="107" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1f5ursk_di" bpmnElement="EndEvent_1f5ursk">
+        <dc:Bounds x="1016" y="279" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="899" y="320" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0vmzliy_di" bpmnElement="ScriptTask_0vmzliy">
+        <dc:Bounds x="436" y="107" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_17d588b_di" bpmnElement="ServiceTask_17d588b">
+        <dc:Bounds x="695" y="107" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_1jkl1i3_di" bpmnElement="CallActivity_1jkl1i3">
+        <dc:Bounds x="984" y="107" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fhno84_di" bpmnElement="SequenceFlow_1fhno84">
+        <di:waypoint xsi:type="dc:Point" x="132" y="147" />
+        <di:waypoint xsi:type="dc:Point" x="189" y="147" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="72" y="126" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_194bhkx_di" bpmnElement="SequenceFlow_194bhkx">
+        <di:waypoint xsi:type="dc:Point" x="289" y="147" />
+        <di:waypoint xsi:type="dc:Point" x="436" y="147" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="317.5" y="126" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1yee730_di" bpmnElement="SequenceFlow_1yee730">
+        <di:waypoint xsi:type="dc:Point" x="1033" y="187" />
+        <di:waypoint xsi:type="dc:Point" x="1034" y="279" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="988.5" y="212" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0nqrq1k_di" bpmnElement="SequenceFlow_0nqrq1k">
+        <di:waypoint xsi:type="dc:Point" x="795" y="147" />
+        <di:waypoint xsi:type="dc:Point" x="984" y="147" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="844.5" y="126" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0b5p6gy_di" bpmnElement="SequenceFlow_0b5p6gy">
+        <di:waypoint xsi:type="dc:Point" x="536" y="147" />
+        <di:waypoint xsi:type="dc:Point" x="695" y="147" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="570.5" y="126" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="SubProcess_19qmltk_di" bpmnElement="SubProcess_19qmltk" isExpanded="true">
+        <dc:Bounds x="132" y="351" width="467" height="193" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_0581c7y_di" bpmnElement="StartEvent_0581c7y">
+        <dc:Bounds x="201" y="419" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="84" y="460" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0k146bt_di" bpmnElement="EndEvent_0k146bt">
+        <dc:Bounds x="494" y="419" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="377" y="460" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0l79kxj_di" bpmnElement="ScriptTask_0l79kxj">
+        <dc:Bounds x="305" y="397" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0yyws1p_di" bpmnElement="SequenceFlow_0yyws1p">
+        <di:waypoint xsi:type="dc:Point" x="237" y="437" />
+        <di:waypoint xsi:type="dc:Point" x="305" y="437" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="136" y="422" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0i814ke_di" bpmnElement="SequenceFlow_0i814ke">
+        <di:waypoint xsi:type="dc:Point" x="405" y="437" />
+        <di:waypoint xsi:type="dc:Point" x="494" y="437" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="317" y="422" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn
new file mode 100644 (file)
index 0000000..7e8b63e
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+  <bpmn:process id="DoScaleVFCServiceInstance" name="DoScaleVFCServiceInstance" isExecutable="true">
+    <bpmn:startEvent id="scaleNS_StartEvent" name="scaleNS_StartEvent">
+      <bpmn:outgoing>SequenceFlow_00w1ntj</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="PreprocessIncomingRequest" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_00w1ntj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0izumqq</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoScaleVFCNetworkServiceInstance()
+dcsi.preProcessRequest(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_0ia872k" name="Scale Network Service" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0izumqq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0hzy01n</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoScaleVFCNetworkServiceInstance()
+dcsi.scaleNetworkService(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_00w1ntj" sourceRef="scaleNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+    <bpmn:sequenceFlow id="SequenceFlow_0izumqq" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0ia872k" />
+    <bpmn:endEvent id="EndEvent_1r0dxhy">
+      <bpmn:incoming>SequenceFlow_18hdal9</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_18hdal9" sourceRef="finishNSScale_Task" targetRef="EndEvent_1r0dxhy" />
+    <bpmn:scriptTask id="finishNSScale_Task" name="Finish NS Scale" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0hzy01n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_18hdal9</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoScaleVFCNetworkServiceInstance()
+dcsi.finishNSScale(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0hzy01n" sourceRef="Task_0ia872k" targetRef="finishNSScale_Task" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleVFCServiceInstance">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="scaleNS_StartEvent">
+        <dc:Bounds x="-33" y="182" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-56" y="218" width="83" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0fxwmkv_di" bpmnElement="PreprocessIncomingRequest_task">
+        <dc:Bounds x="117" y="160" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_14ppugf_di" bpmnElement="Task_0ia872k">
+        <dc:Bounds x="739" y="160" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_00w1ntj_di" bpmnElement="SequenceFlow_00w1ntj">
+        <di:waypoint xsi:type="dc:Point" x="3" y="200" />
+        <di:waypoint xsi:type="dc:Point" x="117" y="200" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="15" y="179" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0izumqq_di" bpmnElement="SequenceFlow_0izumqq">
+        <di:waypoint xsi:type="dc:Point" x="217" y="200" />
+        <di:waypoint xsi:type="dc:Point" x="739" y="200" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="433" y="179" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_1r0dxhy_di" bpmnElement="EndEvent_1r0dxhy">
+        <dc:Bounds x="771" y="676" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="744" y="716" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_18hdal9_di" bpmnElement="SequenceFlow_18hdal9">
+        <di:waypoint xsi:type="dc:Point" x="789" y="451" />
+        <di:waypoint xsi:type="dc:Point" x="789" y="676" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="759" y="557.5" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1elwlqc_di" bpmnElement="finishNSScale_Task">
+        <dc:Bounds x="739" y="371" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0hzy01n_di" bpmnElement="SequenceFlow_0hzy01n">
+        <di:waypoint xsi:type="dc:Point" x="789" y="240" />
+        <di:waypoint xsi:type="dc:Point" x="789" y="371" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="759" y="299.5" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 8c99d06..5c84e69 100644 (file)
@@ -37,5 +37,6 @@ public enum Action {
        removeRelationships,
        inPlaceSoftwareUpdate,
        applyUpdatedConfig,
-       compareModel
+       compareModel,
+       scaleInstance
 }
index 2e0b53d..2d0e9ee 100644 (file)
@@ -56,6 +56,7 @@ import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInsta
 import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;\r
 import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;\r
 import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;\r
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.*;\r
 import org.openecomp.mso.serviceinstancebeans.ModelInfo;\r
 import org.openecomp.mso.serviceinstancebeans.ModelType;\r
 import org.openecomp.mso.serviceinstancebeans.RequestDetails;\r
@@ -160,6 +161,23 @@ public class E2EServiceInstances {
                return getE2EServiceInstances(serviceId, operationId);\r
        }\r
        \r
+    /**\r
+        * Scale Requests for E2E Service scale Instance on a specified version \r
+     */\r
+        \r
+       @POST\r
+       @Path("/{version:[vV][3-5]}/{serviceId}/scale")\r
+       @Consumes(MediaType.APPLICATION_JSON)\r
+       @Produces(MediaType.APPLICATION_JSON)\r
+       @ApiOperation(value="Scale E2E Service Instance on a specified version",response=Response.class)\r
+       public Response scaleE2EServiceInstance(String request,\r
+                                            @PathParam("version") String version,\r
+                                            @PathParam("serviceId") String serviceId) {\r
+\r
+               msoLogger.debug("------------------scale begin------------------");\r
+               instanceIdMap.put("serviceId", serviceId);\r
+               return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version);\r
+       }\r
        /**\r
         * GET Requests for Comparing model of service instance with target version\r
         */\r
@@ -921,6 +939,174 @@ public class E2EServiceInstances {
                return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);\r
        }\r
 \r
+   private Response scaleE2EserviceInstances(String requestJSON,\r
+                                               Action action, HashMap<String, String> instanceIdMap, String version) {\r
+\r
+        String requestId = instanceIdMap.get("serviceId");\r
+        long startTime = System.currentTimeMillis();\r
+        msoLogger.debug("requestId is: " + requestId);\r
+               E2EServiceInstanceScaleRequest e2eScaleReq = null;\r
+\r
+        MsoRequest msoRequest = new MsoRequest(requestId);\r
+\r
+        ObjectMapper mapper = new ObjectMapper();\r
+        try {\r
+               e2eScaleReq = mapper.readValue(requestJSON,\r
+                                       E2EServiceInstanceScaleRequest.class);\r
+\r
+        } catch (Exception e) {\r
+\r
+            msoLogger.debug("Mapping of request to JSON object failed : ", e);\r
+            Response response = msoRequest.buildServiceErrorResponse(\r
+                    HttpStatus.SC_BAD_REQUEST,\r
+                    MsoException.ServiceException,\r
+                    "Mapping of request to JSON object failed.  "\r
+                            + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,\r
+                    null);\r
+            msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,\r
+                    MSO_PROP_APIHANDLER_INFRA, "", "",\r
+                    MsoLogger.ErrorCode.SchemaError, requestJSON, e);\r
+            msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+                    MsoLogger.ResponseCode.SchemaError,\r
+                    "Mapping of request to JSON object failed");\r
+            msoLogger.debug("End of the transaction, the final response is: "\r
+                    + (String) response.getEntity());\r
+            createOperationStatusRecordForError(action, requestId);\r
+            return response;\r
+        }\r
+\r
+        CatalogDatabase db = null;\r
+        RecipeLookupResult recipeLookupResult = null;\r
+        try {\r
+            db = CatalogDatabase.getInstance();\r
+                       //TODO  Get the service template model version uuid from AAI.\r
+                       recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action);\r
+        } catch (Exception e) {\r
+            msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,\r
+                    MSO_PROP_APIHANDLER_INFRA, "", "",\r
+                    MsoLogger.ErrorCode.AvailabilityError,\r
+                    "Exception while communciate with Catalog DB", e);\r
+            msoRequest\r
+                    .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);\r
+            Response response = msoRequest.buildServiceErrorResponse(\r
+                    HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,\r
+                    "No communication to catalog DB " + e.getMessage(),\r
+                    ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);\r
+            alarmLogger.sendAlarm("MsoDatabaseAccessError",\r
+                    MsoAlarmLogger.CRITICAL, Messages.errors\r
+                            .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));\r
+            msoRequest.createRequestRecord(Status.FAILED, action);\r
+            msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+                    MsoLogger.ResponseCode.DBAccessError,\r
+                    "Exception while communciate with DB");\r
+            msoLogger.debug(END_OF_THE_TRANSACTION\r
+                    + (String) response.getEntity());\r
+            return response;\r
+        } finally {\r
+            closeCatalogDB(db);\r
+        }\r
+        if (recipeLookupResult == null) {\r
+            msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,\r
+                    MSO_PROP_APIHANDLER_INFRA, "", "",\r
+                    MsoLogger.ErrorCode.DataError, "No recipe found in DB");\r
+            msoRequest\r
+                    .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);\r
+            Response response = msoRequest.buildServiceErrorResponse(\r
+                    HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,\r
+                    "Recipe does not exist in catalog DB",\r
+                    ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);\r
+            msoRequest.createRequestRecord(Status.FAILED, action);\r
+            msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+                    MsoLogger.ResponseCode.DataNotFound,\r
+                    "No recipe found in DB");\r
+            msoLogger.debug(END_OF_THE_TRANSACTION\r
+                    + (String) response.getEntity());\r
+            createOperationStatusRecordForError(action, requestId);\r
+            return response;\r
+        }\r
+\r
+        RequestClient requestClient = null;\r
+        HttpResponse response = null;\r
+\r
+        long subStartTime = System.currentTimeMillis();\r
+        // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);\r
+\r
+        try {\r
+            requestClient = RequestClientFactory.getRequestClient(\r
+                    recipeLookupResult.getOrchestrationURI(),\r
+                    MsoPropertiesUtils.loadMsoProperties());\r
+\r
+            JSONObject jjo = new JSONObject(requestJSON);\r
+            jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));\r
+\r
+            String bpmnRequest = jjo.toString();\r
+\r
+            // Capture audit event\r
+            msoLogger\r
+                    .debug("MSO API Handler Posting call to BPEL engine for url: "\r
+                            + requestClient.getUrl());\r
+            String serviceId = instanceIdMap.get("serviceId");\r
+            String serviceInstanceType = e2eScaleReq.getService().getServiceType();\r
+            response = requestClient.post(requestId, false,\r
+                                       recipeLookupResult.getRecipeTimeout(), action.name(),\r
+                                       serviceId, null, null, null, null, null, serviceInstanceType,\r
+                                       null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());\r
+\r
+            msoLogger.recordMetricEvent(subStartTime,\r
+                    MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,\r
+                    "Successfully received response from BPMN engine", "BPMN",\r
+                    recipeLookupResult.getOrchestrationURI(), null);\r
+        } catch (Exception e) {\r
+            msoLogger.recordMetricEvent(subStartTime,\r
+                    MsoLogger.StatusCode.ERROR,\r
+                    MsoLogger.ResponseCode.CommunicationError,\r
+                    "Exception while communicate with BPMN engine", "BPMN",\r
+                    recipeLookupResult.getOrchestrationURI(), null);\r
+            Response resp = msoRequest.buildServiceErrorResponse(\r
+                    HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,\r
+                    "Failed calling bpmn " + e.getMessage(),\r
+                    ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);\r
+            alarmLogger.sendAlarm("MsoConfigurationError",\r
+                    MsoAlarmLogger.CRITICAL,\r
+                    Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));\r
+            msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,\r
+                    MSO_PROP_APIHANDLER_INFRA, "", "",\r
+                    MsoLogger.ErrorCode.AvailabilityError,\r
+                    "Exception while communicate with BPMN engine");\r
+            msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+                    MsoLogger.ResponseCode.CommunicationError,\r
+                    "Exception while communicate with BPMN engine");\r
+            msoLogger.debug("End of the transaction, the final response is: "\r
+                    + (String) resp.getEntity());\r
+            createOperationStatusRecordForError(action, requestId);\r
+            return resp;\r
+        }\r
+\r
+        if (response == null) {\r
+            Response resp = msoRequest.buildServiceErrorResponse(\r
+                    HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,\r
+                    "bpelResponse is null",\r
+                    ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);\r
+            msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,\r
+                    MSO_PROP_APIHANDLER_INFRA, "", "",\r
+                    MsoLogger.ErrorCode.BusinessProcesssError,\r
+                    "Null response from BPEL");\r
+            msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+                    MsoLogger.ResponseCode.InternalError,\r
+                    "Null response from BPMN");\r
+            msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());\r
+            createOperationStatusRecordForError(action, requestId);\r
+            return resp;\r
+        }\r
+\r
+        ResponseHandler respHandler = new ResponseHandler(response,\r
+                requestClient.getType());\r
+        int bpelStatus = respHandler.getStatus();\r
+\r
+        return beplStatusUpdate(requestId, startTime, msoRequest,\r
+                requestClient, respHandler, bpelStatus, action, instanceIdMap);\r
+    }\r
+\r
        private void closeCatalogDB(CatalogDatabase db) {\r
                if (db != null) {\r
                        db.close();\r
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java
new file mode 100644 (file)
index 0000000..b8bd810
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+
+public class E2EServiceInstanceScaleRequest {
+
+    private ScaleService service;
+
+    public ScaleService getService() {
+        return service;
+    }
+
+    public void setService(ScaleService service) {
+        this.service = service;
+    }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java
new file mode 100644 (file)
index 0000000..c64f5fa
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+public class ScaleNsByStepsData {
+
+    private String aspectId;
+
+    private Integer numberOfSteps;
+
+    private String scalingDirection;
+
+    public String getAspectId() {
+        return aspectId;
+    }
+
+    public void setAspectId(String aspectId) {
+        this.aspectId = aspectId;
+    }
+
+    public Integer getNumberOfSteps() {
+        return numberOfSteps;
+    }
+
+    public void setNumberOfSteps(Integer numberOfSteps) {
+        this.numberOfSteps = numberOfSteps;
+    }
+
+    public String getScalingDirection() {
+        return scalingDirection;
+    }
+
+    public void setScalingDirection(String scalingDirection) {
+        this.scalingDirection = scalingDirection;
+    }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java
new file mode 100644 (file)
index 0000000..49cfe75
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+public class ScaleNsData {
+
+    private ScaleNsByStepsData scaleNsByStepsData;
+
+    public ScaleNsByStepsData getScaleNsByStepsData() {
+        return scaleNsByStepsData;
+    }
+
+    public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) {
+        this.scaleNsByStepsData = scaleNsByStepsData;
+    }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java
new file mode 100644 (file)
index 0000000..f19e2bd
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+public class ScaleResource {
+
+    private String resourceInstanceId;
+
+    private String scaleType;
+
+    private ScaleNsData scaleNsData;
+
+    public String getResourceInstanceId() {
+        return resourceInstanceId;
+    }
+
+    public void setResourceInstanceId(String resourceInstanceId) {
+        this.resourceInstanceId = resourceInstanceId;
+    }
+
+    public String getScaleType() {
+        return scaleType;
+    }
+
+    public void setScaleType(String scaleType) {
+        this.scaleType = scaleType;
+    }
+
+    public ScaleNsData getScaleNsData() {
+        return scaleNsData;
+    }
+
+    public void setScaleNsData(ScaleNsData scaleNsData) {
+        this.scaleNsData = scaleNsData;
+    }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java
new file mode 100644 (file)
index 0000000..c694f55
--- /dev/null
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.List;
+
+public class ScaleService {
+
+    private String serviceInstanceName;
+
+    private String serviceType;
+
+    private String globalSubscriberId;
+
+    private List<ScaleResource> resources;
+
+    public String getServiceInstanceName() {
+        return serviceInstanceName;
+    }
+
+    public void setServiceInstanceName(String serviceInstanceName) {
+        this.serviceInstanceName = serviceInstanceName;
+    }
+
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    public String getGlobalSubscriberId() {
+        return globalSubscriberId;
+    }
+
+    public void setGlobalSubscriberId(String globalSubscriberId) {
+        this.globalSubscriberId = globalSubscriberId;
+    }
+
+    public List<ScaleResource> getResources() {
+        return resources;
+    }
+
+    public void setResources(List<ScaleResource> resources) {
+        this.resources = resources;
+    }
+}