conflict process 09/61509/1
authorYulian Han <elaine.hanyulian@huawei.com>
Tue, 21 Aug 2018 08:33:03 +0000 (16:33 +0800)
committerYulian Han <elaine.hanyulian@huawei.com>
Tue, 21 Aug 2018 08:35:35 +0000 (16:35 +0800)
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa60000016
Issue-ID: SO-683
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn

index 4939173..5922ad1 100644 (file)
@@ -42,9 +42,11 @@ import org.onap.so.client.aai.AAIObjectType
 import org.onap.so.client.aai.AAIResourcesClient
 import org.onap.so.client.aai.entities.AAIResultWrapper
 import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
 import org.onap.so.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse
 import org.springframework.web.util.UriUtils;
 
 import groovy.json.*
@@ -331,6 +333,37 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
        }
 
 
+       public void saveServiceInputToAAI(DelegateExecution execution) {
+               AaiUtil aaiUriUtil = new AaiUtil(this)
+
+               // create url for AAI requestInput
+               String aai_uri = aaiUriUtil.getAAIServiceInstanceUri(execution)
+               String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+
+               String serviceInstanceId = execution.getVariable("serviceInstanceId")
+               String serviceInstanceName = execution.getVariable("serviceInstanceName")
+               String serviceType = execution.getVariable("serviceType")
+               String uuiRequest = execution.getVariable("uuiRequest")
+
+               String payload =
+                               """< xmlns=\"${namespace}\">
+                                       <service-instance>
+                                               <service-instance-id>${serviceInstanceId}</service-instance-id>
+                                               <service-instance-name>${serviceInstanceName}</service-instance-name>
+                                               <service-type>${serviceType}</service-type>
+                                       <customer-request>${uuiRequest}</customer-request>
+                                       </service-instance>""".trim()
+               utils.logAudit(payload)
+
+               String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+               String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(serviceInstanceId,"UTF-8")
+
+               APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload)
+               int responseCode = response.getStatusCode()
+               execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode)
+       }
+
+
        public void postProcessAAIGET2(DelegateExecution execution) {
                msoLogger.trace("postProcessAAIGET2 ")
                String msg = ""
@@ -469,15 +502,25 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
        // if site location is in local Operator, create all resources in local ONAP; 
        // if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
        public void doProcessSiteLocation(DelegateExecution execution){
-
                msoLogger.trace("======== Start doProcessSiteLocation Process ======== ")
                ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
                String uuiRequest = execution.getVariable("uuiRequest")
-               ServiceDecomposition serviceDecompositionforLocal = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
-               execution.setVariable("serviceDecomposition", serviceDecompositionforLocal)
+               uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
+               execution.setVariable("uuiRequest", uuiRequest)
+               execution.setVariable("serviceDecomposition", serviceDecomposition)
                
                msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ")
        }
+       
+       // Allocate cross link TPs(terminal points) for sotn network only
+       public void doTPResourcesAllocation(DelegateExecution execution){
+               msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ")
+               ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+               String uuiRequest = execution.getVariable("uuiRequest")
+               uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest);
+               execution.setVariable("uuiRequest", uuiRequest)
+               msoLogger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
+       }
 
        // prepare input param for using DoCreateResources.bpmn
        public void preProcessForAddResource(DelegateExecution execution) {
index 7226feb..a6bdb59 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.so.bpmn.infrastructure.workflow.service;
 
-import org.json.JSONObject;
 import java.io.IOException;
 import java.net.SocketTimeoutException;
 import java.util.ArrayList;
@@ -43,6 +42,7 @@ import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.util.EntityUtils;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.runtime.Execution;
 import org.onap.so.bpmn.core.UrnPropertiesReader;
 import org.onap.so.bpmn.core.domain.ServiceDecomposition;
@@ -50,9 +50,7 @@ import org.onap.so.bpmn.core.domain.Resource;
 import org.onap.so.bpmn.core.json.JsonUtils;
 import org.onap.so.logger.MessageEnum;
 import org.onap.so.logger.MsoLogger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-
+import org.onap.so.bpmn.common.scripts.AaiUtil;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
@@ -60,17 +58,17 @@ import com.fasterxml.jackson.databind.SerializationFeature;
 public class ServicePluginFactory {
 
        // SOTN calculate route
-       public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc";
+       public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc";
 
-       public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
+       public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
        
-       public static final String Inventory_OSS_Default_EndPoint = "http://192.168.1.199:8443/oss/inventory";
+       public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
 
        private static final int DEFAULT_TIME_OUT = 60000;
 
        static JsonUtils jsonUtil = new JsonUtils();
 
-       private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class);
+       private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ServicePluginFactory.class);
 
        private static ServicePluginFactory instance;
        
@@ -81,76 +79,230 @@ public class ServicePluginFactory {
                }
                return instance;
        }
-
-       private ServicePluginFactory() {
-
-       }
-
        
        private String getInventoryOSSEndPoint(){
-               return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", Inventory_OSS_Default_EndPoint);
+               return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT);
        }
+       
        private String getThirdSPEndPoint(){
-               return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint);
+               return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT);
        }
 
        private String getOOFCalcEndPoint(){
-               return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint);
+               return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT);
        }
+
+       @SuppressWarnings("unchecked")
+       public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+               if(!isNeedProcessSite(uuiRequest)) {
+                       return uuiRequest;
+               }
        
-       public ServiceDecomposition doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {               
-               ServiceDecomposition serviceDecompositionforLocal = serviceDecomposition;
+               Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+               Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+               Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+               Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+               List<Object> resources = (List<Object>) serviceParametersObject.get("resources");       
 
-               if (isSiteLocationLocal(serviceDecomposition, uuiRequest)) {
-                       return serviceDecomposition;
+               if (isSiteLocationLocal(serviceRequestInputs, resources)) {
+                       // resources changed : added TP info 
+                       String newRequest = getJsonString(uuiObject);
+                       return newRequest;
                }
 
                List<Resource> addResourceList = serviceDecomposition.getServiceResources();
                for (Resource resource : addResourceList) {
                        String resourcemodelName = resource.getModelInfo().getModelName();
-                       if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")) {
-                               serviceDecompositionforLocal.deleteResource(resource);
+                       if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner") 
+                                       || !StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
+                               // change serviceDecomposition
+                               serviceDecomposition.deleteResource(resource);
                                break;
                        }
-                       if (!StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
-                               serviceDecompositionforLocal.deleteResource(resource);
+               }
+
+               return uuiRequest;
+       }
+
+       private boolean isNeedProcessSite(String uuiRequest) {
+               return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
+       }
+
+       @SuppressWarnings("unchecked")
+       private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {         
+       Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);    
+                       
+               if(tpInfoMap.isEmpty()) {
+                       return true;
+               }
+               String host = (String) tpInfoMap.get("host");
+               // host is empty means TP is in local, not empty means TP is in remote ONAP
+               if (!host.isEmpty()) {
+                       return false;
+               }
+               
+               Map<String, Object> accessTPInfo = new HashMap<String, Object>();
+               accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
+               accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
+               accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
+               accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
+               accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+               // change resources
+               String resourceName = (String) accessTPInfo.get("resourceName");
+               for(Object curResource : resources) {
+                       Map<String, Object> resource = (Map<String, Object>)curResource;
+                       String curResourceName = (String) resource.get("resourceName");
+                       curResourceName = curResourceName.replaceAll(" ", "");
+                       if(resourceName.equalsIgnoreCase(curResourceName)) { 
+                               putResourceRequestInputs(resource, accessTPInfo);
                                break;
                        }
                }
 
-               return serviceDecompositionforLocal;
+               return true;
        }
+       
+       @SuppressWarnings("unchecked")
+       private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
+               Object location = "";
+               Object clientSignal = "";
+               String vpnAttachmentResourceName = "";
 
-       public boolean isSiteLocationLocal(ServiceDecomposition serviceDecomposition, String uuiRequest) {
-        boolean isSiteLocationLocal = true;
-
-        String serviceModelName = serviceDecomposition.getModelInfo().getModelName();
-        String serviceParameters = JsonUtils.getJsonValue(uuiRequest, "service.parameters");
-       String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs");
-       JSONObject inputParameters = new JSONObject(requestInputs);
-       
-       if(StringUtils.containsIgnoreCase(serviceModelName, "site") && inputParameters.has("location"))
-               {
-                       Object location  = inputParameters.get("location");
-                       JSONObject locationObj = new JSONObject(location);
-                       String locationONAP = queryLocationFromInventoryOSS(locationObj);
-                       if(StringUtils.containsIgnoreCase(locationONAP, "remote")) {
-                               isSiteLocationLocal = false;
+               // support R2 uuiReq and R1 uuiReq
+               // logic for R2 uuiRequest params in service level
+               for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+                       String key = entry.getKey();
+                       if (key.toLowerCase().contains("site_address")) {                               
+                               location = entry.getValue();
+                       } 
+                       if (key.toLowerCase().contains("sotncondition_clientsignal")) {                         
+                               clientSignal = entry.getValue();
+                               vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
                        }
                }
 
-               return isSiteLocationLocal;
+               Map<String, Object> tpInfoMap =  new HashMap<String, Object>();
+               
+               // Site resource has location param and SOTNAttachment resource has clientSignal param
+               if("".equals(location) || "".equals(clientSignal) ) {
+                       return tpInfoMap;
+               }
+               
+               // Query terminal points from InventoryOSS system by location.          
+               String locationAddress = (String) location;             
+               List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
+               if(locationTPList != null && !locationTPList.isEmpty()) {
+                       tpInfoMap = (Map<String, Object>) locationTPList.get(0);
+                       // add resourceName
+                       tpInfoMap.put("resourceName", vpnAttachmentResourceName);
+                       LOGGER.debug("Get Terminal TP from InventoryOSS");
+                       return tpInfoMap;
+               }
+               
+               return tpInfoMap;
        }
        
-       private String queryLocationFromInventoryOSS(JSONObject locationObj) {
-               String reqContent = getJsonString(locationObj);
+       @SuppressWarnings("unchecked")
+       private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
+               Map<String, String> locationSrc = new HashMap<String, String>();
+               locationSrc.put("location", locationAddress);
+               String reqContent = getJsonString(locationSrc);
                String url = getInventoryOSSEndPoint();
                String responseContent = sendRequest(url, "POST", reqContent);
-               String locationONAP = "";
+               List<Object> accessTPs = new ArrayList<Object>();
                if (null != responseContent) {
-                       locationONAP = getJsonObject(responseContent, String.class);
+                       accessTPs = getJsonObject(responseContent, List.class);
+               }
+               return accessTPs;
+       }
+       
+       @SuppressWarnings("unchecked")
+       private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
+               Map<String, Object> resourceParametersObject = new HashMap<String, Object>();
+               Map<String, Object> resourceRequestInputs = new HashMap<String, Object>();
+               resourceRequestInputs.put("requestInputs", resourceInputs);
+               resourceParametersObject.put("parameters", resourceRequestInputs);
+
+               if(resource.containsKey("parameters")) {
+                       Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
+                       if(resParametersObject.containsKey("requestInputs")) {
+                               Map<String, Object> resRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
+                               resRequestInputs.putAll(resourceInputs);                                
+                       }
+                       else {
+                               resParametersObject.putAll(resourceRequestInputs);                              
+                       }
                }
-               return locationONAP;
+               else {
+                       resource.putAll(resourceParametersObject);
+               }
+
+               return;
+       }
+       
+
+       
+       @SuppressWarnings("unchecked")
+       public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {         
+               Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+               Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+               Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+               Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+               
+               if(!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
+                       return uuiRequest;
+               }
+               
+               allocateCrossTPResources(execution, serviceRequestInputs);
+               String newRequest = getJsonString(uuiObject);
+               return newRequest;
+       }
+
+       @SuppressWarnings("unchecked")
+       private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
+               if(serviceRequestInputs.containsKey("CallSource"))
+               {
+                       String callSource = (String) serviceRequestInputs.get("CallSource");
+                       if("ExternalAPI".equalsIgnoreCase(callSource)) {
+                               return false;
+                       }                                                       
+               }                               
+               return true;
+       }
+       
+       @SuppressWarnings("unchecked")
+       private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
+
+               AaiUtil aai = new AaiUtil(null);
+               Map<String, Object> crossTPs = aai.getTPsfromAAI(execution);
+               
+               if(crossTPs == null || crossTPs.isEmpty()) {
+                       serviceRequestInputs.put("local-access-provider-id", "");
+                       serviceRequestInputs.put("local-access-client-id", "");
+                       serviceRequestInputs.put("local-access-topology-id", "");
+                       serviceRequestInputs.put("local-access-node-id", "");
+                       serviceRequestInputs.put("local-access-ltp-id", "");
+                       serviceRequestInputs.put("remote-access-provider-id", "");
+                       serviceRequestInputs.put("remote-access-client-id", "");
+                       serviceRequestInputs.put("remote-access-topology-id", "");
+                       serviceRequestInputs.put("remote-access-node-id", "");
+                       serviceRequestInputs.put("remote-access-ltp-id", "");                   
+               }
+               else {
+                       serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
+                       serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
+                       serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
+                       serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
+                       serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
+                       serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
+                       serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
+                       serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
+                       serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
+                       serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
+               }
+               
+               return;
        }
 
        public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
@@ -211,8 +363,7 @@ public class ServicePluginFactory {
                for (Object resource : resources) {
                        Map<String, Object> resourceObject = (Map<String, Object>) resource;
                        Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
-                       Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
-                                       .get("requestInputs");
+                       Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
                        for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
                                if (entry.getKey().toLowerCase().contains("location")) {
                                        if ("".equals(srcLocation)) {
@@ -258,14 +409,14 @@ public class ServicePluginFactory {
        }
 
        private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
-               Map<String, String> locationSrc = new HashMap<>();
+               Map<String, String> locationSrc = new HashMap<String, String>();
                locationSrc.put("location", srcLocation);
-               Map<String, String> locationDst = new HashMap<>();
+               Map<String, String> locationDst = new HashMap<String, String>();
                locationDst.put("location", dstLocation);
-               List<Map<String, String>> locations = new ArrayList<>();
+               List<Map<String, String>> locations = new ArrayList<Map<String, String>>();
                locations.add(locationSrc);
                locations.add(locationDst);
-               List<Object> returnList = new ArrayList<>();
+               List<Object> returnList = new ArrayList<Object>();
                String reqContent = getJsonString(locations);
                String url = getThirdSPEndPoint();
                String responseContent = sendRequest(url, "POST", reqContent);
@@ -275,12 +426,12 @@ public class ServicePluginFactory {
                return returnList;
        }
 
+       @SuppressWarnings("unchecked")
        private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
                for (Object resource : resources) {
                        Map<String, Object> resourceObject = (Map<String, Object>) resource;
                        Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
-                       Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
-                                       .get("requestInputs");
+                       Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
                        for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
                                if (entry.getKey().toLowerCase().contains("vpntype")) {
                                        return resourceRequestInputs;
@@ -307,7 +458,7 @@ public class ServicePluginFactory {
                Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
                Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
                Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
-               Map<String, Object> oofQueryObject = new HashMap<>();
+               Map<String, Object> oofQueryObject = new HashMap<String, Object>();
                List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
                oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id"));
                oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id"));
@@ -323,7 +474,7 @@ public class ServicePluginFactory {
                String url = getOOFCalcEndPoint();
                String responseContent = sendRequest(url, "POST", oofRequestReq);
 
-               List<Object> returnList = new ArrayList<>();
+               List<Object> returnList = new ArrayList<Object>();
                if (null != responseContent) {
                        returnList = getJsonObject(responseContent, List.class);
                }
@@ -336,7 +487,7 @@ public class ServicePluginFactory {
        }
        
        private Map<String, Object> getReturnRoute(List<Object> returnList){
-               Map<String, Object> returnRoute = new HashMap<>();
+               Map<String, Object> returnRoute = new HashMap<String,Object>();
                for(Object returnVpn :returnList){
                        Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn;
                    String accessTopoId = (String)returnVpnInfo.get("access-topology-id");
index 0b890d8..0dc5707 100644 (file)
@@ -76,7 +76,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" />
     <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_1m2tm19</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1qctzm0</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
 def ddsi = new DoCreateE2EServiceInstance()
@@ -102,7 +102,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
         </camunda:connector>
       </bpmn2:extensionElements>
       <bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_13xfsff</bpmn2:outgoing>
+      <bpmn2:outgoing>SequenceFlow_0bfwj4y</bpmn2:outgoing>
     </bpmn2:serviceTask>
     <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service">
       <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming>
@@ -147,10 +147,10 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_1qiiycn" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" />
     <bpmn2:sequenceFlow id="SequenceFlow_166w91p" sourceRef="IntermediateCatchEvent_0tv85pg" targetRef="ScriptTask_1cllqk3" />
     <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_16okck2" name="GoTo StartPrepareResource">
-      <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_15d8lqu</bpmn2:incoming>
       <bpmn2:linkEventDefinition name="StartPrepareResource" />
     </bpmn2:intermediateThrowEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="IntermediateThrowEvent_16okck2" />
+    <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="ScriptTask_08yiqtu" />
     <bpmn2:sequenceFlow id="SequenceFlow_0w9t6tc" sourceRef="preProcessRequest_ScriptTask" targetRef="IntermediateThrowEvent_0bq4fxs" />
     <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0jrb3xu" name="StartService">
       <bpmn2:outgoing>SequenceFlow_1i7t9hq</bpmn2:outgoing>
@@ -158,16 +158,10 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script>
     </bpmn2:intermediateCatchEvent>
     <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EPutService" />
     <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
-      <bpmn2:outgoing>SequenceFlow_1m2tm19</bpmn2:outgoing>
+      <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing>
       <bpmn2:linkEventDefinition name="StartPrepareResource" />
     </bpmn2:intermediateCatchEvent>
-    <bpmn2:scriptTask id="Task_0ush1g4" name="Process Site Location" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_0y3i2k7</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi= new DoCreateE2EServiceInstance()
-dcsi.doProcessSiteLocation(execution)]]></bpmn2:script>
-    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" />
     <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResourcesV3">
       <bpmn2:extensionElements>
         <camunda:in source="nsServiceName" target="nsServiceName" />
@@ -190,7 +184,7 @@ dcsi.doProcessSiteLocation(execution)]]></bpmn2:script>
       <bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing>
     </bpmn2:callActivity>
     <bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_0y3i2k7</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0p6ba92</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
 def csi = new  DoCreateE2EServiceInstance()
@@ -203,7 +197,6 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script>
 def csi = new  DoCreateE2EServiceInstance()
 csi.postProcessForAddResource(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="Task_0ush1g4" />
     <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" />
     <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" />
     <bpmn2:endEvent id="EndEvent_0hzmoug">
@@ -211,8 +204,31 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
     </bpmn2:endEvent>
     <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" />
     <bpmn2:sequenceFlow id="SequenceFlow_012h7yx" sourceRef="ScriptTask_1o01d7d" targetRef="IntermediateThrowEvent_1mlbhmt" />
-    <bpmn2:sequenceFlow id="SequenceFlow_1m2tm19" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" />
-    <bpmn2:sequenceFlow id="SequenceFlow_0y3i2k7" sourceRef="Task_0ush1g4" targetRef="ScriptTask_04b21gb" />
+    <bpmn2:scriptTask id="ScriptTask_0dpt36a" name="Process Site Location" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_0bfwj4y</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1e5vxox</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi= new DoCreateE2EServiceInstance()
+dcsi.doProcessSiteLocation(execution)]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:scriptTask id="ScriptTask_1a5mdd6" name="Process Link TP Resource Allocation" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_1e5vxox</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_0p6ba92</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi= new DoCreateE2EServiceInstance()
+dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_1e5vxox" sourceRef="ScriptTask_0dpt36a" targetRef="ScriptTask_1a5mdd6" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0bfwj4y" sourceRef="Task_0raqlqc" targetRef="ScriptTask_0dpt36a" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0p6ba92" sourceRef="ScriptTask_1a5mdd6" targetRef="ScriptTask_04b21gb" />
+    <bpmn2:scriptTask id="ScriptTask_08yiqtu" name="Store ServiceInput to AAI" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_15d8lqu</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def ddsi = new DoCreateE2EServiceInstance()
+ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_15d8lqu" sourceRef="ScriptTask_08yiqtu" targetRef="IntermediateThrowEvent_16okck2" />
   </bpmn2:process>
   <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
@@ -228,15 +244,13 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
         <dc:Bounds x="126" y="-229" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService">
-        <dc:Bounds x="713" y="54" width="100" height="80" />
+        <dc:Bounds x="478" y="54" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_129ih1g_di" bpmnElement="SequenceFlow_129ih1g">
-        <di:waypoint xsi:type="dc:Point" x="813" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="941" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="941" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="1068" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="578" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="713" y="94" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="911" y="94" width="90" height="0" />
+          <dc:Bounds x="600.5" y="79" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true">
@@ -272,7 +286,7 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9">
-        <dc:Bounds x="1068" y="54" width="100" height="80" />
+        <dc:Bounds x="713" y="54" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux">
         <dc:Bounds x="246" y="920" width="100" height="80" />
@@ -298,16 +312,16 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0">
         <di:waypoint xsi:type="dc:Point" x="226" y="300" />
-        <di:waypoint xsi:type="dc:Point" x="337" y="300" />
+        <di:waypoint xsi:type="dc:Point" x="297" y="300" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="236.5" y="279" width="90" height="12" />
+          <dc:Bounds x="216.5" y="279" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0v81r5h_di" bpmnElement="Task_0uiekmn">
         <dc:Bounds x="126" y="260" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc">
-        <dc:Bounds x="337" y="260" width="100" height="80" />
+        <dc:Bounds x="297" y="260" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs">
         <dc:Bounds x="1315" y="-207" width="36" height="36" />
@@ -371,12 +385,10 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3">
-        <di:waypoint xsi:type="dc:Point" x="1168" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="1242" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="1242" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="1315" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="813" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="991" y="94" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1257" y="88" width="0" height="12" />
+          <dc:Bounds x="857" y="73" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc">
@@ -389,19 +401,18 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_0jrb3xu_di" bpmnElement="IntermediateCatchEvent_0jrb3xu">
-        <dc:Bounds x="18" y="79" width="36" height="36" />
+        <dc:Bounds x="18" y="76" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="8" y="115" width="60" height="12" />
+          <dc:Bounds x="8" y="112" width="60" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1i7t9hq_di" bpmnElement="SequenceFlow_1i7t9hq">
-        <di:waypoint xsi:type="dc:Point" x="54" y="97" />
-        <di:waypoint xsi:type="dc:Point" x="528" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="646" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="646" y="94" />
-        <di:waypoint xsi:type="dc:Point" x="713" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="54" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="266" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="266" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="478" y="94" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="542" y="73" width="90" height="12" />
+          <dc:Bounds x="236" y="88" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b">
@@ -410,30 +421,27 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
           <dc:Bounds x="-3" y="318" width="82" height="24" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4">
-        <dc:Bounds x="554" y="260" width="100" height="80" />
-      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9">
+        <di:waypoint xsi:type="dc:Point" x="54" y="300" />
+        <di:waypoint xsi:type="dc:Point" x="126" y="300" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="45" y="279" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas">
         <dc:Bounds x="971" y="260" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb">
-        <dc:Bounds x="774" y="260" width="100" height="80" />
+        <dc:Bounds x="799" y="260" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t">
         <dc:Bounds x="1145" y="260" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff">
-        <di:waypoint xsi:type="dc:Point" x="437" y="300" />
-        <di:waypoint xsi:type="dc:Point" x="554" y="300" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="450.5" y="279" width="90" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp">
-        <di:waypoint xsi:type="dc:Point" x="874" y="300" />
+        <di:waypoint xsi:type="dc:Point" x="899" y="300" />
         <di:waypoint xsi:type="dc:Point" x="971" y="300" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="877.5" y="279" width="90" height="12" />
+          <dc:Bounds x="890" y="279" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n">
@@ -463,18 +471,41 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
           <dc:Bounds x="1064" y="-61" width="0" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1m2tm19_di" bpmnElement="SequenceFlow_1m2tm19">
-        <di:waypoint xsi:type="dc:Point" x="54" y="300" />
-        <di:waypoint xsi:type="dc:Point" x="126" y="300" />
+      <bpmndi:BPMNShape id="ScriptTask_0dpt36a_di" bpmnElement="ScriptTask_0dpt36a">
+        <dc:Bounds x="455" y="260" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1a5mdd6_di" bpmnElement="ScriptTask_1a5mdd6">
+        <dc:Bounds x="613" y="260" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1e5vxox_di" bpmnElement="SequenceFlow_1e5vxox">
+        <di:waypoint xsi:type="dc:Point" x="555" y="300" />
+        <di:waypoint xsi:type="dc:Point" x="613" y="300" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="539" y="279" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0bfwj4y_di" bpmnElement="SequenceFlow_0bfwj4y">
+        <di:waypoint xsi:type="dc:Point" x="397" y="300" />
+        <di:waypoint xsi:type="dc:Point" x="455" y="300" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="90" y="278" width="0" height="14" />
+          <dc:Bounds x="426" y="279" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0y3i2k7_di" bpmnElement="SequenceFlow_0y3i2k7">
-        <di:waypoint xsi:type="dc:Point" x="654" y="300" />
-        <di:waypoint xsi:type="dc:Point" x="774" y="300" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0p6ba92_di" bpmnElement="SequenceFlow_0p6ba92">
+        <di:waypoint xsi:type="dc:Point" x="713" y="300" />
+        <di:waypoint xsi:type="dc:Point" x="799" y="300" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="756" y="279" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_08yiqtu_di" bpmnElement="ScriptTask_08yiqtu">
+        <dc:Bounds x="991" y="54" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_15d8lqu_di" bpmnElement="SequenceFlow_15d8lqu">
+        <di:waypoint xsi:type="dc:Point" x="1091" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="1315" y="94" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="714" y="278" width="0" height="14" />
+          <dc:Bounds x="1203" y="73" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>