Merge "Implement Deallocate Core NSSMF workflow"
authorByung-Woo Jun <byung-woo.jun@est.tech>
Wed, 16 Sep 2020 17:09:16 +0000 (17:09 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 16 Sep 2020 17:09:16 +0000 (17:09 +0000)
89 files changed:
adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
adapters/mso-cnf-adapter/src/main/resources/application.yaml
adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/CnfAdapterRestTest.java
adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImpl.java
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSIV2.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSIV2.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOptionV2.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSIV2.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSIV2.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOptionV2.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleSdnrDmaapRequest.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyRanNfNssi.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/ActDeActNssi.java
common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
common/src/main/java/org/onap/so/beans/nsmf/oof/DomainType.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/NsiReqBody.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetCapability.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/TemplateInfo.java [new file with mode: 0644]
graph-inventory/aai-client/pom.xml
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFluentTypeBase.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java
graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGeneratorMojo.java
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/InstantiateNsTaskTest.java
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml

index fa5c57f..c7f4509 100644 (file)
@@ -90,22 +90,4 @@ public final class AuthenticationMethodFactory {
         return v3Auth;
     }
 
-    public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3(
-            CloudIdentity cloudIdentity) {
-        Identity identity = new Identity();
-        Password password = new Password();
-        User user = new User();
-        Domain userDomain = new Domain();
-        userDomain.setName(cloudIdentity.getUserDomainName());
-        user.setName(cloudIdentity.getMsoId());
-        user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
-        user.setDomain(userDomain);
-        password.setUser(user);
-        identity.setPassword(password);
-        identity.setMethods(Collections.singletonList("password"));
-        com.woorea.openstack.keystone.v3.model.Authentication v3Auth =
-                new com.woorea.openstack.keystone.v3.model.Authentication();
-        v3Auth.setIdentity(identity);
-        return v3Auth;
-    }
 }
index 50ebcc6..6800428 100644 (file)
@@ -97,7 +97,7 @@ public class MsoCommonUtils {
      * openstack-java-sdk classname of the OpenStackRequest<T> parameter).
      */
 
-    protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
+    public <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
         return executeAndRecordOpenstackRequest(request, true);
     }
 
@@ -174,7 +174,7 @@ public class MsoCommonUtils {
      * Convert an Openstack Exception on a Keystone call to an MsoException. This method supports both
      * OpenstackResponseException and OpenStackConnectException.
      */
-    protected MsoException keystoneErrorToMsoException(OpenStackBaseException e, String context) {
+    public MsoException keystoneErrorToMsoException(OpenStackBaseException e, String context) {
         MsoException me = null;
 
         if (e instanceof OpenStackResponseException) {
@@ -455,15 +455,16 @@ public class MsoCommonUtils {
      */
     protected KeystoneAuthHolder getKeystoneAuthHolder(String cloudSiteId, String tenantId, String serviceName)
             throws MsoException {
-        CloudSite cloudSite =
-                cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
-        String cloudId = cloudSite.getId();
-        String region = cloudSite.getRegionId();
-        CloudIdentity cloudIdentity = cloudSite.getIdentityService();
-        MsoTenantUtils tenantUtils =
-                tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
-        String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
+        CloudIdentity cloudIdentity = null;
         try {
+            CloudSite cloudSite =
+                    cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
+            String cloudId = cloudSite.getId();
+            String region = cloudSite.getRegionId();
+            cloudIdentity = cloudSite.getIdentityService();
+            MsoTenantUtils tenantUtils =
+                    tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
+            String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
             if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
                 Access access = getKeystone(tenantId, cloudIdentity, keystoneUrl);
                 try {
index 072ab5a..63bc235 100644 (file)
 package org.onap.so.openstack.utils;
 
 import java.util.Map;
-import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
 import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudSite;
 import org.onap.so.openstack.beans.MsoTenant;
 import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
 import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.utils.CryptoUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import com.woorea.openstack.keystone.v3.model.Token;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.keystone.v3.Keystone;
-import com.woorea.openstack.keystone.v3.api.TokensResource.Authenticate;
-import com.woorea.openstack.keystone.v3.model.Authentication;
-import com.woorea.openstack.keystone.v3.model.Authentication.Identity;
 
 @Component
 public class MsoKeystoneV3Utils extends MsoTenantUtils {
 
-    @Autowired
-    private AuthenticationMethodFactory authenticationMethodFactory;
-
     @Override
     public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout)
             throws MsoException {
@@ -71,22 +57,4 @@ public class MsoKeystoneV3Utils extends MsoTenantUtils {
         return cloudIdentity.getIdentityUrl();
     }
 
-    public Token getKeystoneToken(CloudSite cloudSite) throws MsoException {
-        try {
-            CloudIdentity cloudIdentity = cloudSite.getIdentityService();
-
-            Keystone keystone = new Keystone(cloudIdentity.getIdentityUrl());
-
-            Authentication auth = authenticationMethodFactory.getAuthenticationForV3(cloudIdentity);
-
-            Authenticate authenticate = keystone.tokens().authenticate(auth);
-            return executeAndRecordOpenstackRequest(authenticate);
-
-        } catch (OpenStackResponseException e) {
-            throw keystoneErrorToMsoException(e, "TokenAuth");
-        } catch (OpenStackConnectException e) {
-            throw keystoneErrorToMsoException(e, "TokenAuth");
-        }
-    }
-
 }
index e94c283..0ba40e2 100644 (file)
@@ -28,8 +28,10 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA
 import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
 import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
 
 @SpringBootApplication
 @ComponentScan(basePackages = {"org.onap.so.adapters.cnf"})
@@ -42,4 +44,9 @@ public class MSOCnfApplication {
     public static void main(String... args) {
         SpringApplication.run(MSOCnfApplication.class, args);
     }
+
+    @Bean
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
 }
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java
new file mode 100644 (file)
index 0000000..bfa5505
--- /dev/null
@@ -0,0 +1,66 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"Group", "Version", "Kind"})
+public class GroupVersionKind {
+    @JsonProperty("Group")
+    private String group;
+    @JsonProperty("Version")
+    private String version;
+    @JsonProperty("Kind")
+    private String kind;
+
+    @JsonProperty("Group")
+    public String getGroup() {
+        return group;
+    }
+
+    @JsonProperty("Group")
+    public void setGroup(String group) {
+        this.group = group;
+    }
+
+    @JsonProperty("Version")
+    public String getVersion() {
+        return version;
+    }
+
+    @JsonProperty("Version")
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    @JsonProperty("Kind")
+    public String getKind() {
+        return kind;
+    }
+
+    @JsonProperty("Kind")
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java
new file mode 100644 (file)
index 0000000..5804082
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class InstanceMiniResponse extends Response {
+
+    private String id;
+    private MulticloudInstanceRequest request;
+    private String nameSpace;
+
+    public InstanceMiniResponse(String errorMsg) {
+        super(errorMsg);
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public MulticloudInstanceRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(MulticloudInstanceRequest request) {
+        this.request = request;
+    }
+
+    public String getNameSpace() {
+        return nameSpace;
+    }
+
+    public void setNameSpace(String nameSpace) {
+        this.nameSpace = nameSpace;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java
new file mode 100644 (file)
index 0000000..ad70fbb
--- /dev/null
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class InstanceMiniResponseList extends Response {
+
+    public InstanceMiniResponseList(String errorMsg) {
+        super(errorMsg);
+    }
+
+    private List<InstanceMiniResponse> instancList;
+
+    public List<InstanceMiniResponse> getInstancList() {
+        return instancList;
+    }
+
+    public void setInstancList(List<InstanceMiniResponse> instancList) {
+        this.instancList = instancList;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java
new file mode 100644 (file)
index 0000000..effaaf5
--- /dev/null
@@ -0,0 +1,87 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"id", "request", "namespace", "resources"})
+@JsonIgnoreProperties(value = "true")
+public class InstanceResponse extends Response {
+
+    @JsonProperty("id")
+    private String id;
+    @JsonProperty("request")
+    private MulticloudInstanceRequest request;
+    @JsonProperty("namespace")
+    private String namespace;
+    @JsonProperty("resources")
+    private List<Resource> resources = null;
+
+    public InstanceResponse(String errorMsg) {
+        super(errorMsg);
+    }
+
+    @JsonProperty("id")
+    public String getId() {
+        return id;
+    }
+
+    @JsonProperty("id")
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    @JsonProperty("request")
+    public MulticloudInstanceRequest getRequest() {
+        return request;
+    }
+
+    @JsonProperty("request")
+    public void setRequest(MulticloudInstanceRequest request) {
+        this.request = request;
+    }
+
+    @JsonProperty("namespace")
+    public String getNamespace() {
+        return namespace;
+    }
+
+    @JsonProperty("namespace")
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    @JsonProperty("resources")
+    public List<Resource> getResources() {
+        return resources;
+    }
+
+    @JsonProperty("resources")
+    public void setResources(List<Resource> resources) {
+        this.resources = resources;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java
new file mode 100644 (file)
index 0000000..2472684
--- /dev/null
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class InstanceStatusResponse extends Response {
+
+    public InstanceStatusResponse(String errorMsg) {
+        super(errorMsg);
+    }
+
+    private MulticloudInstanceRequest request;
+
+    private boolean ready;
+
+    private String resourceCount;
+
+    private List<PodStatus> podStatuses;
+
+    private List<?> servicesStatuses;
+
+    public MulticloudInstanceRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(MulticloudInstanceRequest request) {
+        this.request = request;
+    }
+
+    public boolean isReady() {
+        return ready;
+    }
+
+    public void setReady(boolean ready) {
+        this.ready = ready;
+    }
+
+    public String getResourceCount() {
+        return resourceCount;
+    }
+
+    public void setResourceCount(String resourceCount) {
+        this.resourceCount = resourceCount;
+    }
+
+    public List<PodStatus> getPodStatuses() {
+        return podStatuses;
+    }
+
+    public void setPodStatuses(List<PodStatus> podStatuses) {
+        this.podStatuses = podStatuses;
+    }
+
+    public List<?> getServicesStatuses() {
+        return servicesStatuses;
+    }
+
+    public void setServicesStatuses(List<?> servicesStatuses) {
+        this.servicesStatuses = servicesStatuses;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java
new file mode 100644 (file)
index 0000000..ed04601
--- /dev/null
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+public class PodStatus {
+
+    private String name;
+    private String nameSpace;
+    private boolean ready;
+    private String status;
+    private String[] ipAddresses;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getNameSpace() {
+        return nameSpace;
+    }
+
+    public void setNameSpace(String nameSpace) {
+        this.nameSpace = nameSpace;
+    }
+
+    public boolean isReady() {
+        return ready;
+    }
+
+    public void setReady(boolean ready) {
+        this.ready = ready;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String[] getIpAddresses() {
+        return ipAddresses;
+    }
+
+    public void setIpAddresses(String[] ipAddresses) {
+        this.ipAddresses = ipAddresses;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java
new file mode 100644 (file)
index 0000000..d18cd76
--- /dev/null
@@ -0,0 +1,54 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"GVK", "Name"})
+public class Resource {
+    @JsonProperty("GVK")
+    private GroupVersionKind gVK;
+    @JsonProperty("Name")
+    private String name;
+
+    @JsonProperty("GVK")
+    public GroupVersionKind getGVK() {
+        return gVK;
+    }
+
+    @JsonProperty("GVK")
+    public void setGVK(GroupVersionKind gVK) {
+        this.gVK = gVK;
+    }
+
+    @JsonProperty("Name")
+    public String getName() {
+        return name;
+    }
+
+    @JsonProperty("Name")
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java
new file mode 100644 (file)
index 0000000..4230223
--- /dev/null
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+public class Response {
+
+    private String errorMsg;
+
+    public Response(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
+}
index b6d50da..825778b 100644 (file)
@@ -1,6 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.so.adapters.cnf.rest;
 
 import java.io.File;
+import java.io.IOException;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpDelete;
@@ -20,12 +41,17 @@ import org.onap.so.adapters.cnf.model.ConfigTemplateEntity;
 import org.onap.so.adapters.cnf.model.ConfigurationEntity;
 import org.onap.so.adapters.cnf.model.ConfigurationRollbackEntity;
 import org.onap.so.adapters.cnf.model.ConnectivityInfo;
-import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+import org.onap.so.adapters.cnf.model.InstanceResponse;
+import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
 import org.onap.so.adapters.cnf.model.ProfileEntity;
 import org.onap.so.adapters.cnf.model.ResourceBundleEntity;
 import org.onap.so.adapters.cnf.model.Tag;
+import org.onap.so.adapters.cnf.service.CnfAdapterService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,6 +60,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 
@@ -43,23 +71,78 @@ public class CnfAdapterRest {
     private static final Logger logger = LoggerFactory.getLogger(CnfAdapterRest.class);
     private final CloseableHttpClient httpClient = HttpClients.createDefault();
 
+    @Autowired
+    private CnfAdapterService cnfAdapterService;
+
     @ResponseBody
     @RequestMapping(value = {"/api/cnf-adapter/v1/healthcheck"}, method = RequestMethod.GET,
             produces = "application/json")
-    public String healthCheck() throws Exception {
+    public ResponseEntity<String> healthCheck() throws Exception {
 
-        logger.info("health check called.");
+        logger.info("healthCheck called.");
+        return cnfAdapterService.healthCheck();
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance"}, method = RequestMethod.POST,
+            produces = "application/json", consumes = "application/json")
+    public ResponseEntity<InstanceResponse> createInstance(@RequestBody BpmnInstanceRequest bpmnInstanceRequest)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("createInstance called.");
+        return cnfAdapterService.createInstance(bpmnInstanceRequest);
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}"}, method = RequestMethod.GET,
+            produces = "application/json")
+    public ResponseEntity<InstanceResponse> getInstanceByInstanceId(@PathVariable("instID") String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("getInstanceByInstanceId called.");
+
+        return cnfAdapterService.getInstanceByInstanceId(instanceId);
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}/status"}, method = RequestMethod.GET,
+            produces = "application/json")
+    public ResponseEntity<InstanceStatusResponse> getInstanceStatusByInstanceId(
+            @PathVariable("instID") String instanceId) throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("getInstanceStatusByInstanceId called.");
+
+        return cnfAdapterService.getInstanceStatusByInstanceId(instanceId);
+
+    }
+
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance"}, method = RequestMethod.GET, produces = "application/json")
+    public ResponseEntity<InstanceMiniResponseList> getInstanceByRBNameOrRBVersionOrProfileName(
+            @RequestParam(value = "rb-name", required = false) String rbName,
+            @RequestParam(value = "rb-version", required = false) String rbVersion,
+            @RequestParam(value = "profile-name", required = false) String profileName)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("getInstanceByRBNameOrRBVersionOrProfileName called.");
+        return cnfAdapterService.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName);
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}"}, method = RequestMethod.DELETE,
+            produces = "application/json")
+    public ResponseEntity<String> deleteInstanceByInstanceId(@PathVariable("instID") String instanceID)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("deleteInstanceByInstanceId called.");
+        return cnfAdapterService.deleteInstanceByInstanceId(instanceID);
 
-        // TODO
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/healthcheck");
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition"}, method = RequestMethod.POST,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition"}, method = RequestMethod.POST,
             produces = "application/json")
     public String createRB(@RequestBody ResourceBundleEntity rB) throws Exception {
 
@@ -67,7 +150,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/rb/definition");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition");
         ObjectMapper objectMapper = new ObjectMapper();
         objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         String requestBody = objectMapper.writeValueAsString(rB);
@@ -82,7 +165,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getRB(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion)
             throws Exception {
@@ -91,7 +174,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion);
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
             return EntityUtils.toString(response.getEntity());
@@ -99,8 +182,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}"},
-            method = RequestMethod.DELETE, produces = "application/json")
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.DELETE,
+            produces = "application/json")
     public String deleteRB(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion)
             throws Exception {
 
@@ -108,7 +191,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion);
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -118,7 +201,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getListOfRB(@PathVariable("rb-name") String rbName) throws Exception {
 
@@ -126,7 +209,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition/" + rbName);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -136,7 +219,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getListOfRBWithoutUsingRBName() throws Exception {
 
@@ -144,7 +227,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition");
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition");
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -154,7 +237,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/content"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/content"},
             method = RequestMethod.POST, produces = "multipart/form-data")
     public String uploadArtifactForRB(@RequestParam("file") MultipartFile file, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion) throws Exception {
@@ -172,7 +255,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpPost post =
-                new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/content");
+                new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/content");
         post.setHeader("Content-Type", "multipart/form-data");
         logger.info(String.valueOf(post));
         post.setEntity(entity);
@@ -185,7 +268,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile"},
             method = RequestMethod.POST, produces = "application/json")
     public String createProfile(@RequestBody ProfileEntity fE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion) throws Exception {
@@ -195,7 +278,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpPost post =
-                new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
+                new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(fE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -209,7 +292,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
             method = RequestMethod.GET, produces = "application/json")
     public String getProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("pr-name") String prName) throws Exception {
@@ -219,7 +302,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpGet req = new HttpGet(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
+                "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -228,7 +311,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile"},
             method = RequestMethod.GET, produces = "application/json")
     public String getListOfProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion)
             throws Exception {
@@ -237,7 +320,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
+        HttpGet req =
+                new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -246,7 +330,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String deleteProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("pr-name") String prName) throws Exception {
@@ -256,7 +340,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpDelete req = new HttpDelete(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
+                "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -266,7 +350,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}/content"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}/content"},
             method = RequestMethod.POST, produces = "multipart/form-data")
     public String uploadArtifactForProfile(@RequestParam("file") MultipartFile file,
             @PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
@@ -284,7 +368,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
                 + "/profile/" + prName + "/content");
         post.setHeader("Content-Type", "multipart/form-data");
 
@@ -299,144 +383,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance"}, method = RequestMethod.POST,
-            produces = "application/json")
-    public String createInstance(@RequestBody BpmnInstanceRequest bpmnInstanceRequest) throws Exception {
-
-        logger.info("create Instance called.");
-
-        MulticloudInstanceRequest multicloudInstanceRequest = new MulticloudInstanceRequest();
-
-        if (bpmnInstanceRequest.getK8sRBProfileName() != null) {
-            multicloudInstanceRequest.setCloudRegion(bpmnInstanceRequest.getCloudRegionId());
-            multicloudInstanceRequest.setLabels(bpmnInstanceRequest.getLabels());
-            multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues());
-            multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName());
-            multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId());
-            multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId());
-            multicloudInstanceRequest.setVfModuleUuid(bpmnInstanceRequest.getVfModuleUUID());
-        } else {
-
-            logger.info("K8sRBProfileName is required");
-            return "K8sRBProfileName is required";
-        }
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/instance");
-        ObjectMapper objectMapper = new ObjectMapper();
-
-        String requestBody = objectMapper.writeValueAsString(multicloudInstanceRequest);
-        StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
-        post.setEntity(requestEntity);
-
-        try (CloseableHttpClient httpClient = HttpClients.createDefault();
-                CloseableHttpResponse response = httpClient.execute(post)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    // This api is not enabled in multicloud project ,but this is required in
-    // future.
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{vnfInstanceId}"}, method = RequestMethod.PUT,
-            produces = "application/json")
-    public String updateInstance(@RequestBody MulticloudInstanceRequest iE,
-            @PathVariable("vnfInstanceId") String instanceId) throws Exception {
-
-        logger.info("create Instance called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpPut post = new HttpPut("http://172.17.0.2:31770/v1/instance/" + instanceId);
-        ObjectMapper objectMapper = new ObjectMapper();
-
-        String requestBody = objectMapper.writeValueAsString(iE);
-        StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
-        post.setEntity(requestEntity);
-
-        try (CloseableHttpClient httpClient = HttpClients.createDefault();
-                CloseableHttpResponse response = httpClient.execute(post)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{instID}"}, method = RequestMethod.GET,
-            produces = "application/json")
-    public String getInstance(@PathVariable("instID") String instanceId) throws Exception {
-
-        logger.info("get Instance called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/instance/" + instanceId);
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{instID}/status"}, method = RequestMethod.GET,
-            produces = "application/json")
-    public String getInstanceStatus(@PathVariable("instID") String instanceId) throws Exception {
-
-        logger.info("getInstanceStatus called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/instance/" + instanceId + "/status");
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance"}, method = RequestMethod.GET,
-            produces = "application/json")
-    public String getInstanceBasedOnRBNameOrRBVersionOrProfileName(
-            @RequestParam(value = "rb-name", required = false) String rbName,
-            @RequestParam(value = "rb-version", required = false) String rbVersion,
-            @RequestParam(value = "profile-name", required = false) String profileName) throws Exception {
-
-        logger.info("getInstanceBasedOnRBNameOrRBVersionOrProfileName called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/instance?rb-name=" + rbName + "&rb-version=" + rbVersion
-                + "&profile-name=" + profileName);
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{instID}"}, method = RequestMethod.DELETE,
-            produces = "application/json")
-    public String deleteInstance(@PathVariable("instID") String instanceID) throws Exception {
-
-        logger.info("delete Instance called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/instance/" + instanceID);
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config"},
             method = RequestMethod.POST, produces = "application/json")
     public String createConfiguration(@RequestBody ConfigurationEntity cE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName)
@@ -446,8 +393,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost(
-                "http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/" + prName + "/config");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
+                + "/profile/" + prName + "/config");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(cE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -461,8 +408,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {
-            "/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
+    @RequestMapping(
+            value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
             method = RequestMethod.GET, produces = "application/json")
     public String getConfiguration(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("profile-name") String prName, @PathVariable("cfg-name") String cfgName) throws Exception {
@@ -471,7 +418,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
                 + prName + "/config/" + cfgName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
@@ -481,8 +428,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {
-            "/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
+    @RequestMapping(
+            value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String deleteConfiguration(@PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName,
@@ -492,7 +439,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
                 + "/profile/" + prName + "/config/" + cfgName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
@@ -503,8 +450,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {
-            "/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
+    @RequestMapping(
+            value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
             method = RequestMethod.PUT, produces = "application/json")
     public String updateConfiguration(@RequestBody ConfigurationEntity cE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName,
@@ -514,7 +461,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPut post = new HttpPut("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
+        HttpPut post = new HttpPut("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
                 + prName + "/config/" + cfgName);
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(cE);
@@ -529,7 +476,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/tagit"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/tagit"},
             method = RequestMethod.POST, produces = "application/json")
     public String tagConfigurationValue(@RequestBody Tag tag, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("pr-name") String prName) throws Exception {
@@ -537,8 +484,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
-                + prName + "/config/tagit");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
+                + "/profile/" + prName + "/config/tagit");
 
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(tag);
@@ -553,7 +500,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/connectivity-info"}, method = RequestMethod.POST,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info"}, method = RequestMethod.POST,
             produces = "application/json")
     public String createConnectivityInfo(@RequestBody ConnectivityInfo cIE) throws Exception {
 
@@ -561,7 +508,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/connectivity-info");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/connectivity-info");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(cIE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -575,7 +522,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/connectivity-info/{connname}"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info/{connname}"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getConnectivityInfo(@PathVariable("connname") String connName) throws Exception {
 
@@ -583,7 +530,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/connectivity-info/" + connName);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/connectivity-info/" + connName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -592,7 +539,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/connectivity-info/{connname}"}, method = RequestMethod.DELETE,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info/{connname}"}, method = RequestMethod.DELETE,
             produces = "application/json")
     public String deleteConnectivityInfo(@PathVariable("connname") String connName) throws Exception {
 
@@ -600,7 +547,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/connectivity-info/" + connName);
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/connectivity-info/" + connName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -610,7 +557,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template"},
             method = RequestMethod.POST, produces = "application/json")
     public String createConfigTemplate(@RequestBody ConfigTemplateEntity tE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion) throws Exception {
@@ -620,7 +567,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpPost post = new HttpPost(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template");
+                "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(tE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -634,7 +581,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
             method = RequestMethod.GET, produces = "application/json")
     public String getConfigTemplate(@PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("tname") String tName) throws Exception {
@@ -643,8 +590,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template/" + tName);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
+                + "/config-template/" + tName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -653,7 +600,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String deleteTemplate(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("tname") String tName) throws Exception {
@@ -662,8 +609,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template/" + tName);
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
+                + "/config-template/" + tName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -674,7 +621,7 @@ public class CnfAdapterRest {
 
     @ResponseBody
     @RequestMapping(
-            value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}/content"},
+            value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}/content"},
             method = RequestMethod.POST, produces = "multipart/form-data")
     public String uploadTarFileForTemplate(@RequestParam("file") MultipartFile file,
             @PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
@@ -692,7 +639,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
                 + "/config-template/" + tName + "/content");
         post.setHeader("Content-Type", "multipart/form-data");
 
@@ -707,7 +654,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/definition/{rbName}/{rbVersion}/profile/{prName}/config/rollback"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rbName}/{rbVersion}/profile/{prName}/config/rollback"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String rollbackConfiguration(@RequestBody ConfigurationRollbackEntity rE,
             @PathVariable("rbName") String rbName, @PathVariable("rbVersion") String rbVersion,
@@ -716,8 +663,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
-                + prName + "/config/rollback");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
+                + "/profile/" + prName + "/config/rollback");
 
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(rE);
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
new file mode 100644 (file)
index 0000000..06c09e3
--- /dev/null
@@ -0,0 +1,269 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.EntityNotFoundException;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.http.HttpStatus;
+import org.onap.so.adapters.cnf.model.BpmnInstanceRequest;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponse;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+import org.onap.so.adapters.cnf.model.InstanceResponse;
+import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
+import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpStatusCodeException;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+@Service
+public class CnfAdapterService {
+    private static final Logger logger = LoggerFactory.getLogger(CnfAdapterService.class);
+    @Autowired
+    private RestTemplate restTemplate;
+    private static final String INSTANCE_CREATE_PATH = "/v1/instance";
+    private static final String HEALTH_CHECK = "/v1/healthcheck";
+
+    public ResponseEntity<String> healthCheck() {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<String> result = null;
+        try {
+
+            logger.info("CnfAdapterService createInstance called");
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String endpoint = UriBuilder.fromUri(uri).path(HEALTH_CHECK).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            result = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class);
+            return result;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            return ResponseEntity.status(e.getStatusCode()).body(responseString);
+        }
+    }
+
+    public ResponseEntity<InstanceResponse> createInstance(BpmnInstanceRequest bpmnInstanceRequest)
+            throws JsonParseException, JsonMappingException, IOException {
+        try {
+            logger.info("CnfAdapterService createInstance called");
+            MulticloudInstanceRequest multicloudInstanceRequest = new MulticloudInstanceRequest();
+            ResponseEntity<InstanceResponse> instanceResponse = null;
+            if (bpmnInstanceRequest.getK8sRBProfileName() != null) {
+                multicloudInstanceRequest.setCloudRegion(bpmnInstanceRequest.getCloudRegionId());
+                multicloudInstanceRequest.setLabels(bpmnInstanceRequest.getLabels());
+                multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues());
+                multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName());
+                multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId());
+                multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId());
+                multicloudInstanceRequest.setVfModuleUuid(bpmnInstanceRequest.getVfModuleUUID());
+            } else {
+                logger.error("k8sProfileName should not be null");
+                return instanceResponse;
+            }
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH).build().toString();
+            HttpEntity<?> entity = getHttpEntity(multicloudInstanceRequest);
+            instanceResponse = restTemplate.exchange(endpoint, HttpMethod.POST, entity, InstanceResponse.class);
+            return instanceResponse;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceResponse result = new InstanceResponse(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+    }
+
+    public ResponseEntity<InstanceResponse> getInstanceByInstanceId(String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<InstanceResponse> instanceResponse = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path = "/v1/instance/" + instanceId;
+            String endpoint = UriBuilder.fromUri(uri).path(path).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, InstanceResponse.class);
+            return instanceResponse;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceResponse result = new InstanceResponse(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+    }
+
+    public ResponseEntity<InstanceStatusResponse> getInstanceStatusByInstanceId(String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<InstanceStatusResponse> instanceResponse = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path = "/v1/instance/" + instanceId + "/status";
+            String endpoint = UriBuilder.fromUri(uri).path(path).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            instanceResponse =
+                    restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, InstanceStatusResponse.class);
+            return instanceResponse;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceStatusResponse result = new InstanceStatusResponse(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+
+    }
+
+    public ResponseEntity<InstanceMiniResponseList> getInstanceByRBNameOrRBVersionOrProfileName(String rbName,
+            String rbVersion, String profileName) throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<InstanceMiniResponseList> instanceMiniResponseList = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path =
+                    "/v1/instance" + "?rb-name=" + rbName + "&rb-version=" + rbVersion + "&profile-name=" + profileName;
+            String endPoint = uri + path;
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            instanceMiniResponseList =
+                    restTemplate.exchange(endPoint, HttpMethod.GET, requestEntity, InstanceMiniResponseList.class);
+            return instanceMiniResponseList;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceMiniResponseList result = new InstanceMiniResponseList(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+    }
+
+    public ResponseEntity<String> deleteInstanceByInstanceId(String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<String> result = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path = "/v1/instance/" + instanceId;
+            String endpoint = UriBuilder.fromUri(uri).path(path).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            result = restTemplate.exchange(endpoint, HttpMethod.DELETE, requestEntity, String.class);
+            return result;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            return ResponseEntity.status(e.getStatusCode()).body(responseString);
+        }
+    }
+
+    protected HttpHeaders getHttpHeaders() {
+        HttpHeaders headers = new HttpHeaders();
+        List<MediaType> acceptableMediaTypes = new ArrayList<>();
+        acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
+        headers.setAccept(acceptableMediaTypes);
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        /*
+         * try { String userCredentials = CryptoUtils.decrypt(env.getRequiredProperty("mso.cnf.adapter.auth"),
+         * env.getRequiredProperty("mso.msoKey")); if (userCredentials != null) { headers.add(HttpHeaders.AUTHORIZATION,
+         * "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); } } catch
+         * (GeneralSecurityException e) { logger.error("Security exception", e); }
+         */
+        return headers;
+    }
+
+    protected HttpEntity<?> getHttpEntity(MulticloudInstanceRequest request) {
+        HttpHeaders headers = getHttpHeaders();
+        return new HttpEntity<>(request, headers);
+    }
+}
index 30b1b62..5a9adbf 100644 (file)
  #     naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
  #     enable-lazy-load-no-trans: true
 server:
-  port: 9013
+  port: 9012
   tomcat:
     max-threads: 50
 
 #mso:
  # key: 07a7159d3bf51a0e53be7a8f89699be7
  # site-name: localSite
-#  logPath: ./logs/nssmf
+#  logPath: ./logs/cnf
  # msb-ip: msb-iag.{{ include "common.namespace" . }}
  # msb-port: 80
  # adapters:
index 38a1091..ee7a771 100644 (file)
@@ -16,7 +16,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- */
 
 package org.onap.so.adapters.cnf;
 
@@ -60,3 +60,4 @@ public class CnfAdapterRestTest {
     }
 
 }
+*/
index 5f7fe76..5b53856 100644 (file)
@@ -106,7 +106,7 @@ public class NssmfManagerServiceImpl implements NssmfManagerService {
     public ResponseEntity queryNSSISelectionCapability(NssmfAdapterNBIRequest nbiRequest) {
         EsrInfo esrInfo = nbiRequest.getEsrInfo();
         try {
-            return buildResponse(buildNssmfManager(esrInfo, ActionType.QUERY_JOB_STATUS, null)
+            return buildResponse(buildNssmfManager(esrInfo, ActionType.QUERY_NSSI_SELECTION_CAPABILITY, null)
                     .queryNSSISelectionCapability(nbiRequest));
         } catch (ApplicationException e) {
             return e.buildErrorResponse();
@@ -117,8 +117,8 @@ public class NssmfManagerServiceImpl implements NssmfManagerService {
     public ResponseEntity querySubnetCapability(NssmfAdapterNBIRequest nbiRequest) {
         EsrInfo esrInfo = nbiRequest.getEsrInfo();
         try {
-            return buildResponse(
-                    buildNssmfManager(esrInfo, ActionType.QUERY_JOB_STATUS, null).querySubnetCapability(nbiRequest));
+            return buildResponse(buildNssmfManager(esrInfo, ActionType.QUERY_SUB_NET_CAPABILITY, null)
+                    .querySubnetCapability(nbiRequest));
         } catch (ApplicationException e) {
             return e.buildErrorResponse();
         }
index 2c96e7d..040fc26 100644 (file)
@@ -42,6 +42,7 @@ import org.onap.so.db.catalog.beans.CloudSite
 import org.onap.so.db.catalog.beans.HomingInstance
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
+import com.google.gson.JsonObject
 
 import com.fasterxml.jackson.databind.ObjectMapper
 
@@ -571,5 +572,82 @@ class OofUtils {
         response.append("\n  }\n")
         return response.toString()
     }
-
+/**
+* Method to create select NSSI request
+* @param requestId - mso-request-id
+* @param messageType - Message type for callback correlation
+* @param UUID - UUID of NSST
+* @param invariantUUID - Invariant UUID of NSST
+* @param name - name of the NSST model
+* @param profileInfo - A JSON object containing slice profile parameters
+* @return
+*/
+public String buildSelectNSSIRequest(String requestId, String messageType, String UUID,String invariantUUID,
+String name, Map<String, Object> profileInfo){
+
+def transactionId = requestId
+logger.debug( "transactionId is: " + transactionId)
+String correlator = requestId
+String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+ObjectMapper objectMapper = new ObjectMapper();
+String profileJson = objectMapper.writeValueAsString(profileInfo);
+
+//Prepare requestInfo object
+JsonObject requestInfo = new JsonObject()
+requestInfo.addProperty("transactionId", transactionId)
+requestInfo.addProperty("requestId", requestId)
+requestInfo.addProperty("callbackUrl", callbackUrl)
+requestInfo.addProperty("sourceId","SO" )
+requestInfo.addProperty("timeout", 600)
+requestInfo.addProperty("numSolutions", 1)
+
+//Prepare serviceInfo object
+JsonObject nsstInfo = new JsonObject()
+nsstInfo.addProperty("UUID", UUID)
+nsstInfo.addProperty("invariantUUID", invariantUUID)
+nsstInfo.addProperty("name", name)
+
+JsonObject json = new JsonObject()
+json.add("requestInfo", requestInfo)
+json.add("NSSTInfo", nsstInfo)
+json.addProperty("sliceProfile", profileJson)
+return json.toString()
+}
+/**
+* Method to create NSI/NSSI termination request
+* (OOF response will be synchronous in G-Release)
+* @param requestId - mso-request-id
+* @param nxlId        - NSI/NSSI Id to be terminated
+* @param messageType - Message type for callback correlation
+* @param serviceInstanceId - NSI/NSSI Id related to nxlId
+* @return
+*/
+public String buildTerminateNxiRequest(String requestId,String nxlId, String nxlType, String messageType, String serviceInstanceId) {
+def transactionId = requestId
+logger.debug( "transactionId is: " + transactionId)
+String correlator = requestId
+String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+//Prepare Terminate Nxl Json
+JsonObject json = new JsonObject()
+json.addProperty("type", nxlType)
+json.addProperty("NxIId", nxlId)
+//Prepare requestInfo object
+JsonObject requestInfo = new JsonObject()
+requestInfo.addProperty("transactionId", transactionId)
+requestInfo.addProperty("requestId", requestId)
+requestInfo.addProperty("callbackUrl", callbackUrl)
+requestInfo.addProperty("sourceId","SO" )
+requestInfo.addProperty("timeout", 600)
+//Prepare addtnlArgs object
+JsonObject addtnlArgs = new JsonObject()
+addtnlArgs.addProperty("serviceInstanceId", serviceInstanceId)
+requestInfo.add("addtnlArgs", addtnlArgs)
+json.add("requestInfo", requestInfo)
+return json.toString()
+}
 }
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java
new file mode 100644 (file)
index 0000000..0f35b38
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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.onap.so.client.dmaapproperties;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("prototype")
+public class SdnrDmaapPublisher extends DmaapPublisher {
+
+
+    public SdnrDmaapPublisher() throws IOException {
+        super();
+    }
+
+    @Override
+    public String getAuth() {
+
+        return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
+    }
+
+    @Override
+    public String getKey() {
+
+        return UrnPropertiesReader.getVariable("mso.msoKey");
+    }
+
+    @Override
+    public String getTopic() {
+        return UrnPropertiesReader.getVariable("sdnc.dmaap.publisher.topic");
+    }
+
+    @Override
+    public Optional<String> getHost() {
+        return Optional.ofNullable(UrnPropertiesReader.getVariable("sdnc.dmaap.host"));
+    }
+}
+
+
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java
new file mode 100644 (file)
index 0000000..d9656f7
--- /dev/null
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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.onap.so.client.sdnc.common;
+
+import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank;
+import javax.inject.Provider;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.dmaapproperties.SdnrDmaapPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component("SendRequestToSdnr")
+public class SendRequestToSdnr implements JavaDelegate {
+    private static final Logger logger = LoggerFactory.getLogger(SendRequestToSdnr.class);
+    ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+    @Autowired
+    private Provider<SdnrDmaapPublisher> sdnrDmaapPublisher;
+
+    @Override
+    public void execute(DelegateExecution execution) throws Exception {
+
+        logger.debug("SendRequestToSdnr_start");
+
+        String requestId = (String) execution.getVariable("correlator");
+        if (isBlank(requestId)) {
+            String msg = "Cannot process SDNR Request : correlator is null";
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg);
+        }
+
+        String messageType = (String) execution.getVariable("messageType");
+        if (isBlank(messageType)) {
+            String msg = "Cannot process SDNR Request : messageType is null";
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg);
+        }
+
+        String timeout = (String) execution.getVariable("timeout");
+        if (isBlank(timeout)) {
+            timeout = UrnPropertiesReader.getVariable("sdnc.dmaap.callback.timeout", execution);
+            if (isBlank(timeout)) {
+                logger.debug("Setting SDNR timeout to default : PT30M");
+                timeout = "PT30M";
+            }
+        }
+        logger.debug("Async Callback Timeout will be: " + timeout);
+        String msg = (String) execution.getVariable("sdnrRequest");
+        logger.debug("msg to be sent on dmaap " + msg);
+        sdnrDmaapPublisher.get().send(msg);
+
+    }
+}
+
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
new file mode 100644 (file)
index 0000000..d59f865
--- /dev/null
@@ -0,0 +1,448 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # 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.onap.so.bpmn.infrastructure.scripts
+
+import com.google.gson.JsonArray
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.sql.Timestamp
+import java.util.List
+import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.JsonObject
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import javax.ws.rs.NotFoundException
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.aai.domain.yang.Relationship
+
+class AnNssmfUtils {
+
+       private static final Logger logger = LoggerFactory.getLogger(AnNssmfUtils.class)
+       ObjectMapper objectMapper = new ObjectMapper();
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       public String buildSelectRANNSSIRequest(String requestId, String messageType, String UUID,String invariantUUID,
+               String name, Map<String, Object> profileInfo, List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse){
+
+       def transactionId = requestId
+       logger.debug( "transactionId is: " + transactionId)
+       String correlator = requestId
+       String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+       ObjectMapper objectMapper = new ObjectMapper();
+       String profileJson = objectMapper.writeValueAsString(profileInfo);
+       String nsstInfoListString = objectMapper.writeValueAsString(nsstInfoList);
+       //Prepare requestInfo object
+       JsonObject requestInfo = new JsonObject()
+       requestInfo.addProperty("transactionId", transactionId)
+       requestInfo.addProperty("requestId", requestId)
+       requestInfo.addProperty("callbackUrl", callbackUrl)
+       requestInfo.addProperty("sourceId","SO" )
+       requestInfo.addProperty("timeout", 600)
+       requestInfo.addProperty("numSolutions", 1)
+
+       //Prepare serviceInfo object
+       JsonObject ranNsstInfo = new JsonObject()
+       ranNsstInfo.addProperty("UUID", UUID)
+       ranNsstInfo.addProperty("invariantUUID", invariantUUID)
+       ranNsstInfo.addProperty("name", name)
+
+       JsonObject json = new JsonObject()
+       json.add("requestInfo", requestInfo)
+       json.add("NSTInfo", ranNsstInfo)
+       json.addProperty("serviceProfile", profileJson)
+       json.addProperty("NSSTInfo", nsstInfoListString)
+       json.add("subnetCapabilities", capabilitiesList)
+       json.addProperty("preferReuse", preferReuse)
+
+       return json.toString()
+}
+
+public String buildCreateTNNSSMFSubnetCapabilityRequest() {
+       EsrInfo esrInfo = new EsrInfo()
+       esrInfo.setNetworkType("TN")
+       esrInfo.setVendor("ONAP")
+
+       JsonArray subnetTypes = new JsonArray()
+       subnetTypes.add("TN_FH")
+       subnetTypes.add("TN_MH")
+       JsonObject response = new JsonObject()
+       response.add("subnetCapabilityQuery", subnetTypes)
+       response.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+       return response.toString()
+}
+
+public String buildCreateANNFNSSMFSubnetCapabilityRequest() {
+       EsrInfo esrInfo = new EsrInfo()
+       esrInfo.setNetworkType("AN")
+       esrInfo.setVendor("ONAP")
+
+       JsonArray subnetTypes = new JsonArray()
+       subnetTypes.add("AN_NF")
+       JsonObject response = new JsonObject()
+       response.add("subnetCapabilityQuery", subnetTypes)
+       response.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+       return response.toString()
+}
+public void createDomainWiseSliceProfiles(List<String> ranConstituentSliceProfiles, DelegateExecution execution) {
+       
+       for(String profile : ranConstituentSliceProfiles) {
+               String domainType = jsonUtil.getJsonValue(profile, "domainType")
+               switch(domainType) {
+                       case "AN_NF":
+                               execution.setVariable("ranNfSliceProfile", profile)
+                               break
+                       case "TN_FH":
+                               execution.setVariable("tnFhSliceProfile", profile)
+                               break
+                       case "TN_MH":
+                               execution.setVariable("tnMhSliceProfile", profile)
+                               break
+                       default:
+                               logger.debug("No expected match found for current domainType")
+                               logger.error("No expected match found for current domainType "+ domainType)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ domainType)
+               }
+               
+       }
+}
+
+public void createSliceProfilesInAai(DelegateExecution execution) {
+       
+       org.onap.aai.domain.yang.ServiceInstance ANNF_sliceProfileInstance = new ServiceInstance();
+       org.onap.aai.domain.yang.ServiceInstance TNFH_sliceProfileInstance = new ServiceInstance();
+       org.onap.aai.domain.yang.ServiceInstance TNMH_sliceProfileInstance = new ServiceInstance();
+       //generate slice profile ids and slice profile instance ids
+       String ANNF_sliceProfileInstanceId = UUID.randomUUID().toString()
+       String ANNF_sliceProfileId = UUID.randomUUID().toString()
+       String TNFH_sliceProfileInstanceId = UUID.randomUUID().toString()
+       String TNFH_sliceProfileId = UUID.randomUUID().toString()
+       String TNMH_sliceProfileInstanceId = UUID.randomUUID().toString()
+       String TNMH_sliceProfileId = UUID.randomUUID().toString()
+       execution.setVariable("ANNF_sliceProfileInstanceId",ANNF_sliceProfileInstanceId)
+       execution.setVariable("ANNF_sliceProfileId",ANNF_sliceProfileId)
+       execution.setVariable("TNFH_sliceProfileInstanceId",TNFH_sliceProfileInstanceId)
+       execution.setVariable("TNFH_sliceProfileId",TNFH_sliceProfileId)
+       execution.setVariable("TNMH_sliceProfileInstanceId",TNMH_sliceProfileInstanceId)
+       execution.setVariable("TNMH_sliceProfileId",TNMH_sliceProfileId)
+       //slice profiles assignment
+       org.onap.aai.domain.yang.SliceProfiles ANNF_SliceProfiles = new SliceProfiles()
+       org.onap.aai.domain.yang.SliceProfiles TNFH_SliceProfiles = new SliceProfiles()
+       org.onap.aai.domain.yang.SliceProfiles TNMH_SliceProfiles = new SliceProfiles()
+       org.onap.aai.domain.yang.SliceProfile ANNF_SliceProfile = new SliceProfile()
+       org.onap.aai.domain.yang.SliceProfile TNFH_SliceProfile = new SliceProfile()
+       org.onap.aai.domain.yang.SliceProfile TNMH_SliceProfile = new SliceProfile()
+       ANNF_SliceProfile = createSliceProfile("AN-NF", execution)
+       TNFH_SliceProfile = createSliceProfile("TN-FH",execution)
+       TNMH_SliceProfile = createSliceProfile("TN-MH",execution)
+       
+       ANNF_SliceProfiles.getSliceProfile().add(ANNF_SliceProfile)
+       TNFH_SliceProfiles.getSliceProfile().add(TNFH_SliceProfile)
+       TNMH_SliceProfiles.getSliceProfile().add(TNMH_SliceProfile)
+       
+       logger.debug("sliceProfiles : 1. "+ANNF_SliceProfiles.toString()+"\n 2. "+TNFH_SliceProfiles.toString()+"\n 3. "+TNMH_SliceProfiles.toString())
+       //ANNF slice profile instance creation
+       ANNF_sliceProfileInstance.setServiceInstanceId(ANNF_sliceProfileInstanceId)
+       String sliceInstanceName = "sliceprofile_"+ANNF_sliceProfileId
+       ANNF_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+       String serviceType = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "sST")
+       ANNF_sliceProfileInstance.setServiceType(serviceType)
+       String serviceStatus = "deactivated"
+       ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+       String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
+       ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+       String serviceRole = "slice-profile-instance"
+       ANNF_sliceProfileInstance.setServiceRole(serviceRole)
+       List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+       String snssai = snssaiList.get(0)
+       ANNF_sliceProfileInstance.setEnvironmentContext(snssai)
+       ANNF_sliceProfileInstance.setWorkloadContext("AN-NF")    
+       ANNF_sliceProfileInstance.setSliceProfiles(ANNF_SliceProfiles)
+       logger.debug("completed ANNF sliceprofileinstance build "+ ANNF_sliceProfileInstance.toString())
+       //TNFH slice profile instance creation
+       TNFH_sliceProfileInstance.setServiceInstanceId(TNFH_sliceProfileInstanceId)
+       sliceInstanceName = "sliceprofile_"+TNFH_sliceProfileId
+       TNFH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+       serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST")
+       TNFH_sliceProfileInstance.setServiceType(serviceType)
+       TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+       serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList")
+       TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+       TNFH_sliceProfileInstance.setServiceRole(serviceRole)
+       TNFH_sliceProfileInstance.setEnvironmentContext(snssai)
+       TNFH_sliceProfileInstance.setWorkloadContext("TN-FH")
+       TNFH_sliceProfileInstance.setSliceProfiles(TNFH_SliceProfiles)
+       logger.debug("completed TNFH sliceprofileinstance build "+TNFH_sliceProfileInstance)
+       //TNMH slice profile instance creation
+       TNMH_sliceProfileInstance.setServiceInstanceId(TNMH_sliceProfileInstanceId)
+       sliceInstanceName = "sliceprofile_"+TNMH_sliceProfileId
+       TNMH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+       serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST")
+       TNMH_sliceProfileInstance.setServiceType(serviceType)
+       TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+       serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList")
+       TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+       TNMH_sliceProfileInstance.setServiceRole(serviceRole)
+       TNMH_sliceProfileInstance.setEnvironmentContext(snssai)
+       TNMH_sliceProfileInstance.setWorkloadContext("TN-MH")
+       TNMH_sliceProfileInstance.setSliceProfiles(TNMH_SliceProfiles)
+       logger.debug("completed TNMH sliceprofileinstance build "+TNMH_sliceProfileInstance)
+       String msg = ""
+       try {
+
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ANNF_sliceProfileInstanceId)
+               client.create(sliceProfileUri, ANNF_sliceProfileInstance)
+
+               AAIResourceUri sliceProfileUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), TNFH_sliceProfileInstanceId)
+               client.create(sliceProfileUri1, TNFH_sliceProfileInstance)
+
+               AAIResourceUri sliceProfileUri2 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), TNMH_sliceProfileInstanceId)
+               client.create(sliceProfileUri2, TNMH_sliceProfileInstance)
+
+       } catch (BpmnError e) {
+               throw e
+       } catch (Exception ex) {
+               msg = "Exception in AnNssmfUtils.createSliceProfilesInAai " + ex.getMessage()
+               logger.info(msg)
+               exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+       }
+
+}
+private SliceProfile createSliceProfile(String domainType, DelegateExecution execution) {
+
+       SliceProfile result = new SliceProfile()
+       Map<String,Object> profile
+       switch(domainType) {
+               case "AN-NF":
+                       profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, pLMNIdList, cSReliabilityMeanTime, 
+                                                                                                                                                                                                       //msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget
+                       result.setJitter(profile.get("jitter"))
+                       result.setLatency(profile.get("latency"))
+                       result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
+                       result.setSNssai(profile.get("sNSSAI"))
+                       result.setUeMobilityLevel(profile.get("uEMobilityLevel"))
+                       result.setMaxNumberOfUEs(profile.get("maxNumberofUEs"))
+                       result.setActivityFactor(profile.get("activityFactor"))
+                       result.setCoverageAreaTAList(profile.get("coverageAreaTAList"))
+                       result.setCsAvailability(profile.get("cSAvailabilityTarget"))
+                       result.setExpDataRateDL(profile.get("expDataRateDL"))
+                       result.setExpDataRateUL(profile.get("expDataRateUL"))
+                       result.setSurvivalTime(profile.get("survivalTime"))
+                       result.setAreaTrafficCapDL(profile.get("areaTrafficCapDL"))
+                       result.setAreaTrafficCapUL(profile.get("areaTrafficCapUL"))
+                       result.setExpDataRate(profile.get("expDataRate"))
+                       result.setProfileId(execution.getVariable("ANNF_sliceProfileId"))
+                       break
+               case "TN-FH":
+                       profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) //pending fields - maxBandwidth, sST, pLMNIdList
+                       result.setJitter(profile.get("jitter"))
+                       result.setLatency(profile.get("latency"))
+                       result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
+                       result.setSNssai(profile.get("sNSSAI"))
+                       result.setProfileId(execution.getVariable("TNFH_sliceProfileId"))
+                       break
+               case "TN-MH":
+                       profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, pLMNIdList
+                       result.setJitter(profile.get("jitter"))
+                       result.setLatency(profile.get("latency"))
+                       result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
+                       result.setSNssai(profile.get("sNSSAI"))
+                       result.setProfileId(execution.getVariable("TNMH_sliceProfileId"))
+                       break
+               default:
+                       logger.debug("No expected match found for current domainType")
+                       logger.error("No expected match found for current domainType "+ domainType)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ domainType)
+       }
+       return result
+}
+
+ /**
+     * create relationship in AAI
+     */
+    public createRelationShipInAAI = { DelegateExecution execution, final Relationship relationship, String instanceId ->
+        logger.debug("createRelationShipInAAI Start")
+        String msg
+               AAIResourcesClient client = new AAIResourcesClient()
+        try {
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                    execution.getVariable("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"),
+                    instanceId).relationshipAPI()
+            client.create(uri, relationship)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("createRelationShipInAAI Exit")
+
+    }
+       
+       public void processRanNfModifyRsp(DelegateExecution execution) {
+               String status = execution.getVariable("ranNfStatus")
+               if(status.equals("success")) {
+                       logger.debug("completed Ran NF NSSI modification ... proceeding with the flow")
+               }
+               else {
+                       logger.error("failed to modify ran Nf nssi")
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000, "modify ran nf nssi not successfull")
+               }
+       }
+       
+       public String buildCreateNSSMFRequest(DelegateExecution execution, String domainType, String action) {
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("TN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               JsonObject response = new JsonObject()
+               JsonObject allocateTnNssi = new JsonObject()
+               JsonObject serviceInfo = new JsonObject()
+               JsonArray transportSliceNetworksList  = new JsonArray()
+               JsonArray connectionLinksList = new JsonArray()
+               JsonObject connectionLinks = new JsonObject()
+               if(action.equals("allocate")){
+                       Map<String, String> endpoints
+                       if(domainType.equals("TN_FH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
+                               serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
+                               allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid"))
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
+                               Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
+                               sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+                               String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                               allocateTnNssi.addProperty("sliceProfile", sliceProfileString)
+                               endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_RU"))
+                               endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN"))
+                               String endpointsString = objectMapper.writeValueAsString(endpoints)
+                               connectionLinksList.add(endpointsString)
+                       }else if(domainType.equals("TN_MH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
+                               serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
+                               allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid"))
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
+                               Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
+                               sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+                               String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                               allocateTnNssi.addProperty("sliceProfile", sliceProfileString)
+                               endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG"))
+                               endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
+                               String endpointsString = objectMapper.writeValueAsString(endpoints)
+                               connectionLinksList.add(endpointsString)
+                       }
+                       
+                       //Connection links
+                       connectionLinks.add("connectionLinks", connectionLinksList)
+                       transportSliceNetworksList.add(connectionLinks)
+                       allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
+                       allocateTnNssi.addProperty("nssiId", null)
+                       serviceInfo.addProperty("nssiId", null)
+               }else if(action.equals("modify-allocate")) {
+                       if(domainType.equals("TN_FH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", null)
+                               serviceInfo.addProperty("serviceUuid", null)
+                               allocateTnNssi.addProperty("nsstId", null)
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+                               allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+                               allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                               serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                       }else if(domainType.equals("TN_MH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", null)
+                               serviceInfo.addProperty("serviceUuid", null)
+                               allocateTnNssi.addProperty("nsstId", null)
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+                               allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+                               allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                               serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                       }
+               }
+               String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo")
+               allocateTnNssi.addProperty("nsiInfo", nsiInfo)
+               allocateTnNssi.addProperty("scriptName", "TN1")
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               response.addProperty("esrInfo", esrInfoString)
+               response.add("serviceInfo", serviceInfo)
+               response.add("allocateTnNssi", allocateTnNssi)
+               return response.toString()
+       }
+       
+       public String buildDeallocateNssiRequest(DelegateExecution execution,String domainType) {
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+          
+               JsonObject deAllocateNssi = new JsonObject()
+               deAllocateNssi.addProperty("snssaiList", execution.getVariable("snssaiList"))
+               deAllocateNssi.addProperty("nsiId", execution.getVariable("nsiId"))
+               deAllocateNssi.addProperty("modifyAction", true)
+               deAllocateNssi.addProperty("terminateNssiOption", 0)
+               deAllocateNssi.addProperty("scriptName", "TN1")
+               
+               if(domainType.equals("TN_FH")) {
+                       deAllocateNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                       deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+               }else if(domainType.equals("TN_MH")) {
+                       deAllocateNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                       deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+               }
+               
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setVendor("ONAP")
+               esrInfo.setNetworkType("TN")
+          
+               JsonObject serviceInfo = new JsonObject()
+               serviceInfo.addProperty("serviceInvariantUuid", null)
+               serviceInfo.addProperty("serviceUuid", null)
+               serviceInfo.addProperty("globalSubscriberId", globalSubscriberId)
+               serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType)
+          
+               JsonObject json = new JsonObject()
+               json.add("deAllocateNssi", deAllocateNssi)
+               json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+               json.add("serviceInfo", serviceInfo)
+               return json.toString()
+          
+       }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..4d86fb4
--- /dev/null
@@ -0,0 +1,589 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited. 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.onap.so.bpmn.infrastructure.scripts
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+import javax.ws.rs.NotFoundException
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.beans.nsmf.ActDeActNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonObject
+
+/**
+ * Internal AN NSSMF to handle NSSI Activation/Deactivation
+ *
+ */
+class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
+       
+       String Prefix="DoActivateAccessNSSI"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       ObjectMapper objectMapper = new ObjectMapper()
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+       private static final Logger logger = LoggerFactory.getLogger(DoActivateAccessNSSI.class)
+       private static final String ROLE_SLICE_PROFILE = "slice-profile-instance"
+       private static final String  ROLE_NSSI = "nssi"
+
+       private static final String KEY_SLICE_PROFILE = "SliceProfile"
+       private static final String KEY_NSSI = "NSSI"
+
+       private static final String AN_NF = "AN-NF"
+       private static final String TN_FH = "TN-FH"
+       private static final String TN_MH = "TN-MH"
+
+       private static final String ACTIVATE = "activateInstance"
+       private static final String DEACTIVATE = "deactivateInstance"
+
+       private static final String VENDOR_ONAP = "ONAP"
+
+       Map<String,String> orchStatusMap = new HashMap<>()
+
+       @Override
+       public void preProcessRequest(DelegateExecution execution) {
+               logger.debug("${Prefix} - Start preProcessRequest")
+
+               String sliceParams = execution.getVariable("sliceParams")
+               String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+               String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
+               String nsiId = execution.getVariable("nsiId")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String anNssiId = execution.getVariable("serviceInstanceID")
+               String operationType = execution.getVariable("operationType")
+
+               if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+                       String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               if( isBlank(anNssiId) || isBlank(globalSubscriberId) || isBlank(subscriptionServiceType) || isBlank(operationType)) {
+                       String msg = "Missing Input fields from main process : [serviceInstanceID, globalSubscriberId, subscriptionServiceType, operationType]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               execution.setVariable("sNssaiList", sNssaiList)
+               execution.setVariable("anSliceProfileId", anSliceProfileId)
+               execution.setVariable("nsiId", nsiId)
+               execution.setVariable("anNssiId", anNssiId)
+
+               orchStatusMap.put(ACTIVATE, "activated")
+               orchStatusMap.put(DEACTIVATE, "deactivated")
+
+               logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
+
+       }
+       
+       /**
+        * Method to fetch AN NSSI Constituents and Slice Profile constituents
+        * @param execution
+        */
+       void getRelatedInstances(DelegateExecution execution) {
+               logger.debug("${Prefix} - Get Related Instances")
+               String anSliceProfileId = execution.getVariable("anSliceProfileId")
+               String anNssiId = execution.getVariable("anNssiId")
+
+               Map<String,ServiceInstance> relatedSPs = new HashMap<>()
+               execution.setVariable("relatedSPs", getRelatedInstancesByRole(execution, ROLE_SLICE_PROFILE,KEY_SLICE_PROFILE, anSliceProfileId))
+
+               Map<String,ServiceInstance> relatedNssis = new HashMap<>()
+               execution.setVariable("relatedNssis", getRelatedInstancesByRole(execution, ROLE_NSSI,KEY_NSSI, anNssiId))
+               logger.trace("${Prefix} - Exit Get Related instances")
+       }
+       
+       /**
+        * Method to check Slice profile orchestration status
+        * @param execution
+        */
+       void getSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} - Start getSPOrchStatus")
+               ServiceInstance sliceProfileInstance = execution.getVariable(KEY_SLICE_PROFILE)
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeSPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeSPStatus", false)
+               }
+               logger.debug("${Prefix} -  SPOrchStatus  : ${orchStatus}")
+       }
+       
+       /**
+        * Method to check AN NF's  Slice profile instance orchestration status
+        * @param execution
+        */
+       void getAnNfSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} -  getAnNfSPOrchStatus ")
+               ServiceInstance sliceProfileInstance = getInstanceByWorkloadContext(execution.getVariable("relatedSPs"), AN_NF)
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), AN_NF)
+               execution.setVariable("anNfNssiId", anNfNssiId)
+               String anNfSPId = sliceProfileInstance.getServiceInstanceId()
+               execution.setVariable("anNfSPId", anNfSPId)
+
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeAN_NF_SPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeAN_NF_SPStatus", false)
+               }
+               logger.debug("${Prefix} -  getAnNfSPOrchStatus AN_NF SP ID:${anNfSPId}  : ${orchStatus}")
+       }
+
+       void prepareSdnrActivationRequest(DelegateExecution execution) {
+               logger.debug("${Prefix} - start prepareSdnrActivationRequest")
+               String operationType = execution.getVariable("operationType")
+               String action = operationType.equalsIgnoreCase(ACTIVATE) ? "activate":"deactivate"
+
+               String anNfNssiId = execution.getVariable("anNfNssiId")
+               String sNssai = execution.getVariable("sNssaiList")
+               String reqId = execution.getVariable("msoRequestId")
+               String messageType = "SDNRActivateResponse"
+               StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
+               callbackURL.append("/").append(messageType).append("/").append(reqId)
+
+               JsonObject input = new JsonObject()
+               input.addProperty("RANNFNSSIId", anNfNssiId)
+               input.addProperty("callbackURL", callbackURL.toString())
+               input.addProperty("s-NSSAI", sNssai)
+
+               JsonObject Payload = new JsonObject()
+               Payload.addProperty("version", "1.0")
+               Payload.addProperty("rpc-name", "activateRANSlice")
+               Payload.addProperty("correlation-id", reqId)
+               Payload.addProperty("type", "request")
+
+               JsonObject wrapinput = new JsonObject()
+               wrapinput.addProperty("Action", action)
+
+               JsonObject CommonHeader = new JsonObject()
+               CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+               CommonHeader.addProperty("APIver", "1.0")
+               CommonHeader.addProperty("RequestID", reqId)
+               CommonHeader.addProperty("SubRequestID", "1")
+
+               JsonObject body = new JsonObject()
+               body.add("input", wrapinput)
+
+               JsonObject sdnrRequest = new JsonObject()
+               Payload.add("input", input)
+               wrapinput.add("Payload", Payload)
+               wrapinput.add("CommonHeader", CommonHeader)
+               body.add("input", wrapinput)
+               sdnrRequest.add("body", body)
+
+               String json = sdnrRequest.toString()
+               execution.setVariable("sdnrRequest", sdnrRequest)
+               execution.setVariable("SDNR_messageType", messageType)
+               execution.setVariable("SDNR_timeout", "PT10M")
+
+               logger.debug("${Prefix} -  prepareSdnrActivationRequest : SDNR Request : ${json}")
+       }
+
+       void processSdnrResponse(DelegateExecution execution) {
+               logger.debug("${Prefix} processing SdnrResponse")
+               Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("SDNR_Response"),Map.class)
+               String status = resMap.get("status")
+               String reason = resMap.get("reason")
+               if("success".equalsIgnoreCase(status)) {
+                       execution.setVariable("isANactivationSuccess", true)
+               }else {
+                       execution.setVariable("isANactivationSuccess", false)
+                       logger.debug("AN NF Activation/Deactivation failed with reason ${reason}")
+               }
+               logger.debug("${Prefix} processed SdnrResponse")
+       }
+       
+       /**
+        * Update AN NF - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateAnNfStatus(DelegateExecution execution) {
+               logger.debug("${Prefix}Start updateAnNfStatus")
+               String anNfNssiId = execution.getVariable("anNfNssiId")
+               String anNfSPId =  execution.getVariable("anNfSPId")
+
+               updateOrchStatus(execution, anNfSPId)
+               updateOrchStatus(execution, anNfNssiId)
+               logger.debug("${Prefix}Exit  updateAnNfStatus")
+       }
+       
+       /**
+        * Method to check AN NF's  Slice profile instance orchestration status
+        * @param execution
+        */
+       void getTnFhSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} start getTnFhSPOrchStatus ")
+               ServiceInstance sliceProfileInstance = getInstanceByWorkloadContext(execution.getVariable("relatedSPs"), TN_FH)
+               String tnFhNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_FH)
+               execution.setVariable("tnFhNssiId", tnFhNssiId)
+               String tnFhSPId = sliceProfileInstance.getServiceInstanceId()
+               execution.setVariable("tnFhSPId", tnFhSPId)
+
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeTN_FH_SPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeTN_FH_SPStatus", false)
+               }
+
+               logger.debug("${Prefix} Exit getTnFhSPOrchStatus TN_FH SP ID:${tnFhSPId}  : ${orchStatus}")
+       }
+       
+       void doTnFhNssiActivation(DelegateExecution execution){
+               logger.debug("Start doTnFhNssiActivation in ${Prefix}")
+               String nssmfRequest = buildTNActivateNssiRequest(execution, TN_FH)
+               String operationType = execution.getVariable("operationType")
+               String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
+
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+               String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+
+               String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_FH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+               logger.debug("Exit doTnFhNssiActivation in ${Prefix}")
+       }
+
+       void getTnMhSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start getTnMhSPOrchStatus ")
+               ServiceInstance sliceProfileInstance = getInstanceByWorkloadContext(execution.getVariable("relatedSPs"), TN_MH)
+               String tnFhNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_MH)
+               execution.setVariable("tnMhNssiId", tnFhNssiId)
+               String tnFhSPId = sliceProfileInstance.getServiceInstanceId()
+               execution.setVariable("tnMhSPId", tnFhSPId)
+
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeTN_MH_SPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeTN_MH_SPStatus", false)
+               }
+                       logger.debug("${Prefix} Exit getTnMhSPOrchStatus TN_MH SP ID:${tnFhSPId}  : ${orchStatus}")
+       }
+       
+       void doTnMhNssiActivation(DelegateExecution execution){
+               logger.debug("Start doTnMhNssiActivation in ${Prefix}")
+               String nssmfRequest = buildTNActivateNssiRequest(execution, TN_MH)
+               String operationType = execution.getVariable("operationType")
+               String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
+
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+               String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+
+               String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_MH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+                               logger.debug("Exit doTnMhNssiActivation in ${Prefix}")
+               
+       }
+       
+       /**
+        * Update TN FH - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateTNFHStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start updateTNFHStatus")
+
+               String tnFhNssiId = execution.getVariable("tnFhNssiId")
+               String tnFhSPId =  execution.getVariable("tnFhSPId")
+               updateOrchStatus(execution, tnFhSPId)
+               updateOrchStatus(execution, tnFhNssiId)
+
+               logger.debug("${Prefix} Exit updateTNFHStatus")
+               
+       }
+       
+       /**
+        * Update TN MH - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateTNMHStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start updateTNMHStatus")
+
+               String tnMhNssiId = execution.getVariable("tnMhNssiId")
+               String tnMhSPId =  execution.getVariable("tnMhSPId")
+               updateOrchStatus(execution, tnMhSPId)
+               updateOrchStatus(execution, tnMhNssiId)
+
+               logger.debug("${Prefix} Exit updateTNMHStatus")
+       }
+       
+       /**
+        * Update AN - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateANStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start updateANStatus")
+               String anNssiId = execution.getVariable("anNssiId")
+               String anSliceProfileId =  execution.getVariable("anSliceProfileId")
+               updateOrchStatus(execution, anNssiId)
+               updateOrchStatus(execution, anSliceProfileId)
+               logger.debug("${Prefix} Start updateANStatus")
+       }
+       
+       void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
+               logger.debug("${Prefix} Start prepareQueryJobStatus : ${jobId}")
+               String responseId = "1"
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType(networkType)
+               esrInfo.setVendor(VENDOR_ONAP)
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setNssiId(instanceId)
+               serviceInfo.setNsiId(execution.getVariable("nsiId"))
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               execution.setVariable("${networkType}_esrInfo", esrInfo)
+               execution.setVariable("${networkType}_responseId", responseId)
+               execution.setVariable("${networkType}_serviceInfo", serviceInfo)
+               
+       }
+       
+       void validateJobStatus(DelegateExecution execution,String responseDescriptor) {
+               logger.debug("validateJobStatus ${responseDescriptor}")
+               String status = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.status")
+               String statusDescription = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.statusDescription")
+               if("finished".equalsIgnoreCase(status)) {
+                       execution.setVariable("isSuccess", true)
+               }else {
+                       execution.setVariable("isSuccess", false)
+               }
+       }
+       
+       
+       private void updateOrchStatus(DelegateExecution execution,String serviceId) {
+               logger.debug("${Prefix} Start updateOrchStatus : ${serviceId}")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String operationType = execution.getVariable("operationType")
+
+               try {
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                                       globalSubscriberId, subscriptionServiceType, serviceId)
+                       if (!client.exists(uri)) {
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+                       }
+                       AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+                       Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+                       if (si.isPresent()) {
+                               String orchStatus = si.get().getOrchestrationStatus()
+                               logger.debug("Orchestration status of instance ${serviceId} is ${orchStatus}")
+                               if (ACTIVATE.equalsIgnoreCase(operationType) && "deactivated".equalsIgnoreCase(orchStatus)) {
+                                               si.get().setOrchestrationStatus("activated")
+                                               client.update(uri, si.get())
+                               } else if(DEACTIVATE.equalsIgnoreCase(operationType) && "activated".equalsIgnoreCase(orchStatus)){
+                                               si.get().setOrchestrationStatus("deactivated")
+                                               client.update(uri, si.get())
+                               }
+                       }
+               } catch (Exception e) {
+                       logger.info("Service is already in active state")
+                       String msg = "Service is already in active state, " + e.getMessage()
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug("${Prefix} Exit updateOrchStatus : ${serviceId}")
+       }
+       
+       void prepareUpdateJobStatus(DelegateExecution execution,String status,String progress,String statusDescription) {
+               logger.debug("${Prefix} Start prepareUpdateJobStatus : ${statusDescription}")
+               String serviceId = execution.getVariable("anNssiId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String operationType = execution.getVariable("operationType")
+
+               ResourceOperationStatus roStatus = new ResourceOperationStatus()
+               roStatus.setServiceId(serviceId)
+               roStatus.setOperationId(jobId)
+               roStatus.setResourceTemplateUUID(nsiId)
+               roStatus.setOperType(operationType)
+               roStatus.setProgress(progress)
+               roStatus.setStatus(status)
+               roStatus.setStatusDescription(statusDescription)
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+       }
+       
+       
+       
+       /**
+        * Fetches a collection of service instances with the specific role and maps it based on workload context
+        * (AN-NF,TN-FH,TN-MH)
+        * @param execution
+        * @param role                  - nssi/slice profile instance
+        * @param key                   - NSSI/Sliceprofile corresponding to instanceId
+        * @param instanceId    - id to which the related list to be found
+        * @return
+        */
+       private Map<String,ServiceInstance> getRelatedInstancesByRole(DelegateExecution execution,String role,String key, String instanceId) {
+               logger.debug("${Prefix} - Fetching related ${role} from AAI")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               
+               if( isBlank(role) || isBlank(instanceId)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Role and instanceId are mandatory")
+               }
+
+               Map<String,ServiceInstance> relatedInstances = new HashMap<>()
+               
+               AAIResourcesClient client = getAAIClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                               globalSubscriberId, subscriptionServiceType, instanceId)
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               execution.setVariable(key, si.get())
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                               uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                                               globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+                               if (!client.exists(uri)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole())) {
+                                               relatedInstances.put(instance.getWorkloadContext(),instance)
+                                       }
+                               }
+                       }
+               }
+               }
+               logger.debug("Found ${relatedInstances.size()} ${role} related to ${instanceId} ")
+               return relatedInstances
+       }
+       
+       private ServiceInstance getInstanceByWorkloadContext(Map<String,ServiceInstance> instances,String workloadContext ) {
+               ServiceInstance instance = instances.get(workloadContext)
+               if(instance == null) {
+                       throw new BpmnError( 2500, "${workloadContext} Instance ID is not found.")
+               }
+               return instance
+       }
+       
+       private String getInstanceIdByWorkloadContext(Map<String,ServiceInstance> instances,String workloadContext ) {
+               String instanceId = instances.get(workloadContext).getServiceInstanceId()
+               if(instanceId == null) {
+                       throw new BpmnError( 2500, "${workloadContext} instance ID is not found.")
+               }
+               return instanceId
+       }
+       
+       
+       /**
+        * Method to handle deallocation of RAN NSSI constituents(TN_FH/TN_MH)
+        * @param execution
+        * @param serviceFunction - TN_FH/TN_MH
+        * @return
+        */
+       private String buildTNActivateNssiRequest(DelegateExecution execution,String serviceFunction) {
+               logger.debug("${Prefix} Exit buildTNActivateNssiRequest : ${serviceFunction}")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               Map<String, ServiceInstance> relatedNssis = execution.getVariable("relatedNssis")
+
+               String anNssiId = execution.getVariable("anNssiId")
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+
+               ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
+               String nssiId = tnNssi.getServiceInstanceId()
+
+               Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs")
+
+               ActDeActNssi actDeactNssi = new ActDeActNssi()
+               actDeactNssi.setNssiId(nssiId)
+               actDeactNssi.setNsiId(anNssiId)
+               actDeactNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
+               actDeactNssi.setSnssaiList(sNssaiList)
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setVendor(VENDOR_ONAP)
+               esrInfo.setNetworkType("TN")
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
+               serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               JsonObject json = new JsonObject()
+               json.addProperty("actDeActNssi", objectMapper.writeValueAsString(actDeactNssi))
+               json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+               json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+               return json.toString()
+               
+       }
+       
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
new file mode 100644 (file)
index 0000000..04fe161
--- /dev/null
@@ -0,0 +1,162 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+public class DoActivateTnNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNACT_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    private static final Logger logger = LoggerFactory.getLogger(DoActivateTnNssi.class)
+
+
+    public void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+
+        execution.setVariable("startTime", System.currentTimeMillis())
+        String msg = tnNssmfUtils.getExecutionInputParams(execution)
+        logger.debug("Activate TN NSSI input parameters: " + msg)
+
+        execution.setVariable("prefix", Prefix)
+
+        tnNssmfUtils.setSdncCallbackUrl(execution, true)
+        logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+        String sliceServiceInstanceId = execution.getVariable("serviceInstanceID")
+        execution.setVariable("sliceServiceInstanceId", sliceServiceInstanceId)
+
+        String sliceServiceInstanceName = execution.getVariable("servicename")
+        execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+        String operationType = execution.getVariable("operationType")
+        String actionType = operationType.equals("activateInstance") ? "activate" : "deactivate"
+        execution.setVariable("actionType", actionType)
+
+
+        logger.debug("Finish preProcessRequest")
+    }
+
+    void preprocessSdncActOrDeactTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preprocessSdncActivateTnNssiRequest(' +
+                'execution=' + execution.getId() + ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        try {
+            String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+            String actionType = execution.getVariable("actionType")
+
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, actionType)
+
+            execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preprocessSdncDeallocateTnNssiRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED preprocessSdncActivateTnNssiRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+
+
+    void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String tnNssiId = execution.getVariable("tnNssiId")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, tnNssiId)
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("serviceInstanceID")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operType = execution.getVariable("actionType")
+
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType(operType)
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..3df0d3d
--- /dev/null
@@ -0,0 +1,1041 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.sql.Timestamp
+import java.util.List
+import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.JsonObject
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonArray
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInstance
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.aai.AAINamespaceConstants
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.NetworkRoute
+
+class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
+
+       String Prefix="AASS_"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       OofUtils oofUtils = new OofUtils()
+       AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+       ObjectMapper objectMapper = new ObjectMapper();
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+       private static final Logger logger = LoggerFactory.getLogger(DoAllocateAccessNSSI.class)
+
+       @Override
+       void preProcessRequest(DelegateExecution execution) {
+               logger.debug(Prefix + "preProcessRequest Start")
+               execution.setVariable("prefix", Prefix)
+               execution.setVariable("startTime", System.currentTimeMillis())
+               def msg
+               try {
+
+                       logger.debug("input variables : msoRequestId - "+execution.getVariable("msoRequestId")
+                                       +" modelInvariantUuid - "+execution.getVariable("modelInvariantUuid")+
+                                       " modelUuid - "+execution.getVariable("modelUuid")+
+                                       " globalSubscriberId - "+execution.getVariable("globalSubscriberId")+
+                                       " dummyServiceId - "+ execution.getVariable("dummyServiceId")+
+                                       " nsiId - "+execution.getVariable("nsiId")+
+                                       " networkType - "+execution.getVariable("networkType")+
+                                       " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
+                                       " jobId - "+execution.getVariable("jobId")+
+                                       " sliceParams - "+execution.getVariable("sliceParams")+
+                                       " servicename - "+ execution.getVariable("servicename"))
+
+                       //validate slice subnet inputs
+
+                       String sliceParams = execution.getVariable("sliceParams")
+                       String sliceProfile = jsonUtil.getJsonValue(sliceParams, "sliceProfile")
+                       if (isBlank(sliceProfile)) {
+                               msg = "Input sliceProfile is null"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfile", sliceProfile)
+                       }
+                       String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
+                       def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
+                       def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList"))
+                       def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList"))
+
+                       if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty)
+                       || (coverageAreaTAList.empty)) {
+
+                               msg = "Mandatory slice profile fields are empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfileId", sliceProfileId)
+                               execution.setVariable("snssaiList", snssaiList)
+                               execution.setVariable("plmnIdList", plmnIdList)
+                               execution.setVariable("coverageAreaTAList", coverageAreaTAList)
+                       }
+                       String nsiName = jsonUtil.getJsonValue(sliceParams, "nsiInfo.nsiName")
+                       String scriptName = jsonUtil.getJsonValue(sliceParams, "scriptName")
+                       execution.setVariable("nsiName", nsiName)
+                       execution.setVariable("scriptName", scriptName)
+                       //generate RAN,RAN NF NSSIs - will be re assigned if oof returns existing NSSI
+                       String RANServiceInstanceId = UUID.randomUUID().toString()
+                       String RANNFServiceInstanceId = UUID.randomUUID().toString()
+                       logger.debug("RAN serviceInstance Id "+RANServiceInstanceId)
+                       logger.debug("RAN NF serviceInstance Id "+RANNFServiceInstanceId)                       
+                       execution.setVariable("RANServiceInstanceId", RANServiceInstanceId)
+                       execution.setVariable("RANNFServiceInstanceId", RANNFServiceInstanceId)
+                       execution.setVariable("ranNssiPreferReuse", true)
+                       execution.setVariable("ranNfNssiPreferReuse", true)
+                       execution.setVariable("job_timeout", 10)
+                       
+                       //set BH end point
+                       List<String> BH_endPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
+                       logger.debug("BH end points list : "+BH_endPoints)
+                       if(BH_endPoints.empty) {
+                               msg = "End point info is empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       }else {
+                               execution.setVariable("bh_endpoint", BH_endPoints.get(0))
+                       }
+                       
+               } catch(BpmnError e) {
+                       throw e
+               } catch(Exception ex) {
+                       msg = "Exception in DoAllocateAccessNSSI.preProcessRequest " + ex.getMessage()
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug(Prefix + "preProcessRequest Exit")
+       }
+
+       /*
+        * Prepare request params for decomposing RAN NSST
+        */
+
+       def prepareDecomposeService = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareDecomposeService method start")
+               String RANServiceInstanceId = execution.getVariable("RANServiceInstanceId")
+               String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+               String modelUuid = execution.getVariable("modelUuid")
+               String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+               execution.setVariable("serviceModelInfo", serviceModelInfo)
+               execution.setVariable("serviceInstanceId", RANServiceInstanceId)
+               logger.debug("serviceModelInfo : "+serviceModelInfo)
+               logger.debug("Finish RAN NSST prepareDecomposeService")
+       }
+
+       /* process the decompose service(RAN NSST) response
+        * 
+        */
+       def processDecomposition = { DelegateExecution execution ->
+               logger.debug(Prefix+"processDecomposition method start")
+               ServiceDecomposition ranNsstServiceDecomposition = execution.getVariable("ranNsstServiceDecomposition")
+               logger.debug("ranNsstServiceDecomposition : "+ranNsstServiceDecomposition.toString())
+               //RAN NSST decomposition
+               String ranModelVersion = ranNsstServiceDecomposition.getModelInfo().getModelVersion()
+               String ranModelName = ranNsstServiceDecomposition.getModelInfo().getModelName()
+               List<ServiceProxy> serviceProxyList = ranNsstServiceDecomposition.getServiceProxy()
+               List<String> nsstInfoList = new ArrayList<>()
+               for(ServiceProxy serviceProxy : serviceProxyList)
+               {
+                       String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid()
+                       String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid()
+                       String name = serviceProxy.getModelInfo().getModelName()
+                       String nsstServiceModelInfo = """{
+            "UUID":"${nsstModelUuid}",
+            "invariantUUID":"${nsstModelInvariantUuid}",
+            "name":"${name}"
+             }"""
+                       nsstInfoList.add(nsstServiceModelInfo)
+               }
+               int currentIndex=0
+               int maxIndex=nsstInfoList.size()
+               if(maxIndex < 1)
+               {
+                       String msg = "Exception in RAN NSST processDecomposition. There is no NSST associated with RAN NSST "
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               execution.setVariable("ranNsstInfoList",nsstInfoList)
+               execution.setVariable("ranModelVersion", ranModelVersion)
+               execution.setVariable("ranModelName", ranModelName)
+               execution.setVariable("currentIndex",currentIndex)
+               execution.setVariable("maxIndex",maxIndex)
+               logger.debug(Prefix+"processDecomposition maxIndex value - "+maxIndex)
+       }
+
+       /*
+        * Function to subnet capabilities from nssmf adapter
+        */
+       def getSubnetCapabilities = { DelegateExecution execution ->
+               logger.debug(Prefix+"getSubnetCapabilities method start")
+
+               String tnNssmfRequest = anNssmfUtils.buildCreateTNNSSMFSubnetCapabilityRequest()
+
+               String urlString = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
+
+               String tnNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, tnNssmfRequest)
+
+               if (tnNssmfResponse != null) {
+                       String FHCapabilities= jsonUtil.getJsonValue(tnNssmfResponse, "TN_FH")
+                       String MHCapabilities = jsonUtil.getJsonValue(tnNssmfResponse, "TN_MH")
+                       execution.setVariable("FHCapabilities",FHCapabilities)
+                       execution.setVariable("MHCapabilities",MHCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ tnNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               String anNssmfRequest = anNssmfUtils.buildCreateANNFNSSMFSubnetCapabilityRequest()
+
+               String anNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, anNssmfRequest)
+
+               if (anNssmfResponse != null) {
+                       String ANNFCapabilities = jsonUtil.getJsonValue(anNssmfResponse, "AN_NF")
+                       execution.setVariable("ANNFCapabilities",ANNFCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ anNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+       }
+
+       /*
+        * prepare OOF request for RAN NSSI selection
+        */
+       def prepareOofRequestForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareOofRequestForRanNSS method start")
+
+               String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+               logger.debug( "get NSSI option OOF Url: " + urlString)
+
+               //build oof request body
+               boolean ranNssiPreferReuse = execution.getVariable("ranNssiPreferReuse");
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "NSISelectionResponse"
+               Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+               String modelUuid = execution.getVariable("modelUuid")
+               String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+               String modelName = execution.getVariable("ranModelName")
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               List<String> nsstInfoList =  objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class)
+               JsonArray capabilitiesList = new JsonArray()
+               String FHCapabilities = execution.getVariable("FHCapabilities")
+               String MHCapabilities = execution.getVariable("MHCapabilities")
+               String ANNFCapabilities = execution.getVariable("ANNFCapabilities")
+               JsonObject FH = new JsonObject()
+               JsonObject MH = new JsonObject()
+               JsonObject ANNF = new JsonObject()
+               FH.addProperty("domainType", "TN_FH")
+               FH.addProperty("capabilityDetails", FHCapabilities)
+               MH.addProperty("domainType", "TN_MH")
+               MH.addProperty("capabilityDetails", MHCapabilities)
+               ANNF.addProperty("domainType", "AN_NF")
+               ANNF.addProperty("capabilityDetails", FHCapabilities)
+               capabilitiesList.add(FH)
+               capabilitiesList.add(MH)
+               capabilitiesList.add(ANNF)
+
+               execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+               execution.setVariable("nssiSelection_messageType",messageType)
+               execution.setVariable("nssiSelection_correlator",requestId)
+               execution.setVariable("nssiSelection_timeout",timeout)
+
+               String oofRequest = anNssmfUtils.buildSelectRANNSSIRequest(requestId, messageType, modelUuid,modelInvariantUuid,
+                               modelName, profileInfo, nsstInfoList, capabilitiesList, ranNssiPreferReuse)
+
+               execution.setVariable("nssiSelection_oofRequest",oofRequest)
+               logger.debug("Sending request to OOF: " + oofRequest)
+       }
+       /*
+        * process OOF response for RAN NSSI selection
+        */
+       def processOofResponseForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"processOofResponseForRanNSS method start")
+               String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
+               String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+               if(requestStatus.equals("completed")) {
+                       List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
+                       boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+                       if(existingNSI) {
+                               def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution")
+                               execution.setVariable("sharedRanNSSISolution", sharedNSISolution)
+                               logger.debug("sharedRanNSSISolution from OOF "+sharedNSISolution)
+                               String RANServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId")
+                               execution.setVariable("RANServiceInstanceId", RANServiceInstanceId)
+                               ServiceInstance serviceInstance = new ServiceInstance();
+                               serviceInstance.setInstanceId(RANServiceInstanceId);
+                               ServiceDecomposition serviceDecomposition = execution.getVariable("ranNsstServiceDecomposition")
+                               serviceDecomposition.setServiceInstance(serviceInstance);
+                               execution.setVariable("ranNsstServiceDecomposition", serviceDecomposition)
+                               execution.setVariable("isRspRanNssi", true)
+                       }else {
+                               def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
+                               execution.setVariable("RanConstituentSliceProfiles", sliceProfiles)
+                               logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles)
+                       }
+               }else {
+                       String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                       logger.error("received failed status from oof "+ statusMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+               }
+
+       }
+
+       def prepareModifyAccessNssiInputs = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareModifyAccessNssiInputs method start")
+               String jobId = UUID.randomUUID().toString()
+               execution.setVariable("modifyRanNssiJobId", jobId)              
+               String snssaiList = execution.getVariable("snssaiList")
+               String sliceParams = execution.getVariable("sliceParams")
+               String sliceProfileId = execution.getVariable("sliceProfileId")
+               String nsiInfo = jsonUtil.getJsonValue(sliceParams, "nsiInfo")
+               String scriptName = execution.getVariable("scriptName")
+               
+               JsonObject modifySliceParams = new JsonObject()
+               modifySliceParams.addProperty("modifyAction", "allocate")
+               modifySliceParams.addProperty("snssaiList", snssaiList)
+               modifySliceParams.addProperty("sliceProfileId", sliceProfileId)
+               modifySliceParams.addProperty("nsiInfo", nsiInfo)
+               modifySliceParams.addProperty("scriptName", scriptName)
+               
+               execution.setVariable("modifySliceParams", modifySliceParams.toString())
+               //create operation status in request db
+               String serviceId = execution.getVariable("RANServiceInstanceId")
+               String nsiId = execution.getVariable("nsiId")
+               logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
+
+               ResourceOperationStatus initStatus = new ResourceOperationStatus()
+               initStatus.setServiceId(serviceId)
+               initStatus.setOperationId(jobId)
+               initStatus.setResourceTemplateUUID(nsiId)
+               initStatus.setOperType("Modify")
+               requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+       }
+       
+       def createModifyNssiQueryJobStatus = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("AN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               execution.setVariable("esrInfo", esrInfoString)
+               JsonObject serviceInfo = new JsonObject()
+               serviceInfo.addProperty("nssiId", execution.getVariable("RANServiceInstanceId"))
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               serviceInfo.addProperty("nssiName", execution.getVariable("servicename"))
+               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               serviceInfo.addProperty("sST", sST)
+               serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("modelInvariantUuid"))
+               serviceInfo.addProperty("serviceUuid", execution.getVariable("modelUuid"))
+               execution.setVariable("serviceInfo", serviceInfo.toString())
+               execution.setVariable("responseId", "")
+       }
+       def prepareNsstDecomposeService = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareNsstDecomposeService method start")
+               List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("ranNsstInfoList"), List.class)
+               int currentIndex = execution.getVariable("currentIndex")
+               int maxIndex = execution.getVariable("maxIndex")
+               logger.debug(Prefix+"prepareNsstDecomposeService : currentIndex value - "+currentIndex+" maxIndex : "+maxIndex)
+               if(currentIndex<maxIndex) {
+                       String nsstInfo = nsstInfoList.get(currentIndex)
+                       String modelInvariantUuid = jsonUtil.getJsonValue(nsstInfo, "invariantUUID")
+                       String modelUuid = jsonUtil.getJsonValue(nsstInfo, "UUID")
+                       
+                       String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+                       execution.setVariable("serviceModelInfo", serviceModelInfo)
+                       execution.setVariable("serviceInstanceId", "")
+                       logger.debug("serviceModelInfo : "+serviceModelInfo)
+                       currentIndex++
+                       execution.setVariable("currentIndex", currentIndex)
+               }else {
+                       logger.error("nsstList decomposition error ")
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000, "nsstList decomposition error ")
+               }
+               
+       }
+       def processNsstDecomposition = { DelegateExecution execution ->
+               logger.debug(Prefix+"processNsstDecomposition method start")
+               ServiceDecomposition decomposedNsst = execution.getVariable("nsstServiceDecomposition")
+               logger.debug("decomposedNsst : "+decomposedNsst.toString())
+               
+               String nsstType = decomposedNsst.getServiceRole() //domainType
+               String modelVersion = decomposedNsst.getModelInfo().getModelVersion()
+               String modelName = decomposedNsst.getModelInfo().getModelName()
+               String modelUuid = decomposedNsst.getModelInfo().getModelUuid()
+               String modelInvariantUuid = decomposedNsst.getModelInfo().getModelInvariantUuid()
+               
+               switch(nsstType) {
+                       case "AN_NF":
+                               execution.setVariable("ANNF_modelInvariantUuid", modelInvariantUuid)
+                               execution.setVariable("ANNF_modelUuid", modelUuid)
+                               execution.setVariable("ANNF_modelVersion", modelVersion)
+                               execution.setVariable("ANNF_modelName", modelName)
+                               execution.setVariable("ANNF_ServiceDecomposition", decomposedNsst)
+                               break
+                       case "TN_FH":
+                               execution.setVariable("TNFH_modelInvariantUuid", modelInvariantUuid)
+                               execution.setVariable("TNFH_modelUuid", modelUuid)
+                               execution.setVariable("TNFH_modelVersion", modelVersion)
+                               execution.setVariable("TNFH_modelName", modelName)
+                               execution.setVariable("TNFH_ServiceDecomposition", decomposedNsst)
+                               break
+                       case "TN_MH":
+                               execution.setVariable("TNMH_modelInvariantUuid", modelInvariantUuid)
+                               execution.setVariable("TNMH_modelUuid", modelUuid)
+                               execution.setVariable("TNMH_modelVersion", modelVersion)
+                               execution.setVariable("TNMH_modelName", modelName)
+                               execution.setVariable("TNMH_ServiceDecomposition", decomposedNsst)
+                               break
+                       default:
+                               logger.debug("No expected match found for current nsstType")
+                               logger.error("No expected match found for current nsstType "+ nsstType)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current nsstType "+ nsstType)
+               }
+               boolean isAllNsstsDecomposed = false
+               int currentIndex = execution.getVariable("currentIndex")
+               int maxIndex = execution.getVariable("maxIndex")
+               if(currentIndex == maxIndex) {
+                       isAllNsstsDecomposed = true
+               }
+               execution.setVariable("isAllNsstsDecomposed", isAllNsstsDecomposed)
+       }
+       /*
+        * prepare OOF request for NF RAN NSSI selection
+        */
+       def prepareOofRequestForRanNfNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareOofRequestForRanNfNSS method start")
+               String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+               logger.debug( "get NSSI option OOF Url: " + urlString)
+
+               //build oof request body
+               boolean ranNfNssiPreferReuse = execution.getVariable("ranNfNssiPreferReuse");
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "NSSISelectionResponse"
+               List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(execution.getVariable("RanConstituentSliceProfiles"))
+               anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
+               Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
+               String modelUuid = execution.getVariable("ANNF_modelUuid")
+               String modelInvariantUuid = execution.getVariable("ANNF_modelInvariantUuid")
+               String modelName = execution.getVariable("ANNF_modelName")
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+
+               execution.setVariable("nssiSelection_Url", "/api/oof/selection/nssi/v1")
+               execution.setVariable("nssiSelection_messageType",messageType)
+               execution.setVariable("nssiSelection_correlator",requestId)
+               execution.setVariable("nssiSelection_timeout",timeout)
+
+               String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, modelUuid, modelInvariantUuid, modelName, profileInfo)
+
+               execution.setVariable("nssiSelection_oofRequest",oofRequest)
+       }
+       /*
+        * process OOF response for RAN NF NSSI selection
+        */
+       def processOofResponseForRanNfNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"processOofResponseForRanNfNSS method start")
+               String oofResponse = execution.getVariable("nfNssiSelection_asyncCallbackResponse")
+               String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+               if(requestStatus.equals("completed")) {
+                       List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))             
+                       if(solution.size()>=1) {
+                               String ranNfNssiId = jsonUtil.getJsonValue(solution.get(0), "NSSIId")
+                               String invariantUuid = jsonUtil.getJsonValue(solution.get(0), "invariantUUID")
+                               String uuid = jsonUtil.getJsonValue(solution.get(0), "UUID")
+                               String nssiName = jsonUtil.getJsonValue(solution.get(0), "NSSIName")
+                               execution.setVariable("RANNFServiceInstanceId", ranNfNssiId)
+                               execution.setVariable("RANNFInvariantUUID", invariantUuid)
+                               execution.setVariable("RANNFUUID", uuid)
+                               execution.setVariable("RANNFNssiName", nssiName)
+                               logger.debug("RANNFServiceInstanceId from OOF "+ranNfNssiId)
+                               
+                               ServiceInstance serviceInstance = new ServiceInstance();
+                               serviceInstance.setInstanceId(ranNfNssiId);
+                               ServiceDecomposition serviceDecomposition = execution.getVariable("ANNF_ServiceDecomposition")
+                               serviceDecomposition.setServiceInstance(serviceInstance);
+                               execution.setVariable("ANNF_ServiceDecomposition", serviceDecomposition)
+                               execution.setVariable("isRspRanNfNssi", true)
+                       }else {
+                               logger.debug("No solutions returned from OOF .. Create new RAN NF NSSI")
+                       }
+               }else {
+                       String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                       logger.error("received failed status from oof "+ statusMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+               }
+       }
+
+       def createSliceProfilesInAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSliceProfilesInAai method start")
+               anNssmfUtils.createSliceProfilesInAai(execution)
+       }
+
+       def processRanNfModifyRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processRanNfModifyRsp method start")
+               anNssmfUtils.processRanNfModifyRsp(execution)
+               //create RAN NSSI 
+               org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new ServiceInstance();
+               //AN instance creation
+               ANServiceInstance.setServiceInstanceId(execution.getVariable("RANServiceInstanceId"))
+               String sliceInstanceName = execution.getVariable("servicename")
+               ANServiceInstance.setServiceInstanceName(sliceInstanceName)
+               String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               ANServiceInstance.setServiceType(serviceType)
+               String serviceStatus = "deactivated"
+               ANServiceInstance.setOrchestrationStatus(serviceStatus)
+               String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
+               ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+               String serviceRole = "nssi"
+               ANServiceInstance.setServiceRole(serviceRole)
+               List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+               String snssai = snssaiList.get(0)
+               ANServiceInstance.setEnvironmentContext(snssai)
+               ANServiceInstance.setWorkloadContext("AN")
+               
+               logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
+               String msg = ""
+               try {
+       
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("RANServiceInstanceId"))
+                       client.create(nssiServiceUri, ANServiceInstance)
+       
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+                       msg = "Exception in AnNssmfUtils.createSliceProfilesInAai " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               //end point update
+               createEndPointsInAai(execution)
+       }
+       
+       def createSdnrRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSdnrRequest method start")
+               String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
+               String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "InstantiateRANSlice", callbackUrl)
+               execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
+               execution.setVariable("createNSSI_timeout", "PT10M")
+               execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
+               execution.setVariable("createNSSI_messageType", "AsyncSdnrResponse");
+       }
+
+       def processSdnrResponse = { DelegateExecution execution ->
+               logger.debug(Prefix+"processSdnrResponse method start")
+               String SDNRResponse = execution.getVariable("SDNR_asyncCallbackResponse")
+               String status = jsonUtil.getJsonValue(SDNRResponse, "status")
+               if(status.equalsIgnoreCase("success")) {
+                       String nfIds = jsonUtil.getJsonValue(SDNRResponse, "nfIds")
+                       execution.setVariable("ranNfIdsJson", nfIds)
+               }else {
+                       String reason = jsonUtil.getJsonValue(SDNRResponse, "reason")
+                       logger.error("received failed status from SDNR "+ reason)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from SDNR "+ reason)
+               }
+               logger.debug("response from SDNR "+SDNRResponse)
+       }
+
+       def updateAaiWithRANInstances = { DelegateExecution execution ->
+               logger.debug(Prefix+"updateAaiWithRANInstances method start")
+               //create RAN NSSI 
+               org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new ServiceInstance();
+               org.onap.aai.domain.yang.ServiceInstance ANNFServiceInstance = new ServiceInstance();
+               //AN instance creation
+               ANServiceInstance.setServiceInstanceId(execution.getVariable("RANServiceInstanceId"))
+               String sliceInstanceName = execution.getVariable("servicename")
+               ANServiceInstance.setServiceInstanceName(sliceInstanceName)
+               String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               ANServiceInstance.setServiceType(serviceType)
+               String serviceStatus = "deactivated"
+               ANServiceInstance.setOrchestrationStatus(serviceStatus)
+               String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
+               ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+               String serviceRole = "nssi"
+               ANServiceInstance.setServiceRole(serviceRole)
+               List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+               String snssai = snssaiList.get(0)
+               ANServiceInstance.setEnvironmentContext(snssai)
+               ANServiceInstance.setWorkloadContext("AN")
+               
+               logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
+               //create RAN NF NSSI
+               ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId"))
+               sliceInstanceName = execution.getVariable("ANNF_modelName")
+               ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
+               ANNFServiceInstance.setServiceType(serviceType)
+               ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
+               serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
+               ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+               ANNFServiceInstance.setServiceRole(serviceRole)
+               snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+               snssai = snssaiList.get(0)
+               ANNFServiceInstance.setEnvironmentContext(snssai)
+               ANNFServiceInstance.setWorkloadContext("AN-NF")
+               logger.debug("completed AN service instance build "+ ANNFServiceInstance.toString())
+               
+               String msg = ""
+               try {
+       
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("RANServiceInstanceId"))
+                       client.create(nssiServiceUri, ANServiceInstance)
+       
+                       AAIResourceUri nssiServiceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("RANNFServiceInstanceId"))
+                       client.create(nssiServiceUri1, ANNFServiceInstance)
+       
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+                       msg = "Exception in AnNssmfUtils.createSliceProfilesInAai " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               //end point update
+               createEndPointsInAai(execution)
+       }
+       def prepareTnFhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_FH", "allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNFH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnFhRequest")
+
+       }
+       def prepareTnMhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnMhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_MH", "allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNMH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnMhRequest")
+       }
+       
+       def createFhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_FH")                
+       }
+       
+       def createMhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_MH")
+       }
+       
+       private void createTnAllocateNssiJobQuery(DelegateExecution execution, String domainType) {
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("TN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               execution.setVariable("esrInfo", esrInfoString)
+               JsonObject serviceInfo = new JsonObject()
+               serviceInfo.addProperty("nssiId", null)
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               serviceInfo.addProperty("sST", sST)
+               serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               if(domainType.equals("TN_FH")) {
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
+                       serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
+                       serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
+               }else if(domainType.equals("TN_MH")) {
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
+                       serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
+                       serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
+               }
+               execution.setVariable("serviceInfo", serviceInfo.toString())
+               execution.setVariable("responseId", "")
+       }
+       
+       def processFhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNFH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       execution.setVariable("TNFH_NSSI", nssi)
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def processMhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNMH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       execution.setVariable("TNMH_NSSI", nssi)
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def processModifyJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+
+       def updateAairelationships = { DelegateExecution execution ->
+               logger.debug(Prefix + "updateAairelationships Start")
+               String msg = ""
+               try {
+                       def ANNF_serviceInstanceId = execution.getVariable("RANNFServiceInstanceId")
+                       def TNFH_serviceInstanceId = execution.getVariable("TNFH_NSSI")
+                       def TNMH_serviceInstanceId = execution.getVariable("TNMH_NSSI")
+                       def AN_profileInstanceId = execution.getVariable("sliceProfileId")
+                       def AN_NSSI = execution.getVariable("RANServiceInstanceId")
+                       def ANNF_profileInstanceId = execution.getVariable("ANNF_sliceProfileInstanceId")
+                       def TNFH_profileInstanceId = execution.getVariable("TNFH_sliceProfileInstanceId")
+                       def TNMH_profileInstanceId = execution.getVariable("TNMH_sliceProfileInstanceId")
+                       String globalSubscriberId = execution.getVariable("globalSubscriberId")
+                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+                       Relationship ANNF_relationship = new Relationship()
+                       Relationship TNFH_relationship = new Relationship()
+                       Relationship TNMH_relationship = new Relationship()
+                       
+                       String ANNF_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${ANNF_profileInstanceId}"
+                       String TNFH_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNFH_profileInstanceId}"
+                       String TNMH_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNMH_profileInstanceId}"
+                       
+                       String ANNF_NSSI_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${ANNF_serviceInstanceId}"
+                       String TNFH_NSSI_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNFH_serviceInstanceId}"
+                       String TNMH_NSSI_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNMH_serviceInstanceId}"
+                       
+                       ANNF_relationship.setRelatedLink(ANNF_relatedLink)
+                       ANNF_relationship.setRelatedTo("service-instance")
+                       ANNF_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNFH_relationship.setRelatedLink(TNFH_relatedLink)
+                       TNFH_relationship.setRelatedTo("service-instance")
+                       TNFH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNMH_relationship.setRelatedLink(TNMH_relatedLink)
+                       TNMH_relationship.setRelatedTo("service-instance")
+                       TNMH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       
+                       // create SliceProfile and NSSI relationship in AAI
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,ANNF_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,TNFH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,TNMH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,AN_profileInstanceId)
+                       
+                       //create AN NSSI and ANNF,TNFH,TNMH relationship in AAI
+                       ANNF_relationship.setRelatedLink(ANNF_NSSI_relatedLink)
+                       TNFH_relationship.setRelatedLink(TNFH_NSSI_relatedLink)
+                       TNMH_relationship.setRelatedLink(TNMH_NSSI_relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,AN_NSSI)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,AN_NSSI)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,AN_NSSI)
+
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+
+                       msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+       }
+       
+       /**
+        * update operation status in request db
+        *
+        */
+       def prepareOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareOperationStatusUpdate Start")
+
+               String serviceId = execution.getVariable("dummyServiceId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("RANServiceInstanceId")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Allocate")
+               updateStatus.setProgress(100)
+               updateStatus.setStatus("finished")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+
+               logger.debug(Prefix + "prepareOperationStatusUpdate Exit")
+       }
+
+       def prepareFailedOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start")
+               
+               String serviceId = execution.getVariable("dummyServiceId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("RANServiceInstanceId")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Allocate")
+               updateStatus.setProgress(0)
+               updateStatus.setStatus("failed")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+       }
+       
+       private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) {
+               
+               String requestId = execution.getVariable("msoRequestId")
+               Date date = new Date().getTime()
+               Timestamp time = new Timestamp(date)
+               Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
+               sliceProfile.put("sliceProfileId", execution.getVariable("ANNF_sliceProfileInstanceId"))
+               sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+               sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
+               sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
+               String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+               JsonObject response = new JsonObject()
+               JsonObject body = new JsonObject()
+               JsonObject input = new JsonObject()
+               JsonObject commonHeader = new JsonObject()
+               JsonObject payload = new JsonObject()
+               JsonObject payloadInput = new JsonObject()
+               commonHeader.addProperty("TimeStamp", time.toString())
+               commonHeader.addProperty("APIver", "1.0")
+               commonHeader.addProperty("RequestID", requestId)
+               commonHeader.addProperty("SubRequestID", "1")
+               commonHeader.add("RequestTrack", new JsonObject())
+               commonHeader.add("Flags", new JsonObject())
+               payloadInput.addProperty("sliceProfile", sliceProfileString)
+               payloadInput.addProperty("RANNSSIId", execution.getVariable("RANServiceInstanceId"))
+               payloadInput.addProperty("NSIID", execution.getVariable("nsiId"))
+               payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId"))
+               payloadInput.addProperty("callbackURL", callbackUrl)
+               payloadInput.add("additionalproperties", new JsonObject())
+               payload.add("input", payloadInput)
+               input.add("CommonHeader", commonHeader)
+               input.addProperty("Action", action)
+               input.add("Payload", payload)
+               body.add("input", input)
+               response.add("body", body)
+               response.addProperty("version", "1.0")
+               response.addProperty("rpc-name", rpcName)
+               response.addProperty("correlation-id", requestId+"-1")
+               response.addProperty("type", "request")
+               return response.toString()
+       }
+       
+       private void createEndPointsInAai(DelegateExecution execution) {
+               String type = "endpoint"
+               String function = "transport_EP"
+               int prefixLength = 24
+               String addressFamily = "ipv4"
+               //BH RAN end point update
+               String bh_endpoint = execution.getVariable("bh_endpoint")
+               String bh_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_bh", bh_routeId)
+               String role = "CU"
+               String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
+               String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+               String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
+               NetworkRoute bh_ep = new NetworkRoute()
+               bh_ep.setRouteId(bh_routeId)
+               bh_ep.setFunction(function)
+               bh_ep.setRole(role)
+               bh_ep.setType(type)
+               bh_ep.setIpAddress(CU_IpAddress)
+               bh_ep.setLogicalInterfaceId(LogicalLinkId)
+               bh_ep.setNextHop(nextHopInfo)
+               bh_ep.setPrefixLength(prefixLength)
+               bh_ep.setAddressFamily(addressFamily)
+               //FH RAN end points update
+               //RU
+               String RU_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_RU", RU_routeId)
+               role = "RU"
+               NetworkRoute RU_ep = new NetworkRoute()
+               RU_ep.setRouteId(RU_routeId)
+               RU_ep.setFunction(function)
+               RU_ep.setRole(role)
+               RU_ep.setType(type)
+               RU_ep.setIpAddress("192.168.100.4")
+               RU_ep.setLogicalInterfaceId("1234")
+               RU_ep.setNextHop("Host1")
+               RU_ep.setPrefixLength(prefixLength)
+               RU_ep.setAddressFamily(addressFamily)
+               //DU Ingress
+               String DUIN_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_DUIN", DUIN_routeId)
+               role = "DU"
+               NetworkRoute DU_ep = new NetworkRoute()
+               DU_ep.setRouteId(DUIN_routeId)
+               DU_ep.setFunction(function)
+               DU_ep.setRole(role)
+               DU_ep.setType(type)
+               DU_ep.setIpAddress("192.168.100.5")
+               DU_ep.setLogicalInterfaceId("1234")
+               DU_ep.setNextHop("Host2")
+               DU_ep.setPrefixLength(prefixLength)
+               DU_ep.setAddressFamily(addressFamily)
+               //MH RAN end point update
+               //DUEG
+               String DUEG_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_DUEG", DUEG_routeId)
+               NetworkRoute DUEG_ep = new NetworkRoute()
+               DU_ep.setRouteId(DUEG_routeId)
+               DU_ep.setNextHop("Host3")
+               //CUIN
+               String CUIN_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_CUIN", CUIN_routeId)
+               NetworkRoute CUIN_ep = new NetworkRoute()
+               CUIN_ep.setRouteId(CUIN_routeId)
+               CUIN_ep.setFunction(function)
+               CUIN_ep.setRole(role)
+               CUIN_ep.setType(type)
+               CUIN_ep.setIpAddress("192.168.100.6")
+               CUIN_ep.setLogicalInterfaceId("1234")
+               CUIN_ep.setNextHop("Host4")
+               CUIN_ep.setPrefixLength(prefixLength)
+               CUIN_ep.setAddressFamily(addressFamily)
+               try {
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString())
+                       AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId)
+                       client.create(networkRouteUri, bh_ep)
+                       logger.debug("creating RU endpoint . ID : "+RU_routeId+" node details : "+RU_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), RU_routeId)
+                       client.create(networkRouteUri, RU_ep)
+                       logger.debug("creating DUIN endpoint . ID : "+DUIN_routeId+" node details : "+DU_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), DUIN_routeId)
+                       client.create(networkRouteUri, DU_ep)
+                       logger.debug("creating DUEG endpoint . ID : "+DUEG_routeId+" node details : "+DU_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), DUEG_routeId)
+                       client.create(networkRouteUri, DU_ep)
+                       logger.debug("creating CUIN endpoint . ID : "+CUIN_routeId+" node details : "+CUIN_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), CUIN_routeId)
+                       client.create(networkRouteUri, CUIN_ep)
+                       //relationship b/w bh_ep and RAN NSSI
+                       def AN_NSSI = execution.getVariable("RANServiceInstanceId")
+                       Relationship relationship = new Relationship()
+                       String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"               
+                       relationship.setRelatedLink(relatedLink)
+                       relationship.setRelatedTo("network-route")
+                       relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, AN_NSSI)
+                       def ANNF_serviceInstanceId = execution.getVariable("RANNFServiceInstanceId")
+                       relatedLink = "aai/v21/network/network-routes/network-route/${RU_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+                       relatedLink = "aai/v21/network/network-routes/network-route/${DUIN_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+                       relatedLink = "aai/v21/network/network-routes/network-route/${DUEG_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+                       relatedLink = "aai/v21/network/network-routes/network-route/${CUIN_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+               } catch (BpmnError e) {
+               throw e
+       } catch (Exception ex) {
+               String msg = "Exception in createEndPointsInAai " + ex.getMessage()
+               logger.info(msg)
+               exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+       }
+       }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSIV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSIV2.groovy
new file mode 100644 (file)
index 0000000..924b42f
--- /dev/null
@@ -0,0 +1,613 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.apache.commons.lang3.StringUtils
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.beans.nsmf.*
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+
+class DoAllocateNSIandNSSIV2 extends AbstractServiceTaskProcessor{
+
+    private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSIV2.class);
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+    JsonUtils jsonUtil = new JsonUtils()
+
+    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+    AAIResourcesClient client = getAAIClient()
+
+    /**
+     * Pre Process the BPMN Flow Request
+     * Inclouds:
+     * generate the nsOperationKey
+     * generate the nsParameters
+     */
+
+    void preProcessRequest (DelegateExecution execution) {
+        String msg = ""
+        logger.trace("Enter preProcessRequest()")
+        Map<String, Object> nssiMap = new HashMap<>()
+        execution.setVariable("nssiMap", nssiMap)
+        boolean isMoreNSSTtoProcess = true
+        execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess)
+        List<String> nsstSequence = new ArrayList<>(Arrays.asList("cn"))
+        execution.setVariable("nsstSequence", nsstSequence)
+        logger.trace("Exit preProcessRequest")
+    }
+
+    /**
+     * Process NSI options
+     * @param execution
+     */
+    void retriveSliceOption(DelegateExecution execution) {
+        logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI")
+
+        boolean isNSIOptionAvailable
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+//        try
+//        {
+//            Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
+//            String modelUuid = nstSolution.get("UUID")
+//            String modelInvariantUuid = nstSolution.get("invariantUUID")
+//            String serviceModelInfo = """{
+//            "modelInvariantUuid":"${modelInvariantUuid}",
+//            "modelUuid":"${modelUuid}",
+//            "modelVersion":""
+//             }"""
+//            execution.setVariable("serviceModelInfo", serviceModelInfo)
+//
+//            execution.setVariable("sliceParams", sliceParams)
+//        }catch (Exception ex) {
+//            logger.debug( "Unable to get the task information from request DB: " + ex)
+//            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.")
+//        }
+
+        if(StringUtils.isBlank(sliceParams.getSuggestNsiId())) {
+            isNSIOptionAvailable = false
+        }
+        else {
+            isNSIOptionAvailable = true
+            execution.setVariable('nsiServiceInstanceId', sliceParams.getSuggestNsiId())
+            execution.setVariable('nsiServiceInstanceName', sliceParams.getSuggestNsiName())
+        }
+        execution.setVariable("isNSIOptionAvailable", isNSIOptionAvailable)
+        logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI")
+    }
+
+
+    /**
+     * create nsi instance in aai
+     * @param execution
+     */
+    void createNSIinAAI(DelegateExecution execution) {
+        logger.debug("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()")
+
+        String sliceInstanceId = UUID.randomUUID().toString()
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        sliceParams.setServiceId(sliceInstanceId)
+
+        ServiceInstance nsi = new ServiceInstance()
+
+
+        String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName")
+        String serviceType = execution.getVariable("serviceType")
+        String serviceStatus = "deactivated"
+        String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID
+        String modelUuid = sliceParams.getNSTInfo().UUID
+
+        String uuiRequest = execution.getVariable("uuiRequest")
+        String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
+        String serviceRole = "nsi"
+
+        execution.setVariable("sliceInstanceId", sliceInstanceId)
+        nsi.setServiceInstanceId(sliceInstanceId)
+        nsi.setServiceInstanceName(sliceInstanceName)
+        nsi.setServiceType(serviceType)
+        nsi.setOrchestrationStatus(serviceStatus)
+        nsi.setModelInvariantId(modelInvariantUuid)
+        nsi.setModelVersionId(modelUuid)
+        nsi.setServiceInstanceLocationId(serviceInstanceLocationid)
+        nsi.setServiceRole(serviceRole)
+        String msg
+        try {
+
+            AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                    execution.getVariable("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"),
+                    sliceInstanceId)
+            client.create(nsiServiceUri, nsi)
+
+            execution.setVariable("nsiServiceUri", nsiServiceUri.build().toString())
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()")
+    }
+
+
+    /**
+     * create relationship between nsi and service profile instance
+     * @param execution
+     */
+    void createRelationship(DelegateExecution execution) {
+        //relation ship
+        Relationship relationship = new Relationship()
+        String nsiServiceUri = execution.getVariable("nsiServiceUri") as String
+        logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri)
+
+        relationship.setRelatedLink(nsiServiceUri)
+
+        AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(
+                AAIObjectType.ALLOTTED_RESOURCE,
+                execution.getVariable("globalSubscriberId"),
+                execution.getVariable("subscriptionServiceType"),
+                execution.getVariable("sliceServiceInstanceId"),
+                execution.getVariable("allottedResourceId"))
+                .relationshipAPI()
+        client.create(allottedResourceUri, relationship)
+    }
+
+    /**
+     *
+     * @param execution
+     */
+    void updateRelationship(DelegateExecution execution) {
+        logger.debug("Enter update relationship in DoAllocateNSIandNSSI()")
+        String allottedResourceId = execution.getVariable("allottedResourceId")
+        //Need to check whether nsi exist : Begin
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+
+        String nsiServiceInstanceID = sliceParams.getSuggestNsiId()
+        sliceParams.setServiceId(nsiServiceInstanceID)
+
+        AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                execution.getVariable("globalSubscriberId"),
+                execution.getVariable("subscriptionServiceType"),
+                nsiServiceInstanceID)
+
+        try {
+            AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class)
+            Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+            //todo: if exists
+            if (!si.ifPresent()) {
+                String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+            }
+
+            AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
+                    execution.getVariable("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"),
+                    execution.getVariable("sliceServiceInstanceId"),
+                    allottedResourceId)
+
+            client.connect(allottedResourceUri, nsiServiceUri)
+
+            execution.setVariable("sliceParams", sliceParams)
+        }catch(BpmnError e) {
+            throw e
+        }catch (Exception ex){
+            String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Exit update relationship in DoAllocateNSIandNSSI()")
+    }
+
+    /**
+     * create RAN Slice Profile Instance
+     * @param execution
+     */
+    void createAnSliceProfileInstance(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        String serviceInstanceId = UUID.randomUUID().toString()
+        execution.setVariable("ranSliceProfileInstanceId", serviceInstanceId) //todo:
+
+        String serviceType = ""
+        String serviceRole = "slice-profile"
+        String oStatus = "deactivated"
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        sliceTaskInfo.setServiceInstanceId(serviceInstanceId)
+
+        // create slice profile
+        ServiceInstance rspi = new ServiceInstance()
+        rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+        rspi.setServiceType(serviceType)
+        rspi.setServiceRole(serviceRole)
+        rspi.setOrchestrationStatus(oStatus)
+        rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+        rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+        rspi.setInputParameters(uuiRequest)
+        rspi.setWorkloadContext(useInterval)
+        rspi.setEnvironmentContext(sNSSAI_id)
+
+        //timestamp format YYYY-MM-DD hh:mm:ss
+        rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+        execution.setVariable("communicationServiceInstance", rspi)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                globalSubscriberId,
+                subscriptionServiceType,
+                serviceInstanceId)
+        client.create(uri, rspi)
+
+        execution.setVariable("sliceParams", sliceParams)
+    }
+
+    /**
+     * create An Slice Profile
+     * @param execution
+     */
+    void createAnSliceProfile(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId")
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile
+
+        String profileId = UUID.randomUUID().toString()
+        anSliceProfile.setSliceProfileId(profileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(profileId)
+        sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String)
+        //todo:...
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
+                globalSubscriberId,
+                subscriptionServiceType,
+                sliceTaskInfo.serviceInstanceId,
+                profileId
+        )
+        client.create(uri, sliceProfile)
+        execution.setVariable("sliceParams", sliceParams)
+    }
+
+    /**
+     * prepare AllocateAnNssi
+     * @param execution
+     */
+    void prepareAllocateAnNssi(DelegateExecution execution) {
+
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+
+        AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
+        allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
+        allocateAnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID
+        allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
+        allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+        allocateAnNssi.nsiInfo.nsiId = sliceParams
+
+        EsrInfo esrInfo = new EsrInfo()
+        //todo: vendor and network
+        esrInfo.setVendor(sliceTaskInfo.getVendor())
+        esrInfo.setNetworkType(sliceTaskInfo.getNetworkType())
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        //todo: service info
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.globalSubscriberId = globalSubscriberId
+        serviceInfo.subscriptionServiceType = subscriptionServiceType
+        serviceInfo.nsiId = sliceParams.serviceId
+        serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
+        serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
+        nbiRequest.setAllocateAnNssi(allocateAnNssi)
+
+        execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest)
+        execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo)
+    }
+
+
+    /**
+     * create RAN Slice Profile Instance
+     * @param execution
+     */
+    void createCnSliceProfileInstance(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        String serviceInstanceId = UUID.randomUUID().toString()
+        execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
+
+        String serviceType = ""
+        String serviceRole = "slice-profile"
+        String oStatus = "deactivated"
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        sliceTaskInfo.setServiceInstanceId(serviceInstanceId)
+
+        // create slice profile
+        ServiceInstance rspi = new ServiceInstance()
+        rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+        rspi.setServiceType(serviceType)
+        rspi.setServiceRole(serviceRole)
+        rspi.setOrchestrationStatus(oStatus)
+        rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+        rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+        rspi.setInputParameters(uuiRequest)
+        rspi.setWorkloadContext(useInterval)
+        rspi.setEnvironmentContext(sNSSAI_id)
+
+        //timestamp format YYYY-MM-DD hh:mm:ss
+        rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+        execution.setVariable("communicationServiceInstance", rspi)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                globalSubscriberId,
+                subscriptionServiceType,
+                serviceInstanceId)
+        client.create(uri, rspi)
+        execution.setVariable("sliceParams", sliceParams)
+    }
+
+    /**
+     * create An Slice Profile
+     * @param execution
+     */
+    void createCnSliceProfile(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId")
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+
+        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile
+
+        String profileId = UUID.randomUUID().toString()
+        cnSliceProfile.setSliceProfileId(profileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(profileId)
+        sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String)
+        //todo:...
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
+                globalSubscriberId,
+                subscriptionServiceType,
+                sliceTaskInfo.serviceInstanceId,
+                profileId
+        )
+        client.create(uri, sliceProfile)
+        execution.setVariable("sliceParams", sliceParams)
+    }
+
+    /**
+     * prepare AllocateCnNssi
+     * @param execution
+     */
+    void prepareAllocateCnNssi(DelegateExecution execution) {
+
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+
+        AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
+        allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
+        allocateCnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID
+        allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
+        allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+        allocateCnNssi.nsiInfo.nsiId = sliceParams
+
+        EsrInfo esrInfo = new EsrInfo()
+        //todo: vendor and network
+        esrInfo.setVendor(sliceTaskInfo.getVendor())
+        esrInfo.setNetworkType(sliceTaskInfo.getNetworkType())
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        //todo: service info
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.globalSubscriberId = globalSubscriberId
+        serviceInfo.subscriptionServiceType = subscriptionServiceType
+        serviceInfo.nsiId = sliceParams.serviceId
+        serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
+        serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
+        nbiRequest.setAllocateCnNssi(allocateCnNssi)
+
+        execution.setVariable("CnAllocateNssiNbiRequest", nbiRequest)
+        execution.setVariable("cnSliceTaskInfo", sliceTaskInfo)
+    }
+
+
+    /**
+     * create TN Slice Profile Instance
+     * @param execution
+     */
+    void createTnBHSliceProfileInstance(DelegateExecution execution) {
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        String serviceType = ""
+        String serviceRole = "slice-profile"
+        String oStatus = "deactivated"
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+
+        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+        String serviceInstanceId = UUID.randomUUID().toString()
+
+        sliceTaskInfo.setServiceInstanceId(serviceInstanceId)
+        //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
+
+        // create slice profile
+        ServiceInstance rspi = new ServiceInstance()
+        rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+        rspi.setServiceType(serviceType)
+        rspi.setServiceRole(serviceRole)
+        rspi.setOrchestrationStatus(oStatus)
+        rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+        rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+        rspi.setInputParameters(uuiRequest)
+        rspi.setWorkloadContext(useInterval)
+        rspi.setEnvironmentContext(sNSSAI_id)
+
+        //timestamp format YYYY-MM-DD hh:mm:ss
+        rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+        execution.setVariable("communicationServiceInstance", rspi)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                globalSubscriberId,
+                subscriptionServiceType,
+                serviceInstanceId)
+        client.create(uri, rspi)
+
+        execution.setVariable("sliceParams", sliceParams)
+    }
+
+    /**
+     * create An Slice Profile
+     * @param execution
+     */
+    void createTnBHSliceProfile(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId")
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+
+        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+
+        TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile
+        String profileId = UUID.randomUUID().toString()
+        tnSliceProfile.setSliceProfileId(profileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(profileId)
+        //todo:...
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
+                globalSubscriberId,
+                subscriptionServiceType,
+                serviceInstanceId,
+                profileId
+        )
+        client.create(uri, sliceProfile)
+
+        execution.setVariable("sliceParams", sliceParams)
+    }
+
+    /**
+     * prepare AllocateCnNssi
+     * @param execution
+     */
+    void prepareAllocateTnBHNssi(DelegateExecution execution) {
+
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+
+        AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
+        //todo: AllocateTnNssi
+        //allocateTnNssi.networkSliceInfos
+
+        EsrInfo esrInfo = new EsrInfo()
+        //todo: vendor and network
+        esrInfo.setVendor(sliceTaskInfo.getVendor())
+        esrInfo.setNetworkType(sliceTaskInfo.getNetworkType())
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        //todo: service info
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.globalSubscriberId = globalSubscriberId
+        serviceInfo.subscriptionServiceType = subscriptionServiceType
+        serviceInfo.nsiId = sliceParams.serviceId
+        serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
+        serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
+        nbiRequest.setAllocateTnNssi(allocateTnNssi)
+
+        execution.setVariable("TnBHAllocateNssiNbiRequest", nbiRequest)
+        execution.setVariable("tnBHSliceTaskInfo", sliceTaskInfo)
+    }
+
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSIV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSIV2.groovy
new file mode 100644 (file)
index 0000000..05bb53a
--- /dev/null
@@ -0,0 +1,117 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.apache.commons.lang3.StringUtils
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.beans.nsmf.SliceTaskInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class DoAllocateNSSIV2 extends AbstractServiceTaskProcessor {
+
+    private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSIV2.class);
+    private static final ObjectMapper MAPPER = new ObjectMapper();
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+    JsonUtils jsonUtil = new JsonUtils()
+
+    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+    @Override
+    void preProcessRequest(DelegateExecution execution) {
+        logger.trace("Enter preProcessRequest()")
+
+//        String nssmfOperation
+//
+//        String nsstInput = execution.getVariable("nsstInput")
+//        String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid")
+//        //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f"
+//        String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
+//        String serviceModelInfo = """{
+//            "modelInvariantUuid":"",
+//            "modelUuid":"${modelUuid}",
+//            "modelVersion":""
+//             }"""
+//        execution.setVariable("serviceModelInfo", serviceModelInfo)
+//        execution.setVariable("nssiInstanceId", nssiInstanceId)
+//        String nssiProfileID = UUID.randomUUID().toString()
+//        execution.setVariable("nssiProfileID", nssiProfileID)
+//        if(isBlank(nssiInstanceId))
+//        {
+//            nssmfOperation="create"
+//            nssiInstanceId = UUID.randomUUID().toString()
+//        }else {
+//            nssmfOperation = "update"
+//        }
+//        execution.setVariable("nssmfOperation",nssmfOperation)
+//        execution.setVariable("nssiInstanceId",nssiInstanceId)
+//
+//        def isNSSICreated = false
+//        execution.setVariable("isNSSICreated",isNSSICreated)
+//
+//        int currentCycle = 0
+//        execution.setVariable("currentCycle", currentCycle)
+
+
+        SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
+        if (StringUtils.isBlank(sliceTaskInfo.suggestNssiId)) {
+            execution.setVariable("nssmfOperation", "create")
+        } else {
+            execution.setVariable("nssmfOperation", "update")
+        }
+        logger.trace("Exit preProcessRequest")
+    }
+
+    /**
+     * prepare nssi request
+     * @param execution
+     */
+    void prepareNSSIReq(DelegateExecution execution) {
+
+    }
+
+    void getNSSTInfo(DelegateExecution execution){
+        logger.trace("Enter getNSSTInfo in DoAllocateNSSI()")
+        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+        ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+        String serviceRole = "nssi"
+        String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid()
+        String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid()
+        String nssiServiceType = serviceDecomposition.getServiceType()
+        String uuiRequest = execution.getVariable("uuiRequest")
+        String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name")
+        execution.setVariable("nssiServiceName",nssiServiceName)
+        execution.setVariable("nssiServiceType",nssiServiceType)
+        execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid)
+        execution.setVariable("nssiServiceUuid",nssiServiceUuid)
+        execution.setVariable("serviceRole",serviceRole)
+
+        String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
+        String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
+        String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor")
+        String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType")
+        String nsstType = jsonUtil.getJsonValue(content, "metadata.type")
+
+        execution.setVariable("nsstID",nsstID)
+        execution.setVariable("nsstVendor",nsstVendor)
+        execution.setVariable("nsstDomain",nsstDomain)
+        execution.setVariable("nssiServiceUuid",nssiServiceUuid)
+        execution.setVariable("nsstType",nsstType)
+
+        String nsstContentInfo = """{
+        "NsstID":"${nsstID}",
+        "Vendor":"${nsstVendor}",
+        "type":"${nsstType}"
+         }"""
+
+        logger.trace("Exit getNSSTInfo in DoAllocateNSSI()")
+    }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOptionV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOptionV2.groovy
new file mode 100644 (file)
index 0000000..ca26217
--- /dev/null
@@ -0,0 +1,907 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # 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.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.core.type.TypeReference
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.apache.commons.lang3.StringUtils
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.*
+import org.onap.so.beans.nsmf.oof.SubnetCapability
+import org.onap.so.beans.nsmf.oof.TemplateInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+class DoCreateSliceServiceOptionV2 extends AbstractServiceTaskProcessor{
+
+    private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOptionV2.class)
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+    JsonUtils jsonUtil = new JsonUtils()
+
+    OofUtils oofUtils = new OofUtils()
+
+    ObjectMapper objectMapper = new ObjectMapper()
+
+    void preProcessRequest (DelegateExecution execution) {
+    }
+
+
+    /**
+     * prepare select nsi request
+     * @param execution
+     */
+    void prepareSelectNSIRequest(DelegateExecution execution) {
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        logger.debug( "get NSI option OOF Url: " + urlString)
+
+        boolean isNSISuggested = true
+        execution.setVariable("isNSISuggested",isNSISuggested)
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSISelectionResponse"
+
+        Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
+        Map<String, Object> nstSolution = execution.getVariable("nstSolution")
+        logger.debug("Get NST selection from OOF: " + nstSolution.toString())
+        String nstInfo = """{
+            "modelInvariantId":"${nstSolution.invariantUUID}",
+            "modelVersionId":"${nstSolution.UUID}",
+            "modelName":"${nstSolution.NSTName}"
+         }"""
+
+        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nsiSelection_messageType",messageType)
+        execution.setVariable("nsiSelection_correlator",requestId)
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+        execution.setVariable("nsiSelection_timeout",timeout)
+        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo,messageType, profileInfo)
+        execution.setVariable("nsiSelection_oofRequest",oofRequest)
+        logger.debug("Sending request to OOF: " + oofRequest)
+    }
+
+    /**
+     * process select nsi response
+     * @param execution
+     */
+    void processOOFResponse(DelegateExecution execution) {
+
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams
+        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
+        logger.debug("NSI OOFResponse is: " + OOFResponse)
+        execution.setVariable("OOFResponse", OOFResponse)
+        //This needs to be changed to derive a value when we add policy to decide the solution options.
+
+        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
+        List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+        Map<String, Object> solutions = nsiSolutions.get(0)
+
+        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+        Boolean isSharable = resourceSharingLevel == "shared"
+
+        if (solutions != null) {
+            if (isSharable && solutions.get("existingNSI")) {
+                //sharedNSISolution
+                processSharedNSISolutions(solutions, execution)
+            }
+            else if(solutions.containsKey("newNSISolution")) {
+                processNewNSISolutions(solutions, execution)
+            }
+        }
+        execution.setVariable("sliceTaskParams", sliceTaskParams)
+        logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
+        logger.debug("*** Completed options Call to OOF ***")
+
+        logger.debug("start parseServiceProfile")
+        parseServiceProfile(execution)
+        logger.debug("end parseServiceProfile")
+    }
+
+
+    private void processNewNSISolutions(Map solutions, DelegateExecution execution) {
+        int index = 0
+        List<Map> newNSISolutions = solutions.get("newNSISolution")
+        List<Map> NSSImap = new ArrayList<>()
+        if (newNSISolutions != null && newNSISolutions.size() > 0) {
+            NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map>
+            for (Map nssi : NSSImap) {
+                Map oofSliceProfile = nssi.get("sliceProfile")
+                String domain = oofSliceProfile.getOrDefault("domainType","")
+                logger.debug("OOF newNSISolutions SliceProfile: " +oofSliceProfile.toString()+",domain:${domain}")
+                if(null != domain){
+                    //TODO
+//                    def nssiSolution = nssi.get("NSSISolution") as Map<String, ?>
+//                    String nssiName = nssiSolution.getOrDefault("NSSIName", "")
+//                    String nssiId = nssiSolution.getOrDefault("NSSIId", "")
+//                    saveNSSIId(nssi, sliceTaskParams)
+                    Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
+                    saveSliceProfile(execution, domain, sliceProfile)
+
+                }
+            }
+        }
+    }
+
+    private void processSharedNSISolutions(Map solutions, DelegateExecution execution) {
+        String nsiName, nsiInstanceId, nssiId, nssiName
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+
+        Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions"))?.get(0)
+        nsiInstanceId = sharedNSIsolution.getOrDefault("NSIId", "")
+        nsiName = sharedNSIsolution.getOrDefault("NSIName", "")
+        sliceTaskParams.setSuggestNsiId(nsiInstanceId)
+        sliceTaskParams.setSuggestNsiName(nsiName)
+
+        //Temporary modification
+        List NSSIs = sharedNSIsolution.get("NSSIs")
+        for(Map nssi : NSSIs){
+            Map oofSliceProfile = ((List)nssi.get("sliceProfile"))?.get(0)
+            String domain = oofSliceProfile.getOrDefault("domainType","")
+            nssiId = nssi.getOrDefault("NSSIId","")
+            nssiName = nssi.getOrDefault("NSSIName","")
+            saveNSSIId(domain, nssiId, nssiName,execution)
+            Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
+            saveSliceProfile(execution, domain, sliceProfile)
+            logger.debug("OOF sharedNSISolution SliceProfile:"+oofSliceProfile.toString()+",domain:${domain}")
+            logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}")
+        }
+    }
+
+    private void parseServiceProfile(DelegateExecution execution) {
+        logger.debug("Start parseServiceProfile")
+        String serviceType = execution.getVariable("serviceType")
+        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+        // set sliceProfile for three domains
+        if(!sliceTaskParams.getSliceProfileAn()){
+            Map<String, Object> sliceProfileAn = getSliceProfile( "AN", execution,null)
+            saveSliceProfile(execution,"AN",sliceProfileAn)
+        }
+
+        if(!sliceTaskParams.getSliceProfileTn()){
+            Map<String, Object> sliceProfileTn = getSliceProfile( "TN", execution,null)
+            saveSliceProfile(execution,"TN",sliceProfileTn)
+        }
+
+        if(!sliceTaskParams.getSliceProfileCn()){
+            Map<String, Object> sliceProfileCn = getSliceProfile( "CN", execution,null, )
+            saveSliceProfile(execution,"CN",sliceProfileCn)
+        }
+
+        logger.debug("Finish parseServiceProfile")
+    }
+
+    private void saveSliceProfile(DelegateExecution execution, String domain, Map<String, Object> sliceProfile){
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+        if(domain.equalsIgnoreCase("AN")){
+            execution.setVariable("sliceProfileAn", sliceProfile)
+            sliceTaskParams.setSliceProfileAn(sliceProfile)
+            logger.debug("sliceProfileAn: " + sliceProfile)
+        }
+        else if(domain.equalsIgnoreCase("TN")){
+            execution.setVariable("sliceProfileTn", sliceProfile)
+            sliceTaskParams.setSliceProfileTn(sliceProfile)
+            logger.debug("sliceProfileTn: " + sliceProfile)
+        }
+        else if(domain.equalsIgnoreCase("CN")){
+            execution.setVariable("sliceProfileCn", sliceProfile)
+            sliceTaskParams.setSliceProfileCn(sliceProfile)
+            logger.debug("sliceProfileCn: " + sliceProfile)
+        }
+    }
+
+    private void saveNSSIId(String domain, String nssiId, String nssiName, DelegateExecution execution) {
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+        if(domain.equalsIgnoreCase("AN")){
+            sliceTaskParams.setAnSuggestNssiId(nssiId)
+            sliceTaskParams.setAnSuggestNssiName(nssiName)
+        }
+        else if(domain.equalsIgnoreCase("CN")){
+            sliceTaskParams.setCnSuggestNssiId(nssiId)
+            sliceTaskParams.setCnSuggestNssiName(nssiName)
+        }
+        else if(domain.equalsIgnoreCase("TN")){
+            sliceTaskParams.setTnSuggestNssiId(nssiId)
+            sliceTaskParams.setTnSuggestNssiName(nssiName)
+        }
+    }
+
+    private Map getSliceProfile(String domain, DelegateExecution execution, Map<String, Object> oofSliceProfile) {
+        String profileMapStr
+        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+        Integer domainLatency = (Integer) serviceProfile.get("latency")/3
+
+        if(domain.equalsIgnoreCase("AN")){
+            profileMapStr = """ {
+                    "latency": ${domainLatency}, 
+                    "sNSSAI": "sNSSAI", 
+                    "uEMobilityLevel": "uEMobilityLevel", 
+                    "coverageAreaTAList": "coverageAreaTAList", 
+                    "5QI": 100
+                }"""
+        }
+        else if(domain.equalsIgnoreCase("TN")){
+            profileMapStr =""" {
+                    "latency":${domainLatency},
+                    "sNSSAI":"sNSSAI", 
+                    "e2eLatency":"latency", 
+                    "bandwidth": 100
+                }"""
+        }
+        else if(domain.equalsIgnoreCase("CN")){
+            profileMapStr = """ {
+                    "areaTrafficCapDL":"areaTrafficCapDL",
+                    "maxNumberofUEs":"maxNumberofUEs",
+                    "latency":${domainLatency},
+                    "expDataRateUL":"expDataRateUL", 
+                    "sNSSAI":"sNSSAI", 
+                    "areaTrafficCapUL":"areaTrafficCapUL",
+                    "uEMobilityLevel":"uEMobilityLevel", 
+                    "expDataRateDL":"expDataRateDL",  
+                    "activityFactor":"activityFactor",
+                    "resourceSharingLevel":"resourceSharingLevel"
+                }"""
+        }
+
+        logger.debug("Profile map for " + domain + " : " + profileMapStr)
+        Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr.trim().replaceAll(" ", ""), new TypeReference<Map<String, String>>(){})
+        Map<String, Object> sliceProfile = [:]
+        for (Map.Entry<String, String> profileMap : profileMaps) {
+            String key = profileMap.key
+            String value = profileMaps.get(key)
+            if(null != oofSliceProfile && oofSliceProfile.keySet().contains(key)){
+                sliceProfile.put(key, oofSliceProfile.get(key))
+                logger.debug("Get from oof, key:${key}, value: ${oofSliceProfile.get(key)}")
+            }
+            else if(serviceProfile.keySet().contains(value)){
+                sliceProfile.put(key, serviceProfile.get(value))
+            }
+            else{
+                sliceProfile.put(key, profileMaps.get(key))
+            }
+        }
+        return sliceProfile
+    }
+
+    void processDecomposition(DelegateExecution execution){
+        logger.debug("Start processDecomposition")
+
+        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+        String nstName = serviceDecomposition.getModelInfo().getModelName()
+        String nstId = serviceDecomposition.getModelInfo().getModelUuid()
+        sliceTaskParams.setNstName(nstName)
+        sliceTaskParams.setNstId(nstId)
+
+        logger.debug("End processDecomposition")
+    }
+
+
+    void prepareNSTDecompose(DelegateExecution execution) {
+
+        String modelUuid = execution.getVariable("nstModelUuid")
+        String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid")
+
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+    }
+
+    void prepareNSSTDecompose(DelegateExecution execution) {
+        Boolean isMoreNSSTtoProcess = false
+        Integer maxNSST = execution.getVariable("maxNSST")
+        Integer currentNSST=execution.getVariable("currentNSST")
+        List<String> nsstModelUUIDList = new ArrayList<>()
+        nsstModelUUIDList = execution.getVariable("nsstModelUUIDList")
+        String modelUuid = nsstModelUUIDList.get(currentNSST)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+        currentNSST=currentNSST+1
+        if(currentNSST<maxNSST)
+            isMoreNSSTtoProcess=true
+        execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
+        execution.setVariable("maxNSST",maxNSST)
+        execution.setVariable("currentNSST",currentNSST)
+    }
+
+
+    void prepareNSSTlistfromNST(DelegateExecution execution) {
+        //Need to update this part from decomposition.
+        logger.trace("Enter prepareNSSTlistfromNST()")
+        Boolean isMoreNSSTtoProcess = false
+        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+        String nstName = serviceDecomposition.getModelInfo().getModelName()
+        sliceTaskParams.setNstName(nstName)
+        String nstId = serviceDecomposition.getModelInfo().getModelUuid()
+        sliceTaskParams.setNstId(nstId)
+        execution.setVariable("sliceTaskParams",sliceTaskParams)
+
+        List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy()
+        List<String> nsstModelUUIDList = new ArrayList<>()
+        for(ServiceProxy serviceProxy:proxyList)
+            nsstModelUUIDList.add(serviceProxy.getSourceModelUuid())
+        execution.setVariable("nsstModelUUIDList",nsstModelUUIDList)
+        Integer maxNSST = nsstModelUUIDList.size()
+        Integer currentNSST=0
+        execution.setVariable("maxNSST",maxNSST)
+        execution.setVariable("currentNSST",currentNSST)
+        if(currentNSST<maxNSST)
+            isMoreNSSTtoProcess=true
+        execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
+        logger.trace("Exit prepareNSSTlistfromNST()")
+
+    }
+
+    void getNSSTOption(DelegateExecution execution) {
+        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        String nssiInstanceId =""
+        String nssiName =""
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+        logger.debug( "get NSI option OOF Url: " + urlString)
+        boolean isNSISuggested = false
+        execution.setVariable("isNSISuggested",isNSISuggested)
+
+        //Prepare auth for OOF - Begin
+        def authHeader = ""
+        String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+        String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+        String basicAuthValue = utils.encrypt(basicAuth, msokey)
+        if (basicAuthValue != null) {
+            logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
+            try {
+                authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+                execution.setVariable("BasicAuthHeaderValue", authHeader)
+            } catch (Exception ex) {
+                logger.debug( "Unable to encode username and password string: " + ex)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+                        "encode username and password string")
+            }
+        } else {
+            logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+                    "value null")
+        }
+        //Prepare auth for OOF - End
+        //Prepare send request to OOF - Begin
+        String requestId = execution.getVariable("msoRequestId")
+        Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
+        String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid()
+        String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid()
+        String nsstInfo = """"NSSTInfo": {
+        "invariantUUID":"${nsstModelInvariantUuid}",
+        "UUID":"${nsstModelUuid}"
+         }"""
+        String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo)
+
+
+        URL url = new URL(urlString+"/api/oof/v1/selectnssi")
+        HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
+        httpClient.addAdditionalHeader("Authorization", authHeader)
+        Response httpResponse = httpClient.post(oofRequest)
+
+        int responseCode = httpResponse.getStatus()
+        logger.debug("OOF sync response code is: " + responseCode)
+
+        if(responseCode != 200){
+            exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+        }
+
+        if(httpResponse.hasEntity()){
+            String OOFResponse = httpResponse.readEntity(String.class)
+            execution.setVariable("OOFResponse", OOFResponse)
+            nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID")
+            nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName")
+            execution.setVariable("nssiInstanceId",nssiInstanceId)
+            execution.setVariable("nssiName",nssiName)
+        }
+        if(StringUtils.isBlank(nssiInstanceId)){
+            logger.debug( "There is no valid NSST suggested by OOF.")
+        }else
+        {
+            try {
+                AAIResourcesClient resourceClient = new AAIResourcesClient()
+                AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId)
+                AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+                Optional<ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
+                org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
+
+                String domain = nssi.getEnvironmentContext().toString().toUpperCase()
+                switch (domain) {
+                    case "AN":
+                        sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId())
+                        sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName())
+                        break
+                    case "CN":
+                        sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId())
+                        sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName())
+                        break
+                    case "TN":
+                        sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId())
+                        sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName())
+                        break
+                    default:
+                        break
+                }
+            }catch(NotFoundException e)
+            {
+                logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
+            }catch(Exception e)
+            {
+                logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
+            }
+        }
+        logger.debug("Prepare NSSI option completed ")
+    }
+
+
+    /**
+     * new
+     */
+
+    private static final ObjectMapper MAPPER = new ObjectMapper()
+
+    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+    private static final String QUERY_SUB_NET_CAPABILITY = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
+
+    private static final String QUERY_NSSI_SELECTION_CAPABILITY = "/api/rest/provMns/v1/NSS/NSSISelectionCapability"
+
+    /**
+     * query Subnet Capability of TN
+     * @param execution
+     */
+    public void queryTNSubnetCapability(DelegateExecution execution) {
+
+        String vendor = execution.getVariable("vendor")
+
+        List<String> subnetTypes =  new ArrayList<>()
+        subnetTypes.add("TN_FH")
+        subnetTypes.add("TN_MH")
+        subnetTypes.add("TN_BH")
+
+        String strRequest = MAPPER.writeValueAsString(
+                buildQuerySubnetCapRequest(vendor, subnetTypes, NetworkType.TRANSPORT))
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
+        execution.setVariable("subnetCapabilityOfTN", response)
+    }
+
+    /**
+     * query Subnet Capability of CN
+     * @param execution
+     */
+    public void queryCNSubnetCapability(DelegateExecution execution) {
+
+        String vendor = execution.getVariable("vendor")
+
+        List<String> subnetTypes =  new ArrayList<>()
+        subnetTypes.add("CN")
+
+        String strRequest = MAPPER.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetTypes, NetworkType.CORE))
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
+
+        execution.setVariable("subnetCapabilityOfCN", response)
+    }
+
+    /**
+     * query Subnet Capability of AN
+     * @param execution
+     */
+    public void queryANSubnetCapability(DelegateExecution execution) {
+
+        String vendor = execution.getVariable("vendor")
+
+        List<String> subnetTypes =  new ArrayList<>()
+        subnetTypes.add("AN-NF")
+
+        String strRequest = MAPPER.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetTypes, NetworkType.ACCESS))
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
+
+        execution.setVariable("subnetCapabilityOfAN", response)
+    }
+
+    /**
+     * build request body for querying Subnet Capability
+     * @param vendor
+     * @param subnetTypes
+     * @param networkType
+     * @return
+     */
+    private static String buildQuerySubnetCapRequest(String vendor, List<String> subnetTypes, NetworkType networkType) {
+        NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
+
+        Map<String, Object> paramMap = new HashMap()
+        paramMap.put("subnetTypes", subnetTypes)
+
+        request.setSubnetCapabilityQuery(MAPPER.writeValueAsString(paramMap))
+
+        EsrInfo esrInfo = new EsrInfo()
+        esrInfo.setVendor(vendor)
+        esrInfo.setNetworkType(networkType)
+
+        request.setEsrInfo(esrInfo)
+
+        String strRequest = MAPPER.writeValueAsString(request)
+
+        return strRequest
+    }
+
+    /**
+     * handle response of Subnet Capability, generate SubnetCapabilities Info for request to oof
+     * @param execution
+     */
+    public void generateSubnetCapabilities(DelegateExecution execution) {
+        //todo:
+        execution.setVariable("subnetCapabilities", [])
+    }
+
+    /**
+     * prepare the params for decompose nst
+     * @param execution
+     */
+    public void prepareDecomposeNST(DelegateExecution execution) {
+
+        String modelUuid = execution.getVariable("nstModelUuid")
+        String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid")
+
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("nstServiceModelInfo", serviceModelInfo)
+    }
+
+    /**
+     * process the result of NST Decomposition
+     * @param execution
+     */
+    public void processDecompositionNST(DelegateExecution execution) {
+
+        ServiceDecomposition nstServiceDecomposition = execution.getVariable("nstServiceDecomposition")
+        //todo:
+
+    }
+
+
+    /**
+     * prepare the params for decompose nsst
+     * @param execution
+     */
+    public void prepareDecomposeNSST(DelegateExecution execution) {
+        Boolean isMoreNSSTtoProcess = false
+        def maxNSST = execution.getVariable("maxNSST") as Integer
+        def currentNSST = execution.getVariable("currentNSST") as Integer
+        def nsstModelUUIDList = execution.getVariable("nsstModelUUIDList") as List
+        String modelUuid = nsstModelUUIDList.get(currentNSST)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("nsstServiceModelInfo", serviceModelInfo)
+        currentNSST = currentNSST + 1
+
+        if(currentNSST < maxNSST) {
+            isMoreNSSTtoProcess = true
+        }
+
+        execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess)
+        execution.setVariable("maxNSST", maxNSST)
+        execution.setVariable("currentNSST", currentNSST)
+
+        //todo:
+    }
+
+    /**
+     * process the result of NSST Decomposition
+     * @param execution
+     */
+    public void processDecompositionNSST(DelegateExecution execution) {
+        ServiceDecomposition nsstServiceDecomposition = execution.getVariable("nsstServiceDecomposition")
+        //todo:
+    }
+
+    /**
+     * todo: need rewrite
+     * prepare select nsi request
+     * @param execution
+     */
+    public void preNSIRequest(DelegateExecution execution) {
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        logger.debug( "get NSI option OOF Url: " + urlString)
+
+        boolean isNSISuggested = true
+        execution.setVariable("isNSISuggested", isNSISuggested)
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSISelectionResponse"
+
+        ServiceProfile profileInfo = execution.getVariable("serviceProfile") as ServiceProfile
+        Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
+        logger.debug("Get NST selection from OOF: " + nstSolution.toString())
+
+        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nsiSelection_messageType", messageType)
+        execution.setVariable("nsiSelection_correlator", requestId)
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
+        execution.setVariable("nsiSelection_timeout", timeout)
+
+
+        TemplateInfo nstInfo = new TemplateInfo()
+        nstInfo.setInvariantUUID(nstSolution.get("invariantUUID") as String)
+        nstInfo.setUUID(nstSolution.get("UUID") as String)
+        nstInfo.setName(nstSolution.get("NSTName") as String)
+
+        execution.setVariable("NSTInfo", nstInfo)
+
+        List<TemplateInfo> nsstInfos = execution.getVariable("NSSTInfos") as List<TemplateInfo>
+
+        List<SubnetCapability> subnetCapabilities = execution.getVariable("subnetCapabilities") as List<SubnetCapability>
+
+        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
+                messageType, profileInfo, subnetCapabilities, timeout as Integer)
+
+        execution.setVariable("nsiSelection_oofRequest", oofRequest)
+        logger.debug("Sending request to OOF: " + oofRequest)
+    }
+
+    /**
+     * todo: need rewrite
+     * process select nsi response
+     * @param execution
+     */
+    public void processNSIResp(DelegateExecution execution) {
+
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams
+        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
+        logger.debug("NSI OOFResponse is: " + OOFResponse)
+        execution.setVariable("OOFResponse", OOFResponse)
+        //This needs to be changed to derive a value when we add policy to decide the solution options.
+
+        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
+        List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+        Map<String, Object> solutions = nsiSolutions.get(0)
+
+        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+        Boolean isSharable = resourceSharingLevel == "shared"
+
+        if (solutions != null) {
+            if (isSharable && solutions.get("existingNSI")) {
+                //sharedNSISolution
+                processSharedNSISolutions(solutions, execution)
+            }
+            else if(solutions.containsKey("newNSISolution")) {
+                processNewNSISolutions(solutions, execution)
+            }
+        }
+        execution.setVariable("sliceTaskParams", sliceTaskParams)
+        logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson())
+        logger.debug("*** Completed options Call to OOF ***")
+
+        logger.debug("start parseServiceProfile")
+        parseServiceProfile(execution)
+        logger.debug("end parseServiceProfile")
+    }
+
+    /**
+     * get NSSI Selection Capability for AN
+     * @param execution
+     */
+    public void getNSSISelectionCap4AN(DelegateExecution execution) {
+
+        def vendor = execution.getVariable("vendor") as String
+
+        String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS)
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
+
+        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
+
+        String selection = resMap.get("selection")
+
+
+        if ("NSMF".equalsIgnoreCase(selection)) {
+            execution.setVariable("NEED_AN_NSSI_SELECTION", true)
+        }
+    }
+
+    /**
+     * get NSSI Selection Capability for TN
+     * @param execution
+     */
+    public void getNSSISelectionCap4TN(DelegateExecution execution) {
+
+        def vendor = execution.getVariable("vendor") as String
+
+        String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT)
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
+
+        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
+
+        String selection = resMap.get("selection")
+
+        if ("NSMF".equalsIgnoreCase(selection)) {
+            execution.setVariable("NEED_TN_NSSI_SELECTION", true)
+        }
+    }
+
+    /**
+     * get NSSI Selection Capability for CN
+     * @param execution
+     */
+    public void getNSSISelectionCap4CN(DelegateExecution execution) {
+
+        def vendor = execution.getVariable("vendor") as String
+
+        String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE)
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
+
+        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
+
+        String selection = resMap.get("selection")
+
+        if ("NSMF".equalsIgnoreCase(selection)) {
+            execution.setVariable("NEED_CN_NSSI_SELECTION", true)
+        }
+    }
+
+    /**
+     * build NSSI Selection Capability Request body to nssmf adapter
+     * @param vendor
+     * @param networkType
+     * @return
+     */
+    private static String buildNSSISelectionReq(String vendor, NetworkType networkType) {
+        NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
+        EsrInfo esrInfo = new EsrInfo()
+        esrInfo.setVendor(vendor)
+        esrInfo.setNetworkType(networkType)
+        request.setEsrInfo(esrInfo)
+
+        return MAPPER.writeValueAsString(request)
+    }
+
+    /**
+     * if exist nssi need to select?
+     * @param execution
+     */
+    public void handleNssiSelect(DelegateExecution execution) {
+
+        SliceTaskParamsAdapter sliceTaskParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        execution.setVariable()
+    }
+
+    /**
+     * todo: need rewrite
+     * prepare select nssi request
+     * @param execution
+     */
+    public void preNSSIRequest(DelegateExecution execution) {
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        logger.debug( "get NSI option OOF Url: " + urlString)
+
+        boolean isNSISuggested = true
+        execution.setVariable("isNSISuggested", isNSISuggested)
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSISelectionResponse"
+
+        Map<String, Object> profileInfo = execution.getVariable("serviceProfile") as Map
+        Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
+        logger.debug("Get NST selection from OOF: " + nstSolution.toString())
+        String nstInfo = """{
+            "modelInvariantId":"${nstSolution.invariantUUID}",
+            "modelVersionId":"${nstSolution.UUID}",
+            "modelName":"${nstSolution.NSTName}"
+         }"""
+
+        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nsiSelection_messageType", messageType)
+        execution.setVariable("nsiSelection_correlator", requestId)
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
+        execution.setVariable("nsiSelection_timeout", timeout)
+
+        //todo
+        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, messageType, profileInfo)
+
+        execution.setVariable("nsiSelection_oofRequest", oofRequest)
+        logger.debug("Sending request to OOF: " + oofRequest)
+    }
+
+    /**
+     * process select nssi response
+     * @param execution
+     */
+    public void processNSSIResp(DelegateExecution execution) {
+
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams
+        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
+        logger.debug("NSI OOFResponse is: " + OOFResponse)
+        execution.setVariable("OOFResponse", OOFResponse)
+        //This needs to be changed to derive a value when we add policy to decide the solution options.
+
+        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
+        List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+        Map<String, Object> solutions = nsiSolutions.get(0)
+
+        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+        Boolean isSharable = resourceSharingLevel == "shared"
+
+        if (solutions != null) {
+            if (isSharable && solutions.get("existingNSI")) {
+                //sharedNSISolution
+                processSharedNSISolutions(solutions, execution)
+            }
+            else if(solutions.containsKey("newNSISolution")) {
+                processNewNSISolutions(solutions, execution)
+            }
+        }
+        execution.setVariable("sliceTaskParams", sliceTaskParams)
+        logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
+        logger.debug("*** Completed options Call to OOF ***")
+
+        logger.debug("start parseServiceProfile")
+        parseServiceProfile(execution)
+        logger.debug("end parseServiceProfile")
+    }
+
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
new file mode 100644 (file)
index 0000000..534467f
--- /dev/null
@@ -0,0 +1,231 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
+
+    private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
+    JsonUtils jsonUtil = new JsonUtils()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    String Prefix = "DCTN_"
+
+    void preProcessRequest(DelegateExecution execution) {
+        String msg = ""
+        logger.trace("Enter preProcessRequest()")
+
+        execution.setVariable("prefix", Prefix)
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+        logger.trace("Exit preProcessRequest")
+    }
+
+
+    void createSliceProfile(DelegateExecution execution) {
+
+        String sliceserviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        String sliceProfileId = UUID.randomUUID().toString()
+        SliceProfile sliceProfile = new SliceProfile();
+        sliceProfile.setProfileId(sliceProfileId)
+        sliceProfile.setLatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
+        sliceProfile.setResourceSharingLevel(jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel"))
+        sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr))    //TODO: should be list
+
+        sliceProfile.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
+        sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
+
+        //TODO: new API
+        sliceProfile.setReliability(new Object())
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, execution.getVariable
+                    ("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, sliceProfileId)
+            client.create(uri, sliceProfile)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+
+    void createServiceInstance(DelegateExecution execution) {
+
+        String serviceRole = "TN"
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        try {
+            org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+            ss.setServiceInstanceId(ssInstanceId)
+            String sliceInstanceName = execution.getVariable("sliceServiceInstanceName")
+            ss.setServiceInstanceName(sliceInstanceName)
+            ss.setServiceType(serviceType)
+            String serviceStatus = "allocated"
+            ss.setOrchestrationStatus(serviceStatus)
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            String modelUuid = execution.getVariable("modelUuid")
+            ss.setModelInvariantId(modelInvariantUuid)
+            ss.setModelVersionId(modelUuid)
+            String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
+            ss.setServiceInstanceLocationId(serviceInstanceLocationid)
+            String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
+            ss.setEnvironmentContext(snssai)
+            ss.setServiceRole(serviceRole)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId)
+            client.create(uri, ss)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+
+    void createAllottedResource(DelegateExecution execution) {
+        String serviceInstanceId = execution.getVariable('sliceServiceInstanceId')
+
+        AAIResourcesClient resourceClient = getAAIClient()
+        AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+
+        try {
+            List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportSliceNetworks"))
+
+            for (String networkStr : networkStrList) {
+                String allottedResourceId = UUID.randomUUID().toString()
+                AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
+                        execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"),
+                        execution.getVariable("sliceserviceInstanceId"), allottedResourceId)
+                execution.setVariable("allottedResourceUri", allottedResourceUri)
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+                resource.setId(allottedResourceId)
+                resource.setType("TsciNetwork")
+                resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName"))
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+                getAAIClient().create(allottedResourceUri, resource)
+                //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build())
+                //getAAIClient().connect(allottedResourceUri,ssServiceuri)
+                //execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
+
+                String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
+                createLogicalLinksForAllocatedResource(execution, linkArrayStr, serviceInstanceId, allottedResourceId)
+            }
+
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+        }
+    }
+
+    void createLogicalLinksForAllocatedResource(DelegateExecution execution,
+                                                String linkArrayStr, String serviceInstanceId,
+                                                String allottedResourceId) {
+
+        try {
+            List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
+
+            for (String linkStr : linkStrList) {
+                String logicalLinkId = UUID.randomUUID().toString()
+                String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
+                String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+                resource.setLinkId(logicalLinkId)
+                resource.setLinkName(epA)
+                resource.setLinkName2(epB)
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+
+                AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIObjectType.LOGICAL_LINK, logicalLinkId)
+                getAAIClient().create(logicalLinkUri, resource)
+            }
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+                    "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+        }
+    }
+
+    void preprocessSdncAllocateTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
+                'execution=' + execution.getId() +
+                ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        logger.trace("STARTED preProcessSDNCActivateRequest Process")
+        try {
+            String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+
+            String createSDNCRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "create")
+
+            execution.setVariable("TNNSSMF_SDNCRequest", createSDNCRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + createSDNCRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002,
+                    "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED  preProcessSDNCActivateRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..2ca0da4
--- /dev/null
@@ -0,0 +1,556 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited. 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.onap.so.bpmn.infrastructure.scripts
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.*
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.oof.adapter.beans.payload.OofRequest
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonObject
+
+/**
+ * Internal AN NSSMF to handle NSSI Deallocation
+ */
+class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
+
+       String Prefix="DoDeAllocateAccessNSSI"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       OofUtils oofUtils = new OofUtils()
+       ObjectMapper objectMapper = new ObjectMapper()
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+       
+       private static final Logger logger = LoggerFactory.getLogger(DoDeAllocateAccessNSSI.class)
+       private static final String ROLE_SLICE_PROFILE = "slice-profile-instance"
+       private static final String ROLE_NSSI = "nssi"
+
+       private static final String AN_NF = "AN-NF"
+       private static final String TN_FH = "TN-FH"
+       private static final String TN_MH = "TN-MH"
+
+       @Override
+       public void preProcessRequest(DelegateExecution execution) {
+               logger.debug("${Prefix} - Start preProcessRequest")
+
+               String sliceParams = execution.getVariable("sliceParams")
+               String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+               String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
+               String nsiId = jsonUtil.getJsonValue(sliceParams, "nsiId")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String anNssiId = execution.getVariable("serviceInstanceID")
+
+               if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+                       String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               if( isBlank(anNssiId) || isBlank(globalSubscriberId) || isBlank(subscriptionServiceType)) {
+                       String msg = "Missing Input fields from main process : [serviceInstanceID, globalSubscriberId, subscriptionServiceType]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               execution.setVariable("sNssaiList", sNssaiList)
+               execution.setVariable("anSliceProfileId", anSliceProfileId)
+               execution.setVariable("nsiId", nsiId)
+               execution.setVariable("anNssiId", anNssiId)
+
+               logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
+       }
+
+       /**
+        * Method to fetch AN NSSI Constituents and Slice Profile constituents
+        * @param execution
+        */
+       void getRelatedInstances(DelegateExecution execution) {
+               logger.debug("${Prefix} - Get Related Instances")
+               String anSliceProfileId = execution.getVariable("anSliceProfileId")
+               String anNssiId = execution.getVariable("anNssiId")
+
+               Map<String,ServiceInstance> relatedSPs = new HashMap<>()
+               execution.setVariable("relatedSPs", getRelatedInstancesByRole(execution, ROLE_SLICE_PROFILE, anSliceProfileId))
+               execution.setVariable("anNfSliceProfileId", getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), AN_NF))
+
+               Map<String,ServiceInstance> relatedNssis = new HashMap<>()
+               execution.setVariable("relatedNssis", getRelatedInstancesByRole(execution, ROLE_NSSI, anNssiId))
+       }
+       
+
+       /**
+        * @param execution
+        */
+       void prepareOOFAnNssiTerminationRequest(DelegateExecution execution) {
+               logger.debug("Start prepareOOFTerminationRequest")
+        String requestId = execution.getVariable("msoRequestId")
+               String messageType = "AN_NSSITermination"
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               String serviceInstanceId = execution.getVariable("nsiId")
+               String anNssiId = execution.getVariable("anNssiId")
+        String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNssiId, ROLE_NSSI,messageType,serviceInstanceId)
+        OofRequest oofPayload = new OofRequest()
+               oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+               oofPayload.setRequestDetails(oofRequest)
+               execution.setVariable("oofAnNssiPayload", oofPayload)
+        logger.debug("Finish prepareOOFTerminationRequest")
+
+       }
+       
+       void performOofAnNSSITerminationCall(DelegateExecution execution) {
+               boolean terminateAnNSSI = callOofAdapter(execution,execution.getVariable("oofAnNssiPayload"))
+               execution.setVariable("terminateAnNSSI", terminateAnNSSI)
+       }
+       
+       /**
+        * @param execution
+        */
+       void prepareOOFAnNfNssiTerminationRequest(DelegateExecution execution) {
+               logger.debug("Start prepareOOFAnNfNssiTerminationRequest")
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "AN_NF_NSSITermination"
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               String serviceInstanceId = execution.getVariable("anNssiId")
+
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"),AN_NF)
+               execution.setVariable("anNfNssiId", anNfNssiId)
+
+               String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNfNssiId, ROLE_NSSI,messageType,serviceInstanceId)
+               OofRequest oofPayload = new OofRequest()
+               oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+               oofPayload.setRequestDetails(oofRequest)
+               execution.setVariable("oofAnNfNssiPayload", oofPayload)
+               logger.debug("Finish prepareOOFAnNfNssiTerminationRequest")
+
+       }
+
+       void performOofAnNfNSSITerminationCall(DelegateExecution execution) {
+               boolean terminateAnNfNSSI = callOofAdapter(execution,execution.getVariable("oofAnNfNssiPayload"))
+               execution.setVariable("terminateAnNfNSSI", terminateAnNfNSSI)
+               if(!terminateAnNfNSSI) {
+                       execution.setVariable("modifyAction",true)
+               }
+       }
+       
+       void prepareSdnrRequest(DelegateExecution execution) {
+
+               String anNfNssiId = execution.getVariable("anNfNssiId")
+               String sNssai = execution.getVariable("sNssaiList")
+               String reqId = execution.getVariable("msoRequestId")
+               String messageType = "SDNRTerminateResponse"
+               StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
+               callbackURL.append("/").append(messageType).append("/").append(reqId)
+
+               JsonObject input = new JsonObject()
+               input.addProperty("RANNFNSSIId", anNfNssiId)
+               input.addProperty("callbackURL", callbackURL.toString())
+               input.addProperty("s-NSSAI", sNssai)
+
+               JsonObject Payload = new JsonObject()
+               Payload.addProperty("version", "1.0")
+               Payload.addProperty("rpc-name", "TerminateRANSlice")
+               Payload.addProperty("correlation-id", reqId)
+               Payload.addProperty("type", "request")
+
+               JsonObject wrapinput = new JsonObject()
+               wrapinput.addProperty("Action", "deallocate")
+
+               JsonObject CommonHeader = new JsonObject()
+               CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+               CommonHeader.addProperty("APIver", "1.0")
+               CommonHeader.addProperty("RequestID", reqId)
+               CommonHeader.addProperty("SubRequestID", "1")
+
+               JsonObject body = new JsonObject()
+               body.add("input", wrapinput)
+
+               JsonObject sdnrRequest = new JsonObject()
+               Payload.add("input", input)
+               wrapinput.add("Payload", Payload)
+               wrapinput.add("CommonHeader", CommonHeader)
+               body.add("input", wrapinput)
+               sdnrRequest.add("body", body)
+
+               String json = sdnrRequest.toString()
+               execution.setVariable("sdnrRequest", sdnrRequest)
+               execution.setVariable("SDNR_messageType", messageType)
+               execution.setVariable("SDNR_timeout", "PT10M")
+
+       }
+       
+       void processSdnrResponse(DelegateExecution execution) {
+               logger.debug("${Prefix} processing SdnrResponse")
+               Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("SDNR_Response"),Map.class)
+               String status = resMap.get("status")
+               String reason = resMap.get("reason")
+               if("success".equalsIgnoreCase(status)) {
+                       execution.setVariable("isAnNfTerminated", true)
+               }else {
+                       execution.setVariable("isAnNfTerminated", false)
+                       logger.debug("AN NF Termination failed with reason ${reason}")
+               }
+               logger.debug("${Prefix} processed SdnrResponse")
+       }
+       
+       /**
+        * @param execution
+        * @param oofRequest - Request payload to be sent to adapter
+        * @return
+        */
+       boolean callOofAdapter(DelegateExecution execution, OofRequest oofRequest) {
+               logger.debug("Start callOofAdapter")
+               String requestId = execution.getVariable("msoRequestId")
+               String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
+               URL requestUrl = new URL(oofAdapterEndpoint)
+               logger.debug("Calling OOF adapter  : ${requestUrl} with payload : ${oofRequest}")
+               HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.EXTERNAL)
+               Response httpResponse = httpClient.post(oofRequest)
+               int responseCode = httpResponse.getStatus()
+               logger.debug("OOF sync response code is: " + responseCode)
+               if(responseCode != 200){
+                       logger.debug("OOF request failed with reason : " + httpResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+               }else {
+                       Map<String,Object> response = objectMapper.readValue(httpResponse.getEntity(),Map.class)
+                       boolean terminateResponse =  response.get("terminateResponse")
+                       if(!terminateResponse) {
+                               logger.debug("Terminate response is false because " + response.get("reason"))
+                       }
+                       return terminateResponse
+               }
+       }
+       
+       void deallocateAnNfNssi(DelegateExecution execution) {
+               logger.debug("${Prefix} - call deallocateAnNfNssi ")
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), AN_NF)
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                               globalSubscriberId, subscriptionServiceType, anNfNssiId)
+               if (!client.exists(uri)) {
+                       logger.debug("AN NF Service Instance was not found in aai : ${anNfNssiId}")
+               }else {
+                       client.delete(uri)
+               }
+       }
+       
+       /**
+        * Removes relationship between AN NSSI and AN_NF NSSI
+        * @param execution
+        */
+       void dissociateAnNfNssi(DelegateExecution execution) {
+               logger.debug("${Prefix} - call dissociateAnNfNssi ")
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), AN_NF)
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                               globalSubscriberId, subscriptionServiceType, anNfNssiId)
+               if (!client.exists(uri)) {
+                       logger.debug("AN NF Service Instance was not found in aai : ${anNfNssiId}")
+               }else {
+                       client.delete(uri)
+               }
+       }
+       
+       /**
+        * Method to prepare request for AN NSSI modification
+        * Call Modify AN NSSI in case OOF sends Terminate NSSI=False
+        * @param execution
+        */
+       void preparejobForANNSSIModification(DelegateExecution execution) {
+
+               String modificationJobId = UUID.randomUUID().toString()
+               execution.setVariable("modificationJobId", modificationJobId)
+
+               Map<String,Object> sliceParams = objectMapper.readValue(execution.getVariable("sliceParams"), Map.class)
+               sliceParams.put("modifyAction", "deallocate")
+               execution.setVariable("modificationsliceParams", sliceParams)
+
+               String serviceId = execution.getVariable("serviceInstanceId")
+               String nsiId = execution.getVariable("nsiId")
+               logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " operationId:" + modificationJobId)
+
+               ResourceOperationStatus initStatus = new ResourceOperationStatus()
+               initStatus.setServiceId(serviceId)
+               initStatus.setOperationId(modificationJobId)
+               initStatus.setResourceTemplateUUID(nsiId)
+               initStatus.setOperType("Modify-Deallocate")
+               requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+               logger.debug(Prefix + "prepareInitOperationStatus Exit")
+       }
+
+       void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
+
+               String responseId = "1"
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType(networkType)
+               esrInfo.setVendor("ONAP")
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setNssiId(instanceId)
+               serviceInfo.setNsiId(execution.getVariable("nsiId"))
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               execution.setVariable("${networkType}_esrInfo", esrInfo)
+               execution.setVariable("${networkType}_responseId", responseId)
+               execution.setVariable("${networkType}_serviceInfo", serviceInfo)
+
+       }
+
+       void validateJobStatus(DelegateExecution execution,String responseDescriptor) {
+               logger.debug("validateJobStatus ${responseDescriptor}")
+               String status = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.status")
+               String statusDescription = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.statusDescription")
+               if("finished".equalsIgnoreCase(status)) {
+                       execution.setVariable("isSuccess", true)
+               }else {
+                       execution.setVariable("isSuccess", false)
+               }
+       }
+       
+       void prepareUpdateJobStatus(DelegateExecution execution,String status,String progress,String statusDescription) {
+               String serviceId = execution.getVariable("anNssiId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+
+               ResourceOperationStatus roStatus = new ResourceOperationStatus()
+               roStatus.setServiceId(serviceId)
+               roStatus.setOperationId(jobId)
+               roStatus.setResourceTemplateUUID(nsiId)
+               roStatus.setOperType("DeAllocate")
+               roStatus.setProgress(progress)
+               roStatus.setStatus(status)
+               roStatus.setStatusDescription(statusDescription)
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+       }
+       
+       void terminateTNFHNssi(DelegateExecution execution) {
+               logger.debug("Start terminateTNFHNssi in ${Prefix}")
+               String nssmfRequest = buildDeallocateNssiRequest(execution, TN_FH)
+               String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_FH)
+               execution.setVariable("tnFHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_FH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+                               logger.debug("Exit terminateTNFHNssi in ${Prefix}")
+       }
+       
+       void terminateTNMHNssi(DelegateExecution execution) {
+               logger.debug("Start terminateTNMHNssi in ${Prefix}")
+               String nssmfRequest = buildDeallocateNssiRequest(execution, TN_MH)
+               String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_MH)
+               execution.setVariable("tnMHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_MH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+                               logger.debug("Exit terminateTNMHNssi in ${Prefix}")
+       }
+       
+       void deleteRanNfSliceProfileInAAI(DelegateExecution execution) {
+               logger.debug("${Prefix} delete Ran NF SliceProfile In AAI")
+               String spId = execution.getVariable("anNfSliceProfileId")
+               deleteServiceInstanceInAAI(execution, spId)
+       }
+       
+       void deleteTNSliceProfileInAAI(DelegateExecution execution) {
+               logger.debug("${Prefix} delete TN FH SliceProfile In AAI")
+               String fhSP = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_FH)
+               deleteServiceInstanceInAAI(execution, fhSP)
+               logger.debug("${Prefix} delete TN MH SliceProfile In AAI")
+               String mhSP = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_MH)
+               deleteServiceInstanceInAAI(execution, mhSP)
+       }
+       
+       void deleteANNSSI(DelegateExecution execution) {
+               logger.debug("${Prefix} delete AN NSSI")
+               String nssiId = execution.getVariable("serviceInstanceID")
+               deleteServiceInstanceInAAI(execution, nssiId)
+       }
+       
+       /**
+        * Fetches a collection of service instances with the specific role and maps it based on workload context
+        * (AN-NF,TN-FH,TN-MH)
+        * @param execution
+        * @param role                  - nssi/slice profile instance
+        * @param instanceId    - id to which the related list to be found
+        * @return
+        */
+       private Map<String,ServiceInstance> getRelatedInstancesByRole(DelegateExecution execution,String role,String instanceId) {
+               logger.debug("${Prefix} - Fetching related ${role} from AAI")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               if( isBlank(role) || isBlank(instanceId)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Role and instanceId are mandatory")
+               }
+
+               Map<String,ServiceInstance> relatedInstances = new HashMap<>()
+
+               AAIResourcesClient client = getAAIClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                               globalSubscriberId, subscriptionServiceType, instanceId)
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                               uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                                               globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+                               if (!client.exists(uri)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole())) {
+                                               relatedInstances.put(instance.getWorkloadContext(),instance)
+                                       }
+                               }
+                       }
+               }
+               }
+               logger.debug("Found ${relatedInstances.size()} ${role} related to ${instanceId} ")
+               return relatedInstances
+       }
+       
+       private String getInstanceIdByWorkloadContext(Map<String,ServiceInstance> instances,String workloadContext ) {
+               String instanceId = instances.get(workloadContext).getServiceInstanceId()
+               if(instanceId == null) {
+                       throw new BpmnError( 2500, "${workloadContext} NSSI ID is not found.")
+               }
+               return instanceId
+       }
+       
+       /**
+        * Method to handle deallocation of RAN NSSI constituents(TN_FH/TN_MH)
+        * @param execution
+        * @param serviceFunction - TN_FH/TN_MH
+        * @return
+        */
+       private String buildDeallocateNssiRequest(DelegateExecution execution,String serviceFunction) {
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               Map<String, ServiceInstance> relatedNssis = execution.getVariable("relatedNssis")
+
+               String anNssiId = execution.getVariable("anNssiId")
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+
+               Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs")
+
+               DeAllocateNssi deallocateNssi = new DeAllocateNssi()
+               deallocateNssi.setNsiId(anNssiId)
+               ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
+               String nssiId = tnNssi.getServiceInstanceId()
+
+               deallocateNssi.setNssiId(nssiId)
+               deallocateNssi.setScriptName(tnNssi.getServiceInstanceName())
+               deallocateNssi.setSnssaiList(sNssaiList)
+               deallocateNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setVendor("ONAP")
+               esrInfo.setNetworkType("TN")
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
+               serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               JsonObject json = new JsonObject()
+               json.addProperty("deAllocateNssi", objectMapper.writeValueAsString(deallocateNssi))
+               json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+               json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+               return json.toString()
+               
+       }
+       
+       private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) {
+               try {
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), instanceId)
+                       getAAIClient().delete(serviceInstanceUri)
+                       logger.debug("${Prefix} Exited deleteServiceInstance")
+               }catch(Exception e){
+                       logger.debug("Error occured within deleteServiceInstance method: " + e)
+               }
+       }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
new file mode 100644 (file)
index 0000000..7681bf9
--- /dev/null
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNDEALLOC_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    private static final Logger logger = LoggerFactory.getLogger(DoDeallocateTnNssi.class)
+
+
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+
+        execution.setVariable("startTime", System.currentTimeMillis())
+        String msg = tnNssmfUtils.getExecutionInputParams(execution)
+        logger.debug("Deallocate TN NSSI input parameters: " + msg)
+
+        execution.setVariable("prefix", Prefix)
+
+        tnNssmfUtils.setSdncCallbackUrl(execution, true)
+        logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+        String sliceServiceInstanceId = execution.getVariable("serviceInstanceID")
+        execution.setVariable("sliceServiceInstanceId", sliceServiceInstanceId)
+
+        String sliceServiceInstanceName = execution.getVariable("servicename")
+        execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+        logger.debug("Finish preProcessRequest")
+    }
+
+    void preprocessSdncDeallocateTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preprocessSdncDeallocateTnNssiRequest(' +
+                'execution=' + execution.getId() + ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        try {
+            String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "deallocate")
+
+            execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preprocessSdncDeallocateTnNssiRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED preprocessSdncDeallocateTnNssiRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+
+    void deleteServiceInstance(DelegateExecution execution) {
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                    execution.getVariable("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"),
+                    execution.getVariable("serviceInstanceID"))
+            client.delete(uri)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoDeallocateTnNssi.deleteServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    public void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String tnNssiId = execution.getVariable("serviceInstanceID")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, tnNssiId)
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("serviceInstanceID")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType("Deallocate")
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..2e7e728
--- /dev/null
@@ -0,0 +1,656 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.sql.Timestamp
+import java.util.List
+import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.JsonObject
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonArray
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import javax.ws.rs.NotFoundException
+
+class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
+
+       String Prefix="MASS_"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       OofUtils oofUtils = new OofUtils()
+       ObjectMapper objectMapper = new ObjectMapper();
+       AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+       private static final Logger logger = LoggerFactory.getLogger(DoModifyAccessNSSI.class)
+
+       @Override
+       void preProcessRequest(DelegateExecution execution) {
+               logger.debug(Prefix + "preProcessRequest Start")
+               execution.setVariable("prefix", Prefix)
+               execution.setVariable("startTime", System.currentTimeMillis())
+               def msg
+               try {
+
+                       logger.debug("input variables : msoRequestId - "+execution.getVariable("msoRequestId")+
+                                       " globalSubscriberId - "+execution.getVariable("globalSubscriberId")+
+                                       " serviceInstanceID - "+execution.getVariable("serviceInstanceID")+
+                                       " nsiId - "+execution.getVariable("nsiId")+
+                                       " networkType - "+execution.getVariable("networkType")+
+                                       " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
+                                       " jobId - "+execution.getVariable("jobId")+
+                                       " sliceParams - "+execution.getVariable("sliceParams")+
+                                       " servicename - "+ execution.getVariable("servicename"))
+
+                       //validate slice subnet inputs
+
+                       String sliceParams = execution.getVariable("sliceParams")
+                       String modifyAction = jsonUtil.getJsonValue(sliceParams, "modifyAction")
+                       if (isBlank(modifyAction)) {
+                               msg = "Input modifyAction is null"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("modifyAction", modifyAction)
+                               switch(modifyAction) {
+                                       case "allocate":
+                                               execution.setVariable("isModifyallocate", true)
+                                               break
+                                       case "deallocate":
+                                               execution.setVariable("isModifydeallocate", true)
+                                               break
+                                       case "reconfigure":
+                                               execution.setVariable("isModifyreconfigure", true)
+                                               String resourceConfig = jsonUtil.getJsonValue(sliceParams, "resourceConfig")
+                                               execution.setVariable("additionalProperties", resourceConfig)
+                                               break
+                                       default:
+                                               logger.debug("Invalid modify Action")
+                                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction)
+                               }
+                       }
+                       List<String> snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
+                       String sliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
+                       if (isBlank(sliceProfileId) || (snssaiList.empty)) {
+                               msg = "Mandatory fields are empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfileId", sliceProfileId)
+                               execution.setVariable("snssaiList", snssaiList)
+                       }
+                       String nsiName = jsonUtil.getJsonValue(sliceParams, "nsiInfo.nsiName")
+                       String scriptName = jsonUtil.getJsonValue(sliceParams, "scriptName")
+                       execution.setVariable("nsiName", nsiName)
+                       execution.setVariable("scriptName", scriptName)
+                       execution.setVariable("job_timeout", 10)
+                       execution.setVariable("ranNssiPreferReuse", false)
+               } catch(BpmnError e) {
+                       throw e
+               } catch(Exception ex) {
+                       msg = "Exception in DoModifyAccessNSSI.preProcessRequest " + ex.getMessage()
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug(Prefix + "preProcessRequest Exit")
+       }
+       
+       def getSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix + "getSliceProfiles Start")
+               String instanceId = execution.getVariable("sliceProfileId")
+               ServiceInstance sliceProfileInstance = getServiceInstance(execution, instanceId)
+               SliceProfile ranSliceProfile = sliceProfileInstance.getSliceProfiles().getSliceProfile().get(0)
+               logger.debug("RAN slice profile : "+ranSliceProfile.toString())
+               execution.setVariable("RANSliceProfile", ranSliceProfile)
+               execution.setVariable("ranSliceProfileInstance", sliceProfileInstance)
+       }
+       
+       /*
+        * Function to subnet capabilities from nssmf adapter
+        */
+       def getSubnetCapabilities = { DelegateExecution execution ->
+               logger.debug(Prefix+"getSubnetCapabilities method start")
+
+               String tnNssmfRequest = anNssmfUtils.buildCreateTNNSSMFSubnetCapabilityRequest()
+
+               String urlString = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
+
+               String tnNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, tnNssmfRequest)
+
+               if (tnNssmfResponse != null) {
+                       String FHCapabilities= jsonUtil.getJsonValue(tnNssmfResponse, "TN_FH")
+                       String MHCapabilities = jsonUtil.getJsonValue(tnNssmfResponse, "TN_MH")
+                       execution.setVariable("FHCapabilities",FHCapabilities)
+                       execution.setVariable("MHCapabilities",MHCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ tnNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               String anNssmfRequest = anNssmfUtils.buildCreateANNFNSSMFSubnetCapabilityRequest()
+
+               String anNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, anNssmfRequest)
+
+               if (anNssmfResponse != null) {
+                       String ANNFCapabilities = jsonUtil.getJsonValue(anNssmfResponse, "AN_NF")
+                       execution.setVariable("ANNFCapabilities",ANNFCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ anNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+       }
+
+       
+       /*
+        * prepare OOF request for RAN NSSI selection
+        */
+       def prepareOofRequestForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareOofRequestForRanNSS method start")
+
+               String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+               logger.debug( "get NSSI option OOF Url: " + urlString)
+
+               //build oof request body
+               boolean ranNssiPreferReuse = execution.getVariable("ranNssiPreferReuse");
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "NSISelectionResponse"
+               Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("RANSliceProfile"), Map.class)
+               ServiceInstance ranSliceProfileInstance = objectMapper.readValue(execution.getVariable("ranSliceProfileInstance"), ServiceInstance.class)
+               String modelUuid = ranSliceProfileInstance.getModelVersionId()
+               String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId()
+               String modelName = execution.getVariable("servicename")
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               List<String> nsstInfoList =  new ArrayList<>()
+               JsonArray capabilitiesList = new JsonArray()
+               String FHCapabilities = execution.getVariable("FHCapabilities")
+               String MHCapabilities = execution.getVariable("MHCapabilities")
+               String ANNFCapabilities = execution.getVariable("ANNFCapabilities")
+               JsonObject FH = new JsonObject()
+               JsonObject MH = new JsonObject()
+               JsonObject ANNF = new JsonObject()
+               FH.addProperty("domainType", "TN_FH")
+               FH.addProperty("capabilityDetails", FHCapabilities)
+               MH.addProperty("domainType", "TN_MH")
+               MH.addProperty("capabilityDetails", MHCapabilities)
+               ANNF.addProperty("domainType", "AN_NF")
+               ANNF.addProperty("capabilityDetails", FHCapabilities)
+               capabilitiesList.add(FH)
+               capabilitiesList.add(MH)
+               capabilitiesList.add(ANNF)
+
+               execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+               execution.setVariable("nssiSelection_messageType",messageType)
+               execution.setVariable("nssiSelection_correlator",requestId)
+               execution.setVariable("nssiSelection_timeout",timeout)
+               String oofRequest = anNssmfUtils.buildSelectRANNSSIRequest(requestId, messageType, modelUuid,modelInvariantUuid,
+                               modelName, profileInfo, nsstInfoList, capabilitiesList, ranNssiPreferReuse)
+
+               execution.setVariable("nssiSelection_oofRequest",oofRequest)
+               logger.debug("Sending request to OOF: " + oofRequest)
+       }
+       
+       /*
+        * process OOF response for RAN NSSI selection
+        */
+       def processOofResponseForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"processOofResponseForRanNSS method start")
+               String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
+               String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+               if(requestStatus.equals("completed")) {
+                       List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
+                       boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+                       if(!existingNSI) {
+                               def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
+                               execution.setVariable("RanConstituentSliceProfiles", sliceProfiles)
+                               List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(sliceProfiles)
+                               anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
+                               logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles)
+                       }else {
+                               String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                               logger.error("failed to get slice profiles from oof "+ statusMessage)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"failed to get slice profiles from oof "+statusMessage)
+                       }
+               }else {
+                       String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                       logger.error("received failed status from oof "+ statusMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+               }
+
+       }
+       def getNssisFromAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"getNssisFromAai method start")
+               String instanceId = execution.getVariable("serviceInstanceID")
+               String role = "nssi"
+               Map<String,ServiceInstance> ranConstituentNssis = getRelatedInstancesByRole(execution, role, instanceId)
+               logger.debug("getNssisFromAai ranConstituentNssis : "+ranConstituentNssis.toString())
+               ranConstituentNssis.each { key, val -> 
+                       switch(key) {
+                               case "AN-NF":
+                                       execution.setVariable("ANNF_NSSI", val.getServiceInstanceId())
+                                       execution.setVariable("ANNF_nssiName", val.getServiceInstanceName())
+                                       break
+                               case "TN-FH":
+                                       execution.setVariable("TNFH_NSSI", val.getServiceInstanceId())
+                                       execution.setVariable("TNFH_nssiName", val.getServiceInstanceName())
+                                       break
+                               case "TN-MH":
+                                       execution.setVariable("TNMH_NSSI", val.getServiceInstanceId())
+                                       execution.setVariable("TNMH_nssiName", val.getServiceInstanceName())
+                                       break
+                               default:
+                                       logger.error("No expected match found for current domainType "+ key)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ key)
+                       }
+               }
+               
+       }
+       def createSliceProfiles = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSliceProfiles method start")
+               anNssmfUtils.createSliceProfilesInAai(execution)
+       }
+       def updateRelationshipInAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"updateRelationshipInAai method start")
+               String msg = ""
+               try {
+                       def ANNF_serviceInstanceId = execution.getVariable("ANNF_NSSI")
+                       def TNFH_serviceInstanceId = execution.getVariable("TNFH_NSSI")
+                       def TNMH_serviceInstanceId = execution.getVariable("TNMH_NSSI")
+                       def AN_profileInstanceId = execution.getVariable("sliceProfileId")
+                       def ANNF_profileInstanceId = execution.getVariable("ANNF_sliceProfileInstanceId")
+                       def TNFH_profileInstanceId = execution.getVariable("TNFH_sliceProfileInstanceId")
+                       def TNMH_profileInstanceId = execution.getVariable("TNMH_sliceProfileInstanceId")
+                       String globalSubscriberId = execution.getVariable("globalSubscriberId")
+                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+                       Relationship ANNF_relationship = new Relationship()
+                       Relationship TNFH_relationship = new Relationship()
+                       Relationship TNMH_relationship = new Relationship()
+                       
+                       String ANNF_relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${ANNF_profileInstanceId}"
+                       String TNFH_relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNFH_profileInstanceId}"
+                       String TNMH_relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNMH_profileInstanceId}"
+                       
+                       ANNF_relationship.setRelatedLink(ANNF_relatedLink)
+                       ANNF_relationship.setRelatedTo("service-instance")
+                       ANNF_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNFH_relationship.setRelatedLink(TNFH_relatedLink)
+                       TNFH_relationship.setRelatedTo("service-instance")
+                       TNFH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNMH_relationship.setRelatedLink(TNMH_relatedLink)
+                       TNMH_relationship.setRelatedTo("service-instance")
+                       TNMH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       
+                       // create SliceProfile and NSSI relationship in AAI
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,ANNF_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,TNFH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,TNMH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,AN_profileInstanceId)
+
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+
+                       msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+       }
+       
+       def processRanNfModifyRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processRanNfModifyRsp method start")
+               anNssmfUtils.processRanNfModifyRsp(execution)
+       }
+       
+       def prepareTnFhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_FH", "modify-allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNFH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnFhRequest")
+
+       }
+       def prepareTnMhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnMhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_MH", "modify-allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNMH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnMhRequest")
+       }
+       
+       def createFhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_FH")
+       }
+       
+       def createMhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_MH")
+       }
+       
+       private void createTnAllocateNssiJobQuery(DelegateExecution execution, String domainType) {
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("TN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               execution.setVariable("esrInfo", esrInfoString)
+               JsonObject serviceInfo = new JsonObject()
+               
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               serviceInfo.addProperty("sST", sST)
+               serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               serviceInfo.addProperty("serviceInvariantUuid", null)
+               serviceInfo.addProperty("serviceUuid", null)
+               if(domainType.equals("TN_FH")) {
+                       serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+               }else if(domainType.equals("TN_MH")) {
+                       serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+               }
+               execution.setVariable("serviceInfo", serviceInfo.toString())
+               execution.setVariable("responseId", "")
+       }
+       
+       def processFhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNFH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def processMhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNMH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def getSliceProfilesFromAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"getSliceProfilesFromAai method start")
+               String instanceId = execution.getVariable("sliceProfileId")
+               String role = "slice-profile-instance"
+               Map<String,ServiceInstance> ranConstituentSliceProfiles = getRelatedInstancesByRole(execution, role, instanceId)
+               logger.debug("getSliceProfilesFromAai ranConstituentSliceProfiles : "+ranConstituentSliceProfiles.toString())
+               ranConstituentSliceProfiles.each { key, val ->
+                       switch(key) {
+                               case "AN-NF":
+                                       execution.setVariable("ANNF_sliceProfileInstanceId", val.getServiceInstanceId())
+                                       break
+                               case "TN-FH":
+                                       execution.setVariable("TNFH_sliceProfileInstanceId", val.getServiceInstanceId())
+                                       break
+                               case "TN-MH":
+                                       execution.setVariable("TNMH_sliceProfileInstanceId", val.getServiceInstanceId())
+                                       break
+                               default:
+                                       logger.error("No expected match found for current domainType "+ key)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ key)
+                       }
+               }
+       }
+       
+       def prepareTnFhDeallocateRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhDeallocateRequest method start")
+               String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
+               String nssiId = execution.getVariable("TNFH_NSSI")
+               execution.setVariable("tnFHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_FH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+       }
+       
+       def prepareTnMhDeallocateRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhDeallocateRequest method start")
+               String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
+               String nssiId = execution.getVariable("TNFH_NSSI")
+               execution.setVariable("tnFHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_MH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+       }
+       
+       def createFhDeAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_FH")
+       }
+       
+       def createMhDeAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_MH")
+       }
+       def deleteFhSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix+"deleteFhSliceProfile method start")
+               deleteServiceInstanceInAAI(execution,execution.getVariable("TNFH_sliceProfileInstanceId"))
+       }
+       def deleteMhSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix+"deleteMhSliceProfile method start")
+               deleteServiceInstanceInAAI(execution,execution.getVariable("TNMH_sliceProfileInstanceId"))      
+       }
+       def deleteAnSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix+"deleteAnSliceProfile method start")
+               deleteServiceInstanceInAAI(execution,execution.getVariable("ANNF_sliceProfileInstanceId"))
+       }
+       /**
+        * update operation status in request db
+        *
+        */
+       def prepareOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareOperationStatusUpdate Start")
+
+               String serviceId = execution.getVariable("serviceInstanceID")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("serviceInstanceID")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Modify")
+               updateStatus.setProgress(100)
+               updateStatus.setStatus("finished")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+
+               logger.debug(Prefix + "prepareOperationStatusUpdate Exit")
+       }
+
+       def prepareFailedOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start")
+               
+               String serviceId = execution.getVariable("serviceInstanceID")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("serviceInstanceID")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Modify")
+               updateStatus.setProgress(0)
+               updateStatus.setStatus("failed")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+       }
+       
+       /**
+        * @param execution
+        * @param role            - nssi/slice profile instance
+        * @param instanceId    - id to which the related list to be found
+        * @return
+        */
+       private Map<String,ServiceInstance> getRelatedInstancesByRole(DelegateExecution execution,String role,String instanceId) {
+               logger.debug("${Prefix} - Fetching related ${role} from AAI")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               
+               Map<String,ServiceInstance> relatedInstances = new HashMap<>()
+               
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                               globalSubscriberId, subscriptionServiceType, instanceId)
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+
+                               AAIResourcesClient client01 = new AAIResourcesClient()
+                               AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                                               globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+                               if (!client.exists(uri01)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole())) {
+                                               relatedInstances.put(instance.getWorkloadContext(),instance)
+                                       }
+                               }
+                       }
+               }
+               }
+               logger.debug("Found ${relatedInstances.size()} ${role} related to ${instanceId} ")
+               return relatedInstances
+       }
+       
+       private ServiceInstance getServiceInstance(DelegateExecution execution, String instanceId) {
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               ServiceInstance serviceInstance = new ServiceInstance()
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                               globalSubscriberId, subscriptionServiceType, instanceId)
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               
+               if(si.isPresent()) {
+                       serviceInstance = si
+               }
+               return serviceInstance
+       }
+       private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) {
+               try {
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), instanceId)
+                       getAAIClient().delete(serviceInstanceUri)
+                       logger.debug("${Prefix} Exited deleteServiceInstance")
+               }catch(Exception e){
+                       logger.debug("Error occured within deleteServiceInstance method: " + e)
+               }
+       }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
new file mode 100644 (file)
index 0000000..6c12a65
--- /dev/null
@@ -0,0 +1,732 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.CloudRegion
+import org.onap.aai.domain.yang.Customer
+import org.onap.aai.domain.yang.GenericVnf
+import org.onap.aai.domain.yang.ModelVer
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.ServiceSubscription
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aai.domain.yang.Tenant
+import org.onap.aai.domain.yang.VfModule
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.Relationships
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.db.request.beans.OperationStatus
+import org.onap.so.requestsdb.RequestsDbConstant
+import org.onap.so.serviceinstancebeans.CloudConfiguration
+import org.onap.so.serviceinstancebeans.ModelInfo
+import org.onap.so.serviceinstancebeans.ModelType
+import org.onap.so.serviceinstancebeans.OwningEntity
+import org.onap.so.serviceinstancebeans.Project
+import org.onap.so.serviceinstancebeans.RequestDetails
+import org.onap.so.serviceinstancebeans.RequestInfo
+import org.onap.so.serviceinstancebeans.RequestParameters
+import org.onap.so.serviceinstancebeans.Resources
+import org.onap.so.serviceinstancebeans.Service
+import org.onap.so.serviceinstancebeans.SubscriberInfo
+import org.onap.so.serviceinstancebeans.VfModules
+import org.onap.so.serviceinstancebeans.Vnfs
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.core.Response
+
+class DoModifyCoreNSSI extends AbstractServiceTaskProcessor {
+
+    private final String PREFIX ="DoModifyCoreNSSI"
+
+    private ExceptionUtil exceptionUtil = new ExceptionUtil()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+    private MsoUtils utils = new MsoUtils()
+    private JsonUtils jsonUtil = new JsonUtils()
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( DoModifyCoreNSSI.class)
+
+    @Override
+    void preProcessRequest(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start preProcessRequest")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+        if (!currentNSSI) {
+            String msg = "currentNSSI is null"
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+        LOGGER.trace("***** ${PREFIX} Exit preProcessRequest")
+    }
+
+
+    /**
+     * Queries Network Service Instance in AAI
+     * @param execution
+     */
+    void getNetworkServiceInstance(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start getNetworkServiceInstance")
+
+        AAIResourcesClient client = getAAIClient()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String globalSubscriberId = currentNSSI['globalSubscriberId']
+        String serviceType = currentNSSI['serviceType']
+        String nssiId = currentNSSI['nssiServiceInstanceId']
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId) //AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiId)
+        Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, nssiUri)
+
+        if (nssiOpt.isPresent()) {
+            ServiceInstance nssi = nssiOpt.get()
+            execution.setVariable("nssi", nssi)
+
+            execution.setVariable("nssiUri", nssiUrl)
+
+            // Network Service Instance
+            AAIResultWrapper wrapper = client.get(nssiUri);
+            Optional<Relationships> relationships = wrapper.getRelationships()
+            if (relationships.isPresent()) {
+                for(AAIResourceUri networkServiceInstanceUri: relationships.get().getRelatedAAIUris(AAIObjectType.SERVICE_INSTANCE)){ // ???
+                    Optional<ServiceInstance> networkServiceInstanceOpt = client.get(ServiceInstance.class, networkServiceInstanceUri)
+                    if(networkServiceInstanceOpt.isPresent()) {
+                        ServiceInstance networkServiceInstance = networkServiceInstanceOpt.get()
+
+                        if(networkServiceInstance.getServiceRole().equals("Network Service")) { // Network Service
+                            execution.setVariable("networkServiceInstance", networkServiceInstance)
+
+                            execution.setVariable("networkServiceInstanceUri", networkServiceInstanceUri)
+                            break // Should be only one Network Service Instance
+                        }
+                    }
+                    else {
+                        String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId)
+                        LOGGER.error(msg)
+                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+                    }
+
+                }
+            }
+            else {
+                String msg = String.format("No relationship presented for NSSI %s in AAI", nssiId)
+                LOGGER.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+            }
+        }
+        else {
+            String msg = String.format("NSSI %s not found in AAI", nssiId)
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+
+
+        LOGGER.trace("***** ${PREFIX} Exit getNetworkServiceInstance")
+    }
+
+
+    /**
+     * Queries constitute VNF from Network Service Instance
+     * @param execution
+     */
+    void getConstituteVNFFromNetworkServiceInst(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start getConstituteVNFFromNetworkServiceInst")
+
+        AAIResourcesClient client = getAAIClient()
+
+        AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)execution.getVariable("networkServiceInstanceUri")
+        AAIResultWrapper wrapper = client.get(networkServiceInstanceUri);
+        Optional<Relationships> relationships = wrapper.getRelationships()
+        if (relationships.isPresent()) {
+            for (AAIResourceUri constituteVnfUri : relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)) {  // ???
+                execution.setVariable("constituteVnfUri", constituteVnfUri)
+                Optional<GenericVnf> constituteVnfOpt = client.get(GenericVnf.class, constituteVnfUri)
+                if(constituteVnfOpt.isPresent()) {
+                    GenericVnf constituteVnf = constituteVnfOpt.get()
+                    execution.setVariable("constituteVnf", constituteVnf)
+                }
+                else {
+                    String msg = String.format("No constitute VNF found for Network Service Instance %s in AAI", ((ServiceInstance)execution.getVariable("networkServiceInstance")).getServiceInstanceId())
+                    LOGGER.error(msg)
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+                }
+
+                execution.setVariable("networkServiceInstanceUri", networkServiceInstanceUri)
+                break  // Should be only one constitute VNF
+            }
+        }
+        else {
+            String msg = String.format("No relationship presented for Network Service Instance %s in AAI", ((ServiceInstance)execution.getVariable("networkServiceInstance")).getServiceInstanceId())
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+
+        LOGGER.trace("${PREFIX} Exit getConstituteVNFFromNetworkServiceInst")
+
+    }
+
+
+    /**
+     * Retrieves NSSI associated profiles from AAI
+     * @param execution
+     */
+    void getNSSIAssociatedProfiles(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start getNSSIAssociatedProfiles")
+
+        AAIResourcesClient client = getAAIClient()
+
+        ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi")
+
+        List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+
+        if(associatedProfiles.isEmpty()) {
+            String msg = String.format("No associated profiles found for NSSI %s in AAI", nssi.getServiceInstanceId())
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+        else {
+            execution.setVariable("associatedProfiles", associatedProfiles)
+        }
+
+        LOGGER.trace("${PREFIX} Exit getNSSIAssociatedProfiles")
+    }
+
+
+    /**
+     * Calculates a final list of S-NSSAI
+     * @param execution
+     */
+    void calculateSNSSAI(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start calculateSNSSAI")
+
+        List<SliceProfile> associatedProfiles = (List<SliceProfile>)execution.getVariable("associatedProfiles")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String currentSNSSAI = currentNSSI['S-NSSAI']
+
+        List<String> snssais = new ArrayList<>()
+
+        if((Boolean)execution.getVariable("isCreateSliceProfileInstance" ).equals(Boolean.TRUE)) { // Slice Profile Instance has to be created
+            for (SliceProfile associatedProfile : associatedProfiles) {
+                snssais.add(associatedProfile.getSNssai())
+            }
+
+            snssais.add(currentSNSSAI)
+        }
+        else { // Slice profile instance has to be deleted
+            for (SliceProfile associatedProfile : associatedProfiles) {
+                if (!associatedProfile.getSNssai().equals(currentNSSI)) { // not current S-NSSAI
+                    snssais.add(associatedProfile.getSNssai())
+                }
+            }
+        }
+
+        execution.setVariable("S-NSSAIs", snssais)
+
+        LOGGER.trace("${PREFIX} Exit calculateSNSSAI")
+    }
+
+
+    /**
+     * Invoke PUT Service Instance API
+     * @param execution
+     */
+    void invokePUTServiceInstance(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start invokePUTServiceInstance")
+
+        try {
+            //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfId}"
+            def nsmfЕndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ???
+
+            ServiceInstance networkServiceInstance = (ServiceInstance)execution.getVariable("networkServiceInstance")
+
+            GenericVnf constituteVnf = (GenericVnf)execution.getVariable("constituteVnf")
+
+            String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId()) // ???
+
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+            String basicAuthValue = utils.encrypt(basicAuth, msoKey)
+            String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
+
+            HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.EXTERNAL)
+            httpClient.addAdditionalHeader("Authorization", encodeString)
+            httpClient.addAdditionalHeader("Accept", "application/json")
+
+            RequestDetails requestDetails = prepareRequestDetails(execution)
+            ObjectMapper mapper = new ObjectMapper()
+            String requestDetailsStr = mapper.writeValueAsString(requestDetails)
+
+            Response httpResponse = httpClient.put(requestDetailsStr) // check http code ???
+        } catch (any) {
+            String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause()
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        LOGGER.trace("${PREFIX} Exit invokePUTServiceInstance")
+    }
+
+
+    /**
+     * Prepare model info
+     * @param execution
+     * @param requestDetails
+     * @return
+     */
+    private ModelInfo prepareModelInfo(DelegateExecution execution) {
+        ModelInfo modelInfo = new ModelInfo()
+
+        modelInfo.setModelType(ModelType.service)
+        modelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId())
+
+        AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, networkServiceInstance.getModelInvariantId()) // model of Network Service Instance ???
+        Optional<ModelVer> modelVerOpt = client.get(ModelVer.class, modelVerUrl)
+
+        if (modelVerOpt.isPresent()) {
+            modelInfo.setModelVersionId(modelVerOpt.get().getModelVersionId())
+            modelInfo.setModelName(modelVerOpt.get().getModelName())
+            modelInfo.setModelVersion(modelVerOpt.get().getModelVersion())
+        }
+
+
+        return modelInfo
+    }
+
+
+    /**
+     * Prepares RequestDetails object
+     * @param execution
+     * @return
+     */
+    private RequestDetails prepareRequestDetails(DelegateExecution execution) {
+        RequestDetails requestDetails = new RequestDetails()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String globalSubscriberId = currentNSSI['globalSubscriberId']
+
+        ServiceInstance networkServiceInstance = (ServiceInstance)execution.getVariable("networkServiceInstance")
+
+
+        AAIResourcesClient client = getAAIClient()
+
+        // Model Info
+        requestDetails.setModelInfo(prepareModelInfo(execution))
+
+        // Subscriber Info
+        SubscriberInfo subscriberInfo = new SubscriberInfo()
+        subscriberInfo.setGlobalSubscriberId(globalSubscriberId)
+
+        Customer customer = null
+        ServiceSubscription serviceSubscription = null
+
+        AAIResourceUri networkServiceInstanceUri = execution.getVariable("networkServiceInstanceUri")
+        AAIResultWrapper wrapper = client.get(networkServiceInstanceUri)
+        Optional<Relationships> serviceSubscriptionRelationshipsOps = wrapper.getRelationships()
+        if(serviceSubscriptionRelationshipsOps.isPresent()) {
+            List<AAIResourceUri> serviceSubscriptionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.SERVICE_SUBSCRIPTION)
+            if(!(serviceSubscriptionRelatedAAIUris == null || serviceSubscriptionRelatedAAIUris.isEmpty())) {
+                AAIResourceUri serviceSubscriptionUri = serviceSubscriptionRelatedAAIUris.get(0) // Many-To-One relation
+                Optional<ServiceSubscription> serviceSubscriptionOpt = client.get(ServiceSubscription.class, serviceSubscriptionUri)
+                if(serviceSubscriptionOpt.isPresent()) {
+                    serviceSubscription = serviceSubscriptionOpt.get()
+                }
+
+                wrapper = client.get(serviceSubscriptionUri)
+                Optional<Relationships> customerRelationshipsOps = wrapper.getRelationships()
+                if(customerRelationshipsOps.isPresent()) {
+                    List<AAIResourceUri> customerRelatedAAIUris = customerRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.CUSTOMER)
+                    if(!(customerRelatedAAIUris == null || customerRelatedAAIUris.isEmpty())) {
+                        Optional<Customer> customerOpt = client.get(Customer.class, customerRelatedAAIUris.get(0)) // Many-To-One relation
+                        if(customerOpt.isPresent()) {
+                            customer = customerOpt.get()
+                            subscriberInfo.setSubscriberName(customer.getSubscriberName())
+                        }
+                    }
+                }
+            }
+
+        }
+        requestDetails.setSubscriberInfo(subscriberInfo)
+
+        // Request Info
+        RequestInfo requestInfo = new RequestInfo()
+        requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName())
+
+        /* No found data to provide ???
+        requestInfo.setSource()
+        requestInfo.setSuppressRollback()
+        requestInfo.setRequestorId()
+        requestInfo.setProductFamilyId()
+        */
+
+        requestDetails.setRequestInfo(requestInfo)
+
+
+        // Request Parameters
+        RequestParameters requestParameters = new RequestParameters()
+
+        // No found data to provide ??? requestParameters.setaLaCarte()
+        requestParameters.setSubscriptionServiceType(serviceSubscription.getServiceType())
+
+        // User params
+        List<Map<String, Object>> userParams = new ArrayList<>()
+        // Service
+        Service service = new Service()
+        // Model Info
+        ModelInfo serviceModelInfo = new ModelInfo()
+        serviceModelInfo.setModelType(ModelType.service)
+        serviceModelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId())
+
+        serviceModelInfo.setModelVersionId(modelInfo.get().getModelVersionId())
+        serviceModelInfo.setModelName(modelInfo.get().getModelName())
+        serviceModelInfo.setModelVersion(modelInfo.get().getModelVersion())
+
+        service.setModelInfo(serviceModelInfo)
+
+        // Resources
+        Resources resources = new Resources()
+
+        CloudRegion cloudRegion = null
+        AAIResourceUri cloudRegionRelatedAAIUri = null
+        // VNFs
+        List<Vnfs> vnfs = new ArrayList<>()
+        // VNF
+        Vnfs vnf = new Vnfs()
+
+        // Cloud configuration
+        CloudConfiguration cloudConfiguration = new CloudConfiguration()
+
+        AAIResourceUri constituteVnfUri = (AAIResourceUri)execution.getVariable("constituteVnfUri")
+        wrapper = client.get(constituteVnfUri)
+        Optional<Relationships> constituteVnfOps = wrapper.getRelationships()
+        if(constituteVnfOps.isPresent()) {
+            List<AAIResourceUri> cloudRegionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION)
+            if(!(cloudRegionRelatedAAIUris == null || cloudRegionRelatedAAIUris.isEmpty())) {
+                cloudRegionRelatedAAIUri = cloudRegionRelatedAAIUris.get(0)
+                Optional<CloudRegion> cloudRegionrOpt = client.get(CloudRegion.class, cloudRegionRelatedAAIUris.get(0))
+                if(cloudRegionrOpt.isPresent()) {
+                    cloudRegion = cloudRegionrOpt.get()
+                    cloudConfiguration.setLcpCloudRegionId(cloudRegion.getCloudRegionId())
+                    for(Tenant tenant:cloudRegion.getTenants()) {
+                        cloudConfiguration.setTenantId(tenant.getTenantId())
+                        break // only one is required
+                    }
+
+                    cloudConfiguration.setCloudOwner(cloudRegion.getCloudOwner())
+                }
+            }
+        }
+
+        vnf.setCloudConfiguration(cloudConfiguration)
+
+        // VF Modules
+        GenericVnf constituteVnf = execution.getVariable("constituteVnf")
+        List<VfModules> vfModuless = new ArrayList<>()
+        for(VfModule vfModule:constituteVnf.getVfModules()) {
+            VfModules vfmodules = new VfModules()
+
+            ModelInfo vfModuleModelInfo = new ModelInfo()
+            vfModuleModelInfo.setModelInvariantUuid(vfModule.getModelInvariantId())
+
+            AAIResourceUri vfModuleUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, vfModule.getModelInvariantId()) // ???
+            Optional<ModelVer> vfModuleModelVerOpt = client.get(ModelVer.class, vfModuleUrl)
+
+            if (vfModuleModelVerOpt.isPresent()) {
+                vfModuleModelInfo.setModelVersionId(vfModuleModelVerOpt.get().getModelVersionId())
+                vfModuleModelInfo.setModelName(vfModuleModelVerOpt.get().getModelName())
+                vfModuleModelInfo.setModelVersion(vfModuleModelVerOpt.get().getModelVersion())
+
+                // No model customization ID
+            }
+            vfmodules.setModelInfo(vfModuleModelInfo)
+
+            vfmodules.setInstanceName(vfModule.getVfModuleName()) // ???
+
+            vfModuless.add(vfmodules)
+        }
+        vnf.setVfModules(vfModuless)
+
+        // Model Info
+        ModelInfo vnfModelInfo = new ModelInfo()
+        vnfModelInfo.setModelInvariantUuid(constituteVnf.getModelInvariantId())
+        AAIResourceUri vnfModelUrl = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, constituteVnf.getModelInvariantId()) // ???
+        Optional<ModelVer> vnfModelVerOpt = client.get(ModelVer.class, vnfModelUrl)
+
+        if (vnfModelVerOpt.isPresent()) {
+            vnfModelInfo.setModelVersionId(vnfModelVerOpt.get().getModelVersionId())
+            vnfModelInfo.setModelName(vnfModelVerOpt.get().getModelName())
+            vnfModelInfo.setModelVersion(vnfModelVerOpt.get().getModelVersion())
+
+            // No model customization ID
+            // No model instance name
+        }
+
+        vnf.setModelInfo(vnfModelInfo)
+
+        // Instance name
+        vnf.setInstanceName(constituteVnf.getVnfInstanceId())
+
+        // Instance params
+        List<Map<String, Object>> instanceParams = new ArrayList<>()
+        Map<String, Object> supporrtedNSSAIMap = new HashMap<>()
+
+        // Supported S-NSSAI
+        List<String> snssais = ( List<String>)execution.getVariable("S-NSSAIs")
+        supporrtedNSSAIMap.put("supporrtedNSSAI", snssais) // remaining S-NSSAIs ??? there is no status for each s-nssai
+        instanceParams.add(supporrtedNSSAIMap)
+
+        // No other instance params, e.g. config-type
+
+        vnf.setInstanceParams(instanceParams)
+
+        // No platform data
+
+        vnfs.add(vnf)
+        resources.setVnfs(vnfs)
+
+        service.setResources(resources)
+
+        Map<String, Object> serviceMap = new HashMap<>()
+        serviceMap.put("service", service)
+        userParams.add(serviceMap)
+        requestParameters.setUserParams(userParams)
+
+        // No other user params
+
+        requestDetails.setRequestParameters(requestParameters)
+
+        // No other request params
+
+        // Cloud configuration
+        requestDetails.setCloudConfiguration(cloudConfiguration)
+
+        // Owning entity
+        OwningEntity owningEntity = new OwningEntity()
+        wrapper = client.get(networkServiceInstanceUri)
+        Optional<Relationships> owningEntityRelationshipsOps = wrapper.getRelationships()
+        if(owningEntityRelationshipsOps.isPresent()) {
+            List<AAIResourceUri> owningEntityRelatedAAIUris = owningEntityRelationshipsOps.get().getRelatedAAIUris(AAIObjectType.OWNING_ENTITY)
+
+            if(!(owningEntityRelatedAAIUris == null || owningEntityRelatedAAIUris.isEmpty())) {
+                Optional<org.onap.aai.domain.yang.OwningEntity> owningEntityOpt = client.get(org.onap.aai.domain.yang.OwningEntity.class, owningEntityRelatedAAIUris.get(0)) // Many-To-One relation
+                if(owningEntityOpt.isPresent()) {
+                    owningEntity.setOwningEntityId(owningEntityOpt.get().getOwningEntityId())
+                    owningEntity.setOwningEntityName(owningEntityOpt.get().getOwningEntityName())
+                    requestDetails.setOwningEntity(owningEntity)
+                }
+            }
+        }
+
+        // Project
+        Project project = new Project()
+        if(cloudRegionRelatedAAIUri != null) {
+            wrapper = client.get(cloudRegionRelatedAAIUri)
+            Optional<Relationships> cloudRegionOps = wrapper.getRelationships()
+            if(cloudRegionOps.isPresent()) {
+                List<AAIResourceUri> projectAAIUris = cloudRegionOps.get().getRelatedAAIUris(AAIObjectType.PROJECT)
+                if (!(projectAAIUris == null || projectAAIUris.isEmpty())) {
+                    Optional<org.onap.aai.domain.yang.Project> projectOpt = client.get(org.onap.aai.domain.yang.Project.class, projectAAIUris.get(0))
+                    if(projectOpt.isPresent()) {
+                        project.setProjectName(projectOpt.get().getProjectName())
+                    }
+                }
+            }
+        }
+        requestDetails.setProject(project)
+
+        return requestDetails
+    }
+
+
+    /**
+     * Creates Slice Profile Instance
+     * @param execution
+     */
+    void createSliceProfileInstance(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start createSliceProfileInstance")
+
+        String sliceProfileID = execution.getVariable("sliceProfileID")
+        Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn")
+        Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setServiceAreaDimension("")
+        sliceProfile.setPayloadSize(0)
+        sliceProfile.setJitter(0)
+        sliceProfile.setSurvivalTime(0)
+        sliceProfile.setExpDataRate(0)
+        sliceProfile.setTrafficDensity(0)
+        sliceProfile.setConnDensity(0)
+        sliceProfile.setSNssai(sliceProfileMap.get("sNSSAI").toString())
+        sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
+        sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
+        sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
+        sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString())
+        sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
+        sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
+        sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
+        sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
+        sliceProfile.setProfileId(sliceProfileID)
+        sliceProfile.setE2ELatency(0)
+
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, sliceProfileID)
+            client.create(uri, sliceProfile)
+
+            execution.setVariable("createdSliceProfile", sliceProfile)
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile create call:" + ex.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit createSliceProfileInstance")
+    }
+
+
+    /**
+     * Creates Slice Profile association with NSSI
+     * @param execution
+     */
+    void associateSliceProfileInstanceWithNSSI(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start associateSliceProfileInstanceWithNSSI")
+
+        String sliceProfileID = execution.getVariable("sliceProfileID")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String nssiId = currentNSSI['nssiServiceInstanceId']
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId)
+        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, sliceProfileID)
+
+        try {
+            SliceProfile createdSliceProfile = (SliceProfile)execution.getVariable("createdSliceProfile")
+            ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi")
+            List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+            associatedProfiles.add(createdSliceProfile)
+
+            getAAIClient().update(nssiUri, nssi)
+
+            getAAIClient().connect(sliceProfileUri, nsiUri, AAIEdgeLabel.BELONGS_TO)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI disconnect call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit associateSliceProfileInstanceWithNSSI")
+    }
+
+
+    /**
+    * Removes Slice Profile association with NSSI
+    * @param execution
+    */
+    void removeSPAssociationWithNSSI(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start removeSPAssociationWithNSSI")
+
+        AAIResourcesClient client = getAAIClient()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi")
+
+        String nssiId = currentNSSI['nssiServiceInstanceId']
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiId)
+
+        List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+
+        String currentSNSSAI = currentNSSI['S-NSSAI']
+
+        associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) })
+
+        try {
+            getAAIClient().update(nssiUri, nssi)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit removeSPAssociationWithNSSI")
+    }
+
+
+    /**
+     * Deletes Slice Profile Instance
+     * @param execution
+     */
+    void deleteSliceProfileInstance(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start deleteSliceProfileInstance")
+
+        AAIResourcesClient client = getAAIClient()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        ServiceInstance nssi = (ServiceInstance)execution.getVariable("nssi")
+
+        List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+
+        String currentSNSSAI = currentNSSI['S-NSSAI']
+
+        AAIResourceUri sliceProfileUri = null
+
+        for(SliceProfile associatedProfile:associatedProfiles) {
+            if(!associatedProfile.getSNssai().equals(currentNSSI)) { // not current S-NSSAI
+                sliceProfileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, associatedProfile.getProfileId())
+                break
+            }
+        }
+
+        try {
+            getAAIClient().delete(sliceProfileUri)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit deleteSliceProfileInstance")
+    }
+
+
+    /**
+     * Updates operation status
+     * @param execution
+     */
+    void updateServiceOperationStatus(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start updateServiceOperationStatus")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        OperationStatus operationStatus = new OperationStatus()
+        operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
+        operationStatus.setOperationId(currentNSSI['operationId'] as String)
+        operationStatus.setOperation(currentNSSI['operationType'] as String)
+        operationStatus.setResult(RequestsDbConstant.Status.FINISHED)
+
+        requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+
+        LOGGER.trace("${PREFIX} Exit updateServiceOperationStatus")
+    }
+
+
+    /**
+     * Returns AAI client
+     * @return AAI client
+     */
+    AAIResourcesClient getAAIClient() {
+        return new AAIResourcesClient()
+    }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
new file mode 100644 (file)
index 0000000..6fdfbe3
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonObject
+import java.sql.Timestamp
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import org.onap.so.bpmn.core.UrnPropertiesReader
+
+class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
+
+       String Prefix="MANNFNSS_"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       ObjectMapper objectMapper = new ObjectMapper();
+       AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+
+       private static final Logger logger = LoggerFactory.getLogger(DoModifyRanNfNssi.class)
+
+       @Override
+       void preProcessRequest(DelegateExecution execution) {
+               logger.debug(Prefix + "preProcessRequest Start")
+               execution.setVariable("prefix", Prefix)
+               execution.setVariable("startTime", System.currentTimeMillis())
+               def msg
+               try {
+
+                       logger.debug("input variables : msoRequestId - "+execution.getVariable("msoRequestId")+
+                                       " globalSubscriberId - "+execution.getVariable("globalSubscriberId")+
+                                       " serviceInstanceID - "+execution.getVariable("serviceInstanceID")+
+                                       " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
+                                       " sliceProfileId - "+execution.getVariable("sliceProfileId")+
+                                       " snssaiList - "+execution.getVariable("snssaiList")+
+                                       " modifyAction - "+execution.getVariable("modifyAction"))
+
+                       //validate RAN NF slice subnet inputs
+
+                       String modifyAction = execution.getVariable("modifyAction")
+                       if (isBlank(modifyAction)) {
+                               msg = "Input modifyAction is null"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("modifyAction", modifyAction)
+                               switch(modifyAction) {
+                                       case "allocate":
+                                               String sliceProfile = execution.getVariable("additionalProperties")
+                                               execution.setVariable("sliceProfile", sliceProfile)
+                                               break
+                                       case "reconfigure":
+                                               String resourceConfig = execution.getVariable("additionalProperties")
+                                               execution.setVariable("resourceConfig", resourceConfig)
+                                               break
+                                       default:
+                                               logger.debug("Invalid modify Action")
+                                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction)
+                               }
+                       }
+                       List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+                       String sliceProfileId = execution.getVariable("sliceProfileId")
+                       if (isBlank(sliceProfileId) || (snssaiList.empty)) {
+                               msg = "Mandatory fields are empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfileId", sliceProfileId)
+                               execution.setVariable("snssaiList", snssaiList)
+                               execution.setVariable("snssai", snssaiList.get(0))
+                       }
+                       
+               } catch(BpmnError e) {
+                       throw e
+               } catch(Exception ex) {
+                       msg = "Exception in DoModifyAccessNssi.preProcessRequest " + ex.getMessage()
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug(Prefix + "preProcessRequest Exit")
+       }
+       
+       def createSdnrRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSdnrRequest method start")
+               String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
+               String modifyAction = execution.getVariable("modifyAction")
+               String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl)
+               execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
+               execution.setVariable("createNSSI_timeout", "PT10M")
+               execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
+               execution.setVariable("createNSSI_messageType", "AsyncSdnrResponse");
+       }
+       
+       def processSdnrResponse = { DelegateExecution execution ->
+               logger.debug(Prefix+"processSdnrResponse method start")
+               String SDNRResponse = execution.getVariable("SDNR_asyncCallbackResponse")
+               String status = jsonUtil.getJsonValue(SDNRResponse, "status")
+               if(status.equalsIgnoreCase("success")) {
+                       String nfIds = jsonUtil.getJsonValue(SDNRResponse, "nfIds")
+                       execution.setVariable("ranNfIdsJson", nfIds)
+               }else {
+                       String reason = jsonUtil.getJsonValue(SDNRResponse, "reason")
+                       logger.error("received failed status from SDNR "+ reason)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from SDNR "+ reason)
+               }
+               logger.debug("response from SDNR "+SDNRResponse)
+       }
+       
+       private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) {
+               
+               String requestId = execution.getVariable("msoRequestId")
+               Date date = new Date().getTime()
+               Timestamp time = new Timestamp(date)
+               String sliceProfileString
+               JsonObject response = new JsonObject()
+               JsonObject body = new JsonObject()
+               JsonObject input = new JsonObject()
+               JsonObject commonHeader = new JsonObject()
+               JsonObject payload = new JsonObject()
+               JsonObject payloadInput = new JsonObject()
+               if(action.equals("allocate")) {
+                       Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+                       sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
+                       sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+                       sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
+                       sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
+                       sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                       action = "modify-"+action
+                       payloadInput.add("additionalproperties", new JsonObject())
+               }else if(action.equals("deallocate")) {
+                       action = "modify-"+action
+                       Map<String,Object> sliceProfile = new HashMap<>()
+                       sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
+                       sliceProfile.put("sNSSAI", execution.getVariable("snssai"))
+                       sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                       payloadInput.add("additionalproperties", new JsonObject())
+               }else if(action.equals("reconfigure")) {
+                       Map<String,Object> sliceProfile = new HashMap<>()
+                       sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
+                       sliceProfile.put("sNSSAI", execution.getVariable("snssai"))
+                       sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                       JsonObject resourceconfig = new JsonObject()
+                       resourceconfig.addProperty("resourceConfig", execution.getVariable("resourceConfig"))
+                       payloadInput.add("additionalproperties", resourceconfig)
+               }
+               commonHeader.addProperty("TimeStamp", time.toString())
+               commonHeader.addProperty("APIver", "1.0")
+               commonHeader.addProperty("RequestID", requestId)
+               commonHeader.addProperty("SubRequestID", "1")
+               commonHeader.add("RequestTrack", new JsonObject())
+               commonHeader.add("Flags", new JsonObject())
+               payloadInput.addProperty("sliceProfile", sliceProfileString)
+               payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID"))
+               payloadInput.addProperty("callbackURL", callbackUrl)
+               payload.add("input", payloadInput)
+               input.add("CommonHeader", commonHeader)
+               input.addProperty("Action", action)
+               input.add("Payload", payload)
+               body.add("input", input)
+               response.add("body", body)
+               response.addProperty("version", "1.0")
+               response.addProperty("rpc-name", rpcName)
+               response.addProperty("correlation-id", requestId+"-1")
+               response.addProperty("type", "request")
+               return response.toString()
+       }
+       
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
new file mode 100644 (file)
index 0000000..0b7a5ff
--- /dev/null
@@ -0,0 +1,401 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNMOD_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    private static final Logger logger = LoggerFactory.getLogger(DoModifyTnNssi.class)
+
+
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+        execution.setVariable("prefix", Prefix)
+        String msg = ""
+
+        try {
+            execution.setVariable("startTime", System.currentTimeMillis())
+            msg = tnNssmfUtils.getExecutionInputParams(execution)
+            logger.debug("Modify TN NSSI input parameters: " + msg)
+
+            execution.setVariable("prefix", Prefix)
+
+            tnNssmfUtils.setSdncCallbackUrl(execution, true)
+            logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+            String additionalPropJsonStr = execution.getVariable("sliceParams")
+
+            String sliceServiceInstanceId = execution.getVariable("serviceInstanceID")
+            execution.setVariable("sliceServiceInstanceId", sliceServiceInstanceId)
+
+            String sliceServiceInstanceName = execution.getVariable("servicename")
+            execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+            String operationId = UUID.randomUUID().toString()
+            execution.setVariable("operationId", operationId)
+
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            String modelUuid = execution.getVariable("modelUuid")
+            //here modelVersion is not set, we use modelUuid to decompose the service.
+            def isDebugLogEnabled = true
+            execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+            String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+            execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+            //additional properties
+            String sliceProfile = jsonUtil.getJsonValue(additionalPropJsonStr, "sliceProfile")
+            if (isBlank(sliceProfile)) {
+                msg = "Input sliceProfile is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("sliceProfile", sliceProfile)
+            }
+
+            String transportSliceNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportSliceNetworks")
+            if (isBlank(transportSliceNetworks)) {
+                msg = "Input transportSliceNetworks is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("transportSliceNetworks", transportSliceNetworks)
+            }
+            logger.debug("transportSliceNetworks: " + transportSliceNetworks)
+
+            String nsiInfo = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiInfo")
+            if (isBlank(nsiInfo)) {
+                msg = "Input nsiInfo is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("nsiInfo", nsiInfo)
+            }
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Finish preProcessRequest")
+    }
+
+
+    void deleteServiceInstance(DelegateExecution execution) {
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+                    execution.getVariable("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"),
+                    execution.getVariable("serviceInstanceID"))
+            client.delete(uri)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoDeallocateTnNssi.deleteServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+
+    void getExistingServiceInstance(DelegateExecution execution) {
+        String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+        AAIResourcesClient resourceClient = getAAIClient()
+        AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+
+        try {
+            if (resourceClient.exists(ssServiceuri)) {
+                execution.setVariable("ssi_resourceLink", ssServiceuri.build().toString())
+                org.onap.aai.domain.yang.ServiceInstance ss =
+                        resourceClient.get(org.onap.aai.domain.yang.ServiceInstance.class, ssServiceuri)
+                org.onap.aai.domain.yang.SliceProfile sliceProfile = ss.getSliceProfiles().getSliceProfile().get(0)
+                execution.setVariable("sliceProfileId", sliceProfile.getProfileId())
+
+                org.onap.aai.domain.yang.AllottedResources ars = ss.getAllottedResources()
+                List<org.onap.aai.domain.yang.AllottedResource> arList = ars.getAllottedResource()
+                List<String> arIdList = new ArrayList<>()
+                for (org.onap.aai.domain.yang.AllottedResource ar : arList) {
+                    String arId = ar.getId()
+                    arIdList.add(arId)
+                }
+                execution.setVariable("arIdList", arIdList)
+            } else {
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
+                        "associate allotted resource for service :" + serviceInstanceId)
+            }
+        } catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            String msg = "Exception in getServiceInstance. " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+    }
+
+    public void updateTnNssiInAAI(DelegateExecution execution) {
+        getExistingServiceInstance(execution)
+
+        updateServiceInstance(execution)
+        updateSliceProfile(execution)
+        updateAllottedResource(execution)
+    }
+
+    void updateServiceInstance(DelegateExecution execution) {
+        String serviceRole = "TN"
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+        try {
+            org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+            ss.setServiceInstanceId(ssInstanceId)
+            String sliceInstanceName = execution.getVariable("sliceServiceInstanceName")
+            ss.setServiceInstanceName(sliceInstanceName)
+            ss.setServiceType(serviceType)
+            String serviceStatus = "modified"
+            ss.setOrchestrationStatus(serviceStatus)
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            String modelUuid = execution.getVariable("modelUuid")
+            ss.setModelInvariantId(modelInvariantUuid)
+            ss.setModelVersionId(modelUuid)
+            String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
+            ss.setServiceInstanceLocationId(serviceInstanceLocationid)
+            String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
+            ss.setEnvironmentContext(snssai)
+            ss.setServiceRole(serviceRole)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId)
+            client.update(uri, ss)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    void updateSliceProfile(DelegateExecution execution) {
+
+        String sliceserviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        String sliceProfileId = execution.getVariable("sliceProfileId")
+        SliceProfile sliceProfile = new SliceProfile();
+        sliceProfile.setProfileId(sliceProfileId)
+        sliceProfile.setLatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
+        sliceProfile.setResourceSharingLevel(jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel"))
+        sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr))    //TODO: should be list
+
+        sliceProfile.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
+        sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
+
+        //TODO: new API
+        sliceProfile.setReliability(new Object())
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, execution.getVariable
+                    ("globalSubscriberId"),
+                    execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, sliceProfileId)
+            client.update(uri, sliceProfile)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in updateSliceProfile. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    void updateAllottedResource(DelegateExecution execution) {
+        String serviceInstanceId = execution.getVariable('serviceInstanceID')
+
+        List<String> arIdList = execution.getVariable("arIdList")
+        try {
+            for (String arId : arIdList) {
+                AAIResourceUri arUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
+                        execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"),
+                        serviceInstanceId, arId)
+
+                getAAIClient().delete(arUri)
+            }
+
+            List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportSliceNetworks"))
+
+            for (String networkStr : networkStrList) {
+                String allottedResourceId = UUID.randomUUID().toString()
+                AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
+                        execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"),
+                        execution.getVariable("sliceserviceInstanceId"), allottedResourceId)
+                execution.setVariable("allottedResourceUri", allottedResourceUri)
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+                resource.setId(allottedResourceId)
+                resource.setType("TsciNetwork")
+                resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName"))
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+                getAAIClient().create(allottedResourceUri, resource)
+
+                String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
+                createLogicalLinksForAllocatedResource(execution, linkArrayStr, serviceInstanceId, allottedResourceId)
+            }
+
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+        }
+    }
+
+    void createLogicalLinksForAllocatedResource(DelegateExecution execution,
+                                                String linkArrayStr, String serviceInstanceId,
+                                                String allottedResourceId) {
+
+        try {
+            List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
+
+            for (String linkStr : linkStrList) {
+                String logicalLinkId = UUID.randomUUID().toString()
+                String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
+                String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+                resource.setLinkId(logicalLinkId)
+                resource.setLinkName(epA)
+                resource.setLinkName2(epB)
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+
+                AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIObjectType.LOGICAL_LINK, logicalLinkId)
+                getAAIClient().create(logicalLinkUri, resource)
+            }
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+                    "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+        }
+    }
+
+
+    void preprocessSdncModifyTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preprocessSdncModifyTnNssiRequest(' +
+                'execution=' + execution.getId() + ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        try {
+            String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "modify")
+
+            execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preprocessSdncModifyTnNssiRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED preprocessSdncModifyTnNssiRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+
+
+    void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String sliceServiceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceServiceInstanceId)
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("serviceInstanceID")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType("Modify")
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
new file mode 100644 (file)
index 0000000..3367920
--- /dev/null
@@ -0,0 +1,339 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonArray
+import com.google.gson.JsonObject
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class TnAllocateNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNALLOC_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    private static final Logger logger = LoggerFactory.getLogger(TnAllocateNssi.class)
+
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+        execution.setVariable("prefix", Prefix)
+        String msg = ""
+
+        try {
+            execution.setVariable("startTime", System.currentTimeMillis())
+
+            msg = tnNssmfUtils.getExecutionInputParams(execution)
+            logger.debug("Allocate TN NSSI input parameters: " + msg)
+
+            tnNssmfUtils.setSdncCallbackUrl(execution, true)
+            logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+            String additionalPropJsonStr = execution.getVariable("sliceParams")
+
+            String tnNssiId = execution.getVariable("serviceInstanceID")
+            if (isBlank(tnNssiId)) {
+                tnNssiId = UUID.randomUUID().toString()
+            }
+
+            String operationId = UUID.randomUUID().toString()
+            execution.setVariable("operationId", operationId)
+
+            logger.debug("Generate new TN NSSI ID:" + tnNssiId)
+            tnNssiId = UriUtils.encode(tnNssiId, "UTF-8")
+            execution.setVariable("sliceServiceInstanceId", tnNssiId)
+
+            String sliceServiceInstanceName = execution.getVariable("servicename")
+            execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+            //additional properties
+            String sliceProfile = jsonUtil.getJsonValue(additionalPropJsonStr, "sliceProfile")
+            if (isBlank(sliceProfile)) {
+                msg = "Input sliceProfile is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("sliceProfile", sliceProfile)
+            }
+
+            String transportSliceNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportSliceNetworks")
+            if (isBlank(transportSliceNetworks)) {
+                msg = "Input transportSliceNetworks is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("transportSliceNetworks", transportSliceNetworks)
+            }
+            logger.debug("transportSliceNetworks: " + transportSliceNetworks)
+
+            String nsiInfoStr = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiInfo")
+            if (isBlank(nsiInfoStr)) {
+                msg = "Input nsiInfo is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("nsiInfo", nsiInfoStr)
+            }
+
+            //nsiId is passed in from caller bpmn
+            //String nsiIdStr = jsonUtil.getJsonValue(nsiInfo, "nsiId")
+            //execution.setVariable("nsiId", nsiIdStr)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Finish preProcessRequest")
+    }
+
+
+    void prepareDecomposeService(DelegateExecution execution) {
+        logger.debug("Start prepareDecomposeService")
+        String msg = ""
+        String modelUuid = execution.getVariable("modelUuid")
+        if (isBlank(modelUuid)) {
+            msg = "Input modelUuid is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        if (isBlank(modelInvariantUuid)) {
+            msg = "Input modelInvariantUuid is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("ssServiceModelInfo", serviceModelInfo)
+
+        logger.debug("Finish prepareDecomposeService")
+    }
+
+    void processDecomposition(DelegateExecution execution) {
+        logger.debug("Start processDecomposition")
+
+        ServiceDecomposition tnNsstServiceDecomposition = execution.getVariable("tnNsstServiceDecomposition")
+        logger.debug("tnNsstServiceDecomposition : " + tnNsstServiceDecomposition.toString())
+        //TN NSST decomposition
+        String tnModelVersion = tnNsstServiceDecomposition.getModelInfo().getModelVersion()
+        String tnModelName = tnNsstServiceDecomposition.getModelInfo().getModelName()
+        List<ServiceProxy> serviceProxyList = tnNsstServiceDecomposition.getServiceProxy()
+        List<String> nsstInfoList = new ArrayList<>()
+        for (ServiceProxy serviceProxy : serviceProxyList) {
+            String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid()
+            String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid()
+            String name = serviceProxy.getModelInfo().getModelName()
+            String nsstServiceModelInfo = """{
+            "UUID":"${nsstModelUuid}",
+            "invariantUUID":"${nsstModelInvariantUuid}",
+            "name":"${name}"
+             }"""
+            nsstInfoList.add(nsstServiceModelInfo)
+        }
+        int currentIndex = 0
+        int maxIndex = nsstInfoList.size()
+        if (maxIndex < 1) {
+            String msg = "Exception in TN NSST processDecomposition. There is no NSST associated with TN NSST "
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        execution.setVariable("tnNsstInfoList", nsstInfoList)
+        execution.setVariable("tnModelVersion", tnModelVersion)
+        execution.setVariable("tnModelName", tnModelName)
+        execution.setVariable("currentIndex", currentIndex)
+        execution.setVariable("maxIndex", maxIndex)
+
+        logger.debug("End processDecomposition")
+    }
+
+    void prepareOofSelection(DelegateExecution execution) {
+        logger.debug("Start prepareOofSelection")
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        logger.debug("get NSSI option OOF Url: " + urlString)
+        //build oof request body
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSISelectionResponse"
+        Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+        String modelUuid = execution.getVariable("modelUuid")
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelName = execution.getVariable("tnModelName")
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+        List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class)
+        JsonArray capabilitiesList = new JsonArray()
+
+        execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nssiSelection_messageType", messageType)
+        execution.setVariable("nssiSelection_correlator", requestId)
+        execution.setVariable("nssiSelection_timeout", timeout)
+        String oofRequest = buildSelectTnNssiRequest(requestId, messageType, modelUuid, modelInvariantUuid,
+                modelName, profileInfo, nsstInfoList, capabilitiesList, false)
+        execution.setVariable("nssiSelection_oofRequest", oofRequest)
+
+        logger.debug("Finish prepareOofSelection")
+    }
+
+    String buildSelectTnNssiRequest(String requestId, String messageType, String UUID, String invariantUUID,
+                                    String name, Map<String, Object> profileInfo,
+                                    List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse) {
+
+        def transactionId = requestId
+        logger.debug("transactionId is: " + transactionId)
+        String correlator = requestId
+        String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+        ObjectMapper objectMapper = new ObjectMapper()
+        String profileJson = objectMapper.writeValueAsString(profileInfo)
+        String nsstInfoListString = objectMapper.writeValueAsString(nsstInfoList)
+        //Prepare requestInfo object
+        JsonObject requestInfo = new JsonObject()
+        requestInfo.addProperty("transactionId", transactionId)
+        requestInfo.addProperty("requestId", requestId)
+        requestInfo.addProperty("callbackUrl", callbackUrl)
+        requestInfo.addProperty("sourceId", "SO")
+        requestInfo.addProperty("timeout", 600)
+        requestInfo.addProperty("numSolutions", 1)
+
+        //Prepare serviceInfo object
+        JsonObject ranNsstInfo = new JsonObject()
+        ranNsstInfo.addProperty("UUID", UUID)
+        ranNsstInfo.addProperty("invariantUUID", invariantUUID)
+        ranNsstInfo.addProperty("name", name)
+
+        JsonObject json = new JsonObject()
+        json.add("requestInfo", requestInfo)
+        json.add("NSTInfo", ranNsstInfo)
+        json.addProperty("serviceProfile", profileJson)
+        json.addProperty("NSSTInfo", nsstInfoListString)
+        json.add("subnetCapabilities", capabilitiesList)
+        json.addProperty("preferReuse", preferReuse)
+
+        return json.toString()
+    }
+
+    void processOofSelection(DelegateExecution execution) {
+        logger.debug(Prefix + "processOofSelection method start")
+        String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
+        String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+        if (requestStatus.equals("completed")) {
+            List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
+            boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+            if (existingNSI) {
+                def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution")
+                execution.setVariable("sharedTnNssiSolution", sharedNSISolution)
+                logger.debug("sharedTnNssiSolution from OOF " + sharedNSISolution)
+                String tnServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId")
+                execution.setVariable("tnServiceInstanceId", tnServiceInstanceId)
+                org.onap.so.bpmn.core.domain.ServiceInstance serviceInstance = new org.onap.so.bpmn.core.domain.ServiceInstance();
+                serviceInstance.setInstanceId(tnServiceInstanceId);
+                ServiceDecomposition serviceDecomposition = execution.getVariable("tnNsstServiceDecomposition")
+                serviceDecomposition.setServiceInstance(serviceInstance);
+                execution.setVariable("tnNsstServiceDecomposition", serviceDecomposition)
+                execution.setVariable("isOofTnNssiSelected", true)
+            } else {
+                def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
+                execution.setVariable("tnConstituentSliceProfiles", sliceProfiles)
+                execution.setVariable("isOofTnNssiSelected", false)
+                logger.debug("tnConstituentSliceProfiles list from OOF " + sliceProfiles)
+            }
+        } else {
+            String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+            logger.error("received failed status from oof " + statusMessage)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a failed Async Response from OOF : " + statusMessage)
+        }
+
+        logger.debug(Prefix + "processOofSelection method finished")
+    }
+
+    void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String sliceServiceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = new AAIResourcesClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceServiceInstanceId)
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("sliceServiceInstanceId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType("Allocate")
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
new file mode 100644 (file)
index 0000000..a1b883c
--- /dev/null
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class TnNssmfUtils {
+    private static final Logger logger = LoggerFactory.getLogger(TnNssmfUtils.class);
+
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    MsoUtils msoUtils = new MsoUtils()
+    SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+
+    TnNssmfUtils() {
+    }
+
+
+    void setSdncCallbackUrl(DelegateExecution execution, boolean exceptionOnErr) {
+        setSdncCallbackUrl(execution, "sdncCallbackUrl", exceptionOnErr)
+    }
+
+    void setSdncCallbackUrl(DelegateExecution execution, String variableName, boolean exceptionOnErr) {
+        String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution)
+
+        if (isBlank(sdncCallbackUrl) && exceptionOnErr) {
+            String msg = "mso.workflow.sdncadapter.callback is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        } else {
+            execution.setVariable(variableName, sdncCallbackUrl)
+        }
+    }
+
+    String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action) {
+
+        String uuid = execution.getVariable('testReqId') // for junits
+        if (uuid == null) {
+            uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
+        }
+
+        def callbackURL = execution.getVariable("sdncCallbackUrl")
+        def requestId = execution.getVariable("msoRequestId")
+        def serviceId = execution.getVariable("sliceServiceInstanceId")
+        def vnfType = execution.getVariable("serviceType")
+        def vnfName = execution.getVariable("sliceServiceInstanceName")
+        def tenantId = execution.getVariable("sliceServiceInstanceId")
+        def source = execution.getVariable("sliceServiceInstanceId")
+        def vnfId = execution.getVariable("sliceServiceInstanceId")
+        def cloudSiteId = execution.getVariable("sliceServiceInstanceId")
+        def serviceModelInfo = execution.getVariable("serviceModelInfo")
+        def vnfModelInfo = execution.getVariable("serviceModelInfo")
+        def globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+        String vnfNameString = """<vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>"""
+        String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo)
+        String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo)
+
+        String sdncVNFParamsXml = ""
+
+        if (execution.getVariable("vnfParamsExistFlag") == true) {
+            sdncVNFParamsXml = buildSDNCParamsXml(execution)
+        } else {
+            sdncVNFParamsXml = ""
+        }
+
+        String sdncRequest =
+                """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+                                                                                                       xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
+                                                                                                       xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
+          <sdncadapter:RequestHeader>
+                               <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId>
+                               <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
+                               <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
+                               <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
+                               <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
+                               <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+               </sdncadapter:RequestHeader>
+       <sdncadapterworkflow:SDNCRequestData>
+               <request-information>
+                       <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+                       <request-action>AllocateTnNssi</request-action>
+                       <source>${MsoUtils.xmlEscape(source)}</source>
+                       <notification-url/>
+                       <order-number/>
+                       <order-version/>
+               </request-information>
+               <service-information>
+                       <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+                       <subscription-service-type>${MsoUtils.xmlEscape(serviceId)}</subscription-service-type>
+                       ${serviceEcompModelInformation}
+                       <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
+                       <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
+               </service-information>
+               <vnf-information>
+                       <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
+                       <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
+                       ${vnfEcompModelInformation}
+               </vnf-information>
+               <vnf-request-input>
+                       ${vnfNameString}
+                       <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
+                       <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
+                       ${sdncVNFParamsXml}
+               </vnf-request-input>
+       </sdncadapterworkflow:SDNCRequestData>
+       </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
+
+        logger.debug("sdncRequest:  " + sdncRequest)
+        return sdncRequest
+    }
+
+    String buildSDNCParamsXml(DelegateExecution execution) {
+        String params = ""
+        StringBuilder sb = new StringBuilder()
+        Map<String, String> paramsMap = execution.getVariable("TNNSSMF_vnfParamsMap")
+
+        for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+            String paramsXml
+            String key = entry.getKey();
+            String value = entry.getValue()
+            paramsXml = """<${key}>$value</$key>"""
+            params = sb.append(paramsXml)
+        }
+        return params
+    }
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        validateSDNCResponse(execution, response, method, true)
+    }
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method, boolean exceptionOnErr) {
+        logger.debug("STARTED ValidateSDNCResponse Process")
+
+        String msg
+
+        String prefix = execution.setVariable("prefix")
+        if (isBlank(prefix)) {
+            if (exceptionOnErr) {
+                msg = "validateSDNCResponse: prefix is null"
+                logger.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            }
+            return
+        }
+
+        WorkflowException workflowException = execution.getVariable("WorkflowException")
+        boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+        logger.debug("workflowException: " + workflowException)
+
+        sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+        String sdncResponse = response
+        if (execution.getVariable(prefix + 'sdncResponseSuccess') == true) {
+            logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call.  Response is: \n" + sdncResponse)
+            RollbackData rollbackData = execution.getVariable("rollbackData")
+
+            if (method.equals("allocate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestAllocate", "true")
+            } else if (method.equals("deallocate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeallocate", "true")
+            } else if (method.equals("activate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestActivate", "true")
+            } else if (method.equals("deactivate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeactivate", "true")
+            } else if (method.equals("modify")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestModify", "true")
+            }
+            execution.setVariable("rollbackData", rollbackData)
+        } else {
+            if (exceptionOnErr) {
+                msg = "validateSDNCResponse: bad Response from SDNC Adapter for " + method + " SDNC Call."
+                logger.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            }
+        }
+
+        logger.debug("COMPLETED ValidateSDNCResponse Process")
+    }
+
+    String getExecutionInputParams(DelegateExecution execution) {
+        String res = "msoRequestId=" + execution.getVariable("msoRequestId") +
+                ", modelInvariantUuid=" + execution.getVariable("modelInvariantUuid") +
+                ", modelUuid=" + execution.getVariable("modelUuid") +
+                ", serviceInstanceID=" + execution.getVariable("serviceInstanceID") +
+                ", operationType=" + execution.getVariable("operationType") +
+                ", globalSubscriberId=" + execution.getVariable("globalSubscriberId") +
+                ", dummyServiceId=" + execution.getVariable("dummyServiceId") +
+                ", nsiId=" + execution.getVariable("nsiId") +
+                ", networkType=" + execution.getVariable("networkType") +
+                ", subscriptionServiceType=" + execution.getVariable("subscriptionServiceType") +
+                ", jobId=" + execution.getVariable("jobId") +
+                ", sliceParams=" + execution.getVariable("sliceParams") +
+                ", servicename=" + execution.getVariable("servicename")
+
+        return res
+    }
+
+    String getFirstSnssaiFromSliceProfile(String sliceProfileStr) {
+        String snssaiListStr = jsonUtil.getJsonValue(sliceProfileStr, "snssaiList")
+        String snssai = jsonUtil.StringArrayToList(snssaiListStr).get(0)
+
+        return snssai
+    }
+
+    String getFirstPlmnIdFromSliceProfile(String sliceProfileStr) {
+        String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "plmnIdList")
+        String res = jsonUtil.StringArrayToList(plmnListStr).get(0)
+
+        return res
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..93557a4
--- /dev/null
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoActivateTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoActivateTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("operationType")).thenReturn("activateInstance")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+
+        DoActivateTnNssi obj = new DoActivateTnNssi()
+        obj.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testPreprocessSdncRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("sliceServiceInstanceName")).thenReturn("5G-service")
+        when(mockExecution.getVariable("actionType")).thenReturn("activate")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+        when(mockExecution.getVariable("serviceModelInfo")).thenReturn(mockServiceModelInfo())
+//        JsonUtils jsonUtil = new JsonUtils()
+//        String sliceProfile = jsonUtil.getJsonValue(mockSliceParams(), "sliceProfile")
+//        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+
+        DoActivateTnNssi obj = spy(DoActivateTnNssi.class)
+
+        obj.preprocessSdncActOrDeactTnNssiRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("TNNSSMF_SDNCRequest"), captor.capture())
+        String request = captor.getValue()
+        assertNotNull(request)
+    }
+
+
+    private String mockSliceParams() {
+        String expect = """{
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockSliceProfile() {
+        String expect = """{
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+     }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockServiceModelInfo() {
+        String expect = """{
+            "modelInvariantUuid":"f85cbcc0-ad74-45d7-a5a1-17c8744fdb71",
+            "modelUuid":"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6",
+            "modelVersion":""
+            }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..33110b6
--- /dev/null
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoAllocateTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoAllocateTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        //when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        //when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+
+        TnAllocateNssi obj = new TnAllocateNssi()
+        obj.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testCreateServiceInstance() {
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("sliceServiceInstanceName")).thenReturn("5G-service")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(mockSliceProfile())
+
+//        JsonUtils jsonUtil = new JsonUtils()
+//        String sliceProfile = jsonUtil.getJsonValue(mockSliceParams(), "sliceProfile")
+//        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        DoCreateTnNssiInstance obj = spy(DoCreateTnNssiInstance.class)
+        when(obj.getAAIClient()).thenReturn(client)
+
+        obj.createServiceInstance(mockExecution)
+    }
+
+
+    private String mockSliceParams() {
+        String expect = """{
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockSliceProfile() {
+        String expect = """{
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+     }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..eac79a9
--- /dev/null
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoDeallocateTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DeallocateTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("sliceParams")).thenReturn("""
+        {
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }""".replaceAll("\\\\s+", ""))
+
+        DoDeallocateTnNssi runScript = new DoDeallocateTnNssi()
+        runScript.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testDeleteServiceInstance() {
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class)
+        when(obj.getAAIClient()).thenReturn(client)
+        doNothing().when(client).delete(serviceInstanceUri)
+
+        obj.deleteServiceInstance(mockExecution)
+        Mockito.verify(client, times(1)).delete(serviceInstanceUri)
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..bbbec3b
--- /dev/null
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoModifyTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoModifyTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("operationType")).thenReturn("activateInstance")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+
+        DoModifyTnNssi obj = new DoModifyTnNssi()
+        obj.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testUpdateServiceInstance() {
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("sliceServiceInstanceName")).thenReturn("5G-service")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("sliceProfileId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2b1")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(mockSliceProfile())
+
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        DoModifyTnNssi obj = spy(DoModifyTnNssi.class)
+        when(obj.getAAIClient()).thenReturn(client)
+
+        obj.updateServiceInstance(mockExecution)
+    }
+
+
+    private String mockSliceParams() {
+        String expect = """{
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockSliceProfile() {
+        String expect = """{
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+     }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockServiceModelInfo() {
+        String expect = """{
+            "modelInvariantUuid":"f85cbcc0-ad74-45d7-a5a1-17c8744fdb71",
+            "modelUuid":"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6",
+            "modelVersion":""
+            }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..d81f546
--- /dev/null
@@ -0,0 +1,1012 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0rh5ux5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoActivateAccessNSSI" name="DoActivateAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="Event_055gbp2" name="Start">
+      <bpmn:outgoing>Flow_0rh43xe</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="Flow_0rh43xe" sourceRef="Event_055gbp2" targetRef="Activity_1fv6ljk" />
+    <bpmn:sequenceFlow id="Flow_14z4acw" sourceRef="Activity_1fv6ljk" targetRef="Activity_089t9fj" />
+    <bpmn:exclusiveGateway id="Gateway_12oq1sa" name="Should update AN NF SP status?" default="Flow_0523saw">
+      <bpmn:incoming>Flow_00yl2jk</bpmn:incoming>
+      <bpmn:outgoing>Flow_00fb28f</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0523saw</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_00yl2jk" sourceRef="Activity_1atych2" targetRef="Gateway_12oq1sa" />
+    <bpmn:sequenceFlow id="Flow_00fb28f" sourceRef="Gateway_12oq1sa" targetRef="Activity_0iluozh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeAN_NF_SPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="Event_1n5z71a" name="Goto TN NSSI Activation">
+      <bpmn:incoming>Flow_0mtkhmv</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0x6han6" name="TNNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_0kkeo9m" name="TN NSSI Activation">
+      <bpmn:outgoing>Flow_1q7frye</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0j5y3mw" name="TNNSSIActivation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="Event_09ey569" name="Goto AN NSSI Activation">
+      <bpmn:incoming>Flow_1b6vtso</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05qiudr" name="AN_NSSI_Activation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0523saw" sourceRef="Gateway_12oq1sa" targetRef="Event_0rzo7gj" />
+    <bpmn:intermediateThrowEvent id="Event_0rzo7gj" name="Check TN NSSI Activation">
+      <bpmn:incoming>Flow_0523saw</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0s7s95j" name="TNNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_1cnfilb" sourceRef="Event_1azfo77" targetRef="Activity_1j0xkqc" />
+    <bpmn:endEvent id="Event_0gx3ps0" name="End">
+      <bpmn:incoming>Flow_1876ml0</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_10f44ab" sourceRef="Activity_089t9fj" targetRef="Activity_19myg2v" />
+    <bpmn:exclusiveGateway id="Gateway_0xcg677" name="shouldChangeSPStatus?" default="Flow_0g9k299">
+      <bpmn:incoming>Flow_0uxerfg</bpmn:incoming>
+      <bpmn:outgoing>Flow_00vt4gf</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0g9k299</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0uxerfg" sourceRef="Activity_19myg2v" targetRef="Gateway_0xcg677" />
+    <bpmn:sequenceFlow id="Flow_00vt4gf" name="Yes" sourceRef="Gateway_0xcg677" targetRef="Activity_1atych2">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeSPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0g9k299" name="No" sourceRef="Gateway_0xcg677" targetRef="Event_0ocuo1o" />
+    <bpmn:exclusiveGateway id="Gateway_0nr3me0" name="Shoud updateTN FH SP status" default="Flow_10b15um">
+      <bpmn:incoming>Flow_1yd57bl</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zjaac9</bpmn:outgoing>
+      <bpmn:outgoing>Flow_10b15um</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1yd57bl" sourceRef="Activity_1fzg56b" targetRef="Gateway_0nr3me0" />
+    <bpmn:sequenceFlow id="Flow_1q7frye" sourceRef="Event_0kkeo9m" targetRef="Activity_1fzg56b" />
+    <bpmn:sequenceFlow id="Flow_0zjaac9" name="Yes" sourceRef="Gateway_0nr3me0" targetRef="Activity_0gtw2p7">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeTN_FH_SPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_10b15um" sourceRef="Gateway_0nr3me0" targetRef="Event_1nqpg0o" />
+    <bpmn:intermediateCatchEvent id="Event_0j998yp" name="TN MH NSSI Activation">
+      <bpmn:outgoing>Flow_0wvzz2r</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1jmgd64" name="TNMHNSSIActivation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="Event_1nqpg0o" name="Call TN MH NSSI Activation">
+      <bpmn:incoming>Flow_10b15um</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1fw9349" name="TNMHNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateThrowEvent id="Event_0ki3ncn" name="GotoTN MH NSSI Activation">
+      <bpmn:incoming>Flow_1qszzfv</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1hh8o8h" name="TNMHNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateThrowEvent id="Event_1djcl9x" name="Ca AN NSSI Activation">
+      <bpmn:incoming>Flow_00clpwn</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_02qbzt2" name="AN_NSSI_Activation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:exclusiveGateway id="Gateway_0cemhjv" name="Shoud updateTN MH SP status" default="Flow_00clpwn">
+      <bpmn:incoming>Flow_0q02qno</bpmn:incoming>
+      <bpmn:outgoing>Flow_00clpwn</bpmn:outgoing>
+      <bpmn:outgoing>Flow_147tw7h</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0q02qno" sourceRef="Activity_068a0cy" targetRef="Gateway_0cemhjv" />
+    <bpmn:sequenceFlow id="Flow_00clpwn" sourceRef="Gateway_0cemhjv" targetRef="Event_1djcl9x" />
+    <bpmn:sequenceFlow id="Flow_0wvzz2r" sourceRef="Event_0j998yp" targetRef="Activity_068a0cy" />
+    <bpmn:sequenceFlow id="Flow_147tw7h" sourceRef="Gateway_0cemhjv" targetRef="Activity_02vl5kt">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeTN_MH_SPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_089t9fj" name="Fetch Related NSSIs and Slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_14z4acw</bpmn:incoming>
+      <bpmn:outgoing>Flow_10f44ab</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getRelatedInstances(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1fv6ljk" name="Preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0rh43xe</bpmn:incoming>
+      <bpmn:outgoing>Flow_14z4acw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_19myg2v" name="Check AN Slice profile status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_10f44ab</bpmn:incoming>
+      <bpmn:outgoing>Flow_0uxerfg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1atych2" name="Check Orchestration status of AN NF sliceprofile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_00vt4gf</bpmn:incoming>
+      <bpmn:outgoing>Flow_00yl2jk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getAnNfSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0iluozh" name="Prepare RAN NF NSSI activation request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_00fb28f</bpmn:incoming>
+      <bpmn:outgoing>Flow_1gxv9id</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareSdnrActivationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0u2aqld" name="Call SDNR subprocess" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="sdnrRequest" target="sdnrRequest" />
+        <camunda:in source="SDNR_messageType" target="messageType" />
+        <camunda:in source="SDNR_timeout" target="timeout" />
+        <camunda:in source="msoRequestId" target="correlator" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_Response" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1gxv9id</bpmn:incoming>
+      <bpmn:outgoing>Flow_0o7xomf</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1gxv9id" sourceRef="Activity_0iluozh" targetRef="Activity_0u2aqld" />
+    <bpmn:scriptTask id="Activity_1hr68mt" name="Process sdnr response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0o7xomf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1myzbqw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1xwu5f0" name="Is Success response" default="Flow_1v4zg98">
+      <bpmn:incoming>Flow_1myzbqw</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yrel0t</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1v4zg98</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_0yfi3mj" name="ActivationWorkflowError">
+      <bpmn:incoming>Flow_1v4zg98</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1n2vwxe" errorRef="Error_1beg2za" />
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="Activity_03sbng2" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1sroz8o</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rizzsm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator..prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_08yj5gq" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0rizzsm</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mtkhmv</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1yrel0t" name="Yes" sourceRef="Gateway_1xwu5f0" targetRef="Activity_09e5oh6">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isANactivationSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1v4zg98" sourceRef="Gateway_1xwu5f0" targetRef="Event_0yfi3mj" />
+    <bpmn:sequenceFlow id="Flow_0rizzsm" sourceRef="Activity_03sbng2" targetRef="Activity_08yj5gq" />
+    <bpmn:sequenceFlow id="Flow_0o7xomf" sourceRef="Activity_0u2aqld" targetRef="Activity_1hr68mt" />
+    <bpmn:sequenceFlow id="Flow_1myzbqw" sourceRef="Activity_1hr68mt" targetRef="Gateway_1xwu5f0" />
+    <bpmn:sequenceFlow id="Flow_1sroz8o" sourceRef="Activity_09e5oh6" targetRef="Activity_03sbng2" />
+    <bpmn:subProcess id="Activity_1aesimf" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_156ogc4">
+        <bpmn:outgoing>Flow_0tw7xsp</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06h72ej" errorRef="Error_1beg2za" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1n2qjvx">
+        <bpmn:incoming>Flow_0y0r82m</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1eedm9e" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1bqk5yt</bpmn:incoming>
+        <bpmn:outgoing>Flow_0y0r82m</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1szd5yp" name="Update Resource Operation Status">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                  <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>Flow_075rb1i</bpmn:incoming>
+        <bpmn:outgoing>Flow_1bqk5yt</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:scriptTask id="Activity_0lpw3j7" name="Update Job status" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0tw7xsp</bpmn:incoming>
+        <bpmn:outgoing>Flow_075rb1i</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"failed","0","AN NSSI activation Failed")</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_0y0r82m" sourceRef="Activity_1eedm9e" targetRef="Event_1n2qjvx" />
+      <bpmn:sequenceFlow id="Flow_075rb1i" sourceRef="Activity_0lpw3j7" targetRef="Activity_1szd5yp" />
+      <bpmn:sequenceFlow id="Flow_0tw7xsp" sourceRef="Event_156ogc4" targetRef="Activity_0lpw3j7" />
+      <bpmn:sequenceFlow id="Flow_1bqk5yt" sourceRef="Activity_1szd5yp" targetRef="Activity_1eedm9e" />
+    </bpmn:subProcess>
+    <bpmn:subProcess id="Activity_0hioign" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:scriptTask id="Activity_1f3cipf" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0cvs8zk</bpmn:incoming>
+        <bpmn:outgoing>Flow_01jdnrt</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:endEvent id="Event_18qzt1n">
+        <bpmn:incoming>Flow_01jdnrt</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:startEvent id="Event_0lvvn7i">
+        <bpmn:outgoing>Flow_0cvs8zk</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0c93dlp" />
+      </bpmn:startEvent>
+      <bpmn:sequenceFlow id="Flow_01jdnrt" sourceRef="Activity_1f3cipf" targetRef="Event_18qzt1n" />
+      <bpmn:sequenceFlow id="Flow_0cvs8zk" sourceRef="Event_0lvvn7i" targetRef="Activity_1f3cipf" />
+    </bpmn:subProcess>
+    <bpmn:scriptTask id="Activity_09e5oh6" name="Update RAN NF NSSI  and SP status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1yrel0t</bpmn:incoming>
+      <bpmn:outgoing>Flow_1sroz8o</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.updateAnNfStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0mtkhmv" sourceRef="Activity_08yj5gq" targetRef="Event_1n5z71a" />
+    <bpmn:scriptTask id="Activity_1fzg56b" name="Check TN FH Slice profile status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1q7frye</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yd57bl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getTnFhSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0gtw2p7" name="Handle TN FH NSSI Activation" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0zjaac9</bpmn:incoming>
+      <bpmn:outgoing>Flow_0heuc95</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.doTnFhNssiActivation(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_07cr1m2" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0heuc95</bpmn:incoming>
+      <bpmn:outgoing>Flow_1w3h345</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_FH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnFhNssiId")
+
+def def activator = new DoActivateAccessNSSI()
+activator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_03hbxfi" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_FH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tn_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1w3h345</bpmn:incoming>
+      <bpmn:outgoing>Flow_16pqv7g</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0br2i5b" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16pqv7g</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i0s8nu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String responseDescriptor = execution.getVariable("tn_responseDescriptor")
+
+def activator = new DoActivateAccessNSSI()
+activator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1ot96tc" name="Is Job complete?" default="Flow_0ajre96">
+      <bpmn:incoming>Flow_1i0s8nu</bpmn:incoming>
+      <bpmn:outgoing>Flow_0bukcmf</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0ajre96</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1w3h345" sourceRef="Activity_07cr1m2" targetRef="Activity_03hbxfi" />
+    <bpmn:sequenceFlow id="Flow_16pqv7g" sourceRef="Activity_03hbxfi" targetRef="Activity_0br2i5b" />
+    <bpmn:sequenceFlow id="Flow_1i0s8nu" sourceRef="Activity_0br2i5b" targetRef="Gateway_1ot96tc" />
+    <bpmn:sequenceFlow id="Flow_0heuc95" sourceRef="Activity_0gtw2p7" targetRef="Activity_07cr1m2" />
+    <bpmn:sequenceFlow id="Flow_0bukcmf" name="Yes" sourceRef="Gateway_1ot96tc" targetRef="Activity_1xirwg3">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0ajre96" sourceRef="Gateway_1ot96tc" targetRef="Event_0uco28x" />
+    <bpmn:endEvent id="Event_0uco28x" name="ActivationWorkflowError">
+      <bpmn:incoming>Flow_0ajre96</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0p0lfhq" errorRef="Error_1beg2za" />
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="Activity_1t28p4r" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ldkgyg</bpmn:incoming>
+      <bpmn:outgoing>Flow_1qszzfv</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ldkgyg" sourceRef="Activity_1o0a55b" targetRef="Activity_1t28p4r" />
+    <bpmn:sequenceFlow id="Flow_1qszzfv" sourceRef="Activity_1t28p4r" targetRef="Event_0ki3ncn" />
+    <bpmn:scriptTask id="Activity_1o0a55b" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b95clk</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ldkgyg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"processing","60","TN FH NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_068a0cy" name="Check TN MH Slice profile status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0wvzz2r</bpmn:incoming>
+      <bpmn:outgoing>Flow_0q02qno</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getTnMhSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="Event_1azfo77" name="AN NSSI Activation">
+      <bpmn:outgoing>Flow_1cnfilb</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05vnzdd" name="AN_NSSI_Activation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_02vl5kt" name="Handle TN MH NSSI Activation" scriptFormat="groovy">
+      <bpmn:incoming>Flow_147tw7h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1s0xcf5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def activator = new DoActivateAccessNSSI()
+activator.doTnMhNssiActivation(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1kszh5k" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1s0xcf5</bpmn:incoming>
+      <bpmn:outgoing>Flow_0sqsq1x</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_MH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnMhNssiId")
+
+def def activator = new DoActivateAccessNSSI()
+activator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_09jt4b0" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_MH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tn_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0sqsq1x</bpmn:incoming>
+      <bpmn:outgoing>Flow_0b7aq1k</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1su25xm" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0b7aq1k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0to1idt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String responseDescriptor = execution.getVariable("tn_responseDescriptor")
+
+def activator = new DoActivateAccessNSSI()
+activator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_114io6q" name="Is Job complete?" default="Flow_0rzuxa0">
+      <bpmn:incoming>Flow_0to1idt</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i4cc7e</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0rzuxa0</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_08ecfyj" name="ActivationWorkflowError">
+      <bpmn:incoming>Flow_0rzuxa0</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0ptrcor" errorRef="Error_1beg2za" />
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="Activity_0ftm8b6" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0k5cyz7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1wx5w6i</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"processing","80","TN MH NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1xnstqr" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1wx5w6i</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b6vtso</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0sqsq1x" sourceRef="Activity_1kszh5k" targetRef="Activity_09jt4b0" />
+    <bpmn:sequenceFlow id="Flow_0b7aq1k" sourceRef="Activity_09jt4b0" targetRef="Activity_1su25xm" />
+    <bpmn:sequenceFlow id="Flow_0to1idt" sourceRef="Activity_1su25xm" targetRef="Gateway_114io6q" />
+    <bpmn:sequenceFlow id="Flow_1i4cc7e" name="Yes" sourceRef="Gateway_114io6q" targetRef="Activity_0xmezab">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0rzuxa0" sourceRef="Gateway_114io6q" targetRef="Event_08ecfyj" />
+    <bpmn:sequenceFlow id="Flow_1wx5w6i" sourceRef="Activity_0ftm8b6" targetRef="Activity_1xnstqr" />
+    <bpmn:sequenceFlow id="Flow_1s0xcf5" sourceRef="Activity_02vl5kt" targetRef="Activity_1kszh5k" />
+    <bpmn:sequenceFlow id="Flow_1b6vtso" sourceRef="Activity_1xnstqr" targetRef="Event_09ey569" />
+    <bpmn:sequenceFlow id="Flow_1b95clk" sourceRef="Activity_1xirwg3" targetRef="Activity_1o0a55b" />
+    <bpmn:scriptTask id="Activity_1xirwg3" name="Update TN FH SP and NSSI Orch Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0bukcmf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b95clk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.updateTNFHStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0xmezab" name="Update TN FH SP and NSSI Orch Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1i4cc7e</bpmn:incoming>
+      <bpmn:outgoing>Flow_0k5cyz7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def activator = new DoActivateAccessNSSI()
+activator.updateTNFHStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0k5cyz7" sourceRef="Activity_0xmezab" targetRef="Activity_0ftm8b6" />
+    <bpmn:scriptTask id="Activity_1j0xkqc" name="Check Orch status for AN NSSI activation" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1cnfilb</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cblklk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def activator = new DoActivateAccessNSSI()
+activator.updateANStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0huy5ph" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cblklk</bpmn:incoming>
+      <bpmn:outgoing>Flow_06nfip0</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"finished","100","AN NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1tbardv" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_06nfip0</bpmn:incoming>
+      <bpmn:outgoing>Flow_1876ml0</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_06nfip0" sourceRef="Activity_0huy5ph" targetRef="Activity_1tbardv" />
+    <bpmn:sequenceFlow id="Flow_0cblklk" sourceRef="Activity_1j0xkqc" targetRef="Activity_0huy5ph" />
+    <bpmn:sequenceFlow id="Flow_1876ml0" sourceRef="Activity_1tbardv" targetRef="Event_0gx3ps0" />
+    <bpmn:intermediateThrowEvent id="Event_0ocuo1o" name="Goto AN NSSI activation">
+      <bpmn:incoming>Flow_0g9k299</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1h9r8pc" name="AN_NSSI_Activation" />
+    </bpmn:intermediateThrowEvent>
+  </bpmn:process>
+  <bpmn:error id="Error_1beg2za" name="ActivationWorkflowError" errorCode="2500" />
+  <bpmn:error id="Error_0vgjqok" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_1876ml0_di" bpmnElement="Flow_1876ml0">
+        <di:waypoint x="660" y="940" />
+        <di:waypoint x="712" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cblklk_di" bpmnElement="Flow_0cblklk">
+        <di:waypoint x="350" y="940" />
+        <di:waypoint x="390" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06nfip0_di" bpmnElement="Flow_06nfip0">
+        <di:waypoint x="490" y="940" />
+        <di:waypoint x="560" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k5cyz7_di" bpmnElement="Flow_0k5cyz7">
+        <di:waypoint x="1330" y="690" />
+        <di:waypoint x="1410" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b95clk_di" bpmnElement="Flow_1b95clk">
+        <di:waypoint x="1320" y="450" />
+        <di:waypoint x="1410" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b6vtso_di" bpmnElement="Flow_1b6vtso">
+        <di:waypoint x="1680" y="690" />
+        <di:waypoint x="1742" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1s0xcf5_di" bpmnElement="Flow_1s0xcf5">
+        <di:waypoint x="580" y="690" />
+        <di:waypoint x="640" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1wx5w6i_di" bpmnElement="Flow_1wx5w6i">
+        <di:waypoint x="1510" y="690" />
+        <di:waypoint x="1580" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rzuxa0_di" bpmnElement="Flow_0rzuxa0">
+        <di:waypoint x="1140" y="715" />
+        <di:waypoint x="1140" y="762" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i4cc7e_di" bpmnElement="Flow_1i4cc7e">
+        <di:waypoint x="1165" y="690" />
+        <di:waypoint x="1230" y="690" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1168" y="672" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0to1idt_di" bpmnElement="Flow_0to1idt">
+        <di:waypoint x="1070" y="690" />
+        <di:waypoint x="1115" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0b7aq1k_di" bpmnElement="Flow_0b7aq1k">
+        <di:waypoint x="900" y="690" />
+        <di:waypoint x="970" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0sqsq1x_di" bpmnElement="Flow_0sqsq1x">
+        <di:waypoint x="740" y="690" />
+        <di:waypoint x="800" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1qszzfv_di" bpmnElement="Flow_1qszzfv">
+        <di:waypoint x="1680" y="450" />
+        <di:waypoint x="1732" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ldkgyg_di" bpmnElement="Flow_1ldkgyg">
+        <di:waypoint x="1510" y="450" />
+        <di:waypoint x="1580" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ajre96_di" bpmnElement="Flow_0ajre96">
+        <di:waypoint x="1130" y="475" />
+        <di:waypoint x="1130" y="522" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0bukcmf_di" bpmnElement="Flow_0bukcmf">
+        <di:waypoint x="1155" y="450" />
+        <di:waypoint x="1220" y="450" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1158" y="432" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0heuc95_di" bpmnElement="Flow_0heuc95">
+        <di:waypoint x="580" y="450" />
+        <di:waypoint x="630" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i0s8nu_di" bpmnElement="Flow_1i0s8nu">
+        <di:waypoint x="1060" y="450" />
+        <di:waypoint x="1105" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16pqv7g_di" bpmnElement="Flow_16pqv7g">
+        <di:waypoint x="890" y="450" />
+        <di:waypoint x="960" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1w3h345_di" bpmnElement="Flow_1w3h345">
+        <di:waypoint x="730" y="450" />
+        <di:waypoint x="790" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mtkhmv_di" bpmnElement="Flow_0mtkhmv">
+        <di:waypoint x="2110" y="230" />
+        <di:waypoint x="2152" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1sroz8o_di" bpmnElement="Flow_1sroz8o">
+        <di:waypoint x="1800" y="230" />
+        <di:waypoint x="1870" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1myzbqw_di" bpmnElement="Flow_1myzbqw">
+        <di:waypoint x="1500" y="230" />
+        <di:waypoint x="1565" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0o7xomf_di" bpmnElement="Flow_0o7xomf">
+        <di:waypoint x="1340" y="230" />
+        <di:waypoint x="1400" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rizzsm_di" bpmnElement="Flow_0rizzsm">
+        <di:waypoint x="1970" y="230" />
+        <di:waypoint x="2010" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1v4zg98_di" bpmnElement="Flow_1v4zg98">
+        <di:waypoint x="1590" y="255" />
+        <di:waypoint x="1590" y="302" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yrel0t_di" bpmnElement="Flow_1yrel0t">
+        <di:waypoint x="1615" y="230" />
+        <di:waypoint x="1700" y="230" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1649" y="212" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1gxv9id_di" bpmnElement="Flow_1gxv9id">
+        <di:waypoint x="1180" y="230" />
+        <di:waypoint x="1240" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_147tw7h_di" bpmnElement="Flow_147tw7h">
+        <di:waypoint x="435" y="690" />
+        <di:waypoint x="480" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0wvzz2r_di" bpmnElement="Flow_0wvzz2r">
+        <di:waypoint x="198" y="690" />
+        <di:waypoint x="240" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00clpwn_di" bpmnElement="Flow_00clpwn">
+        <di:waypoint x="410" y="715" />
+        <di:waypoint x="410" y="800" />
+        <di:waypoint x="482" y="800" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0q02qno_di" bpmnElement="Flow_0q02qno">
+        <di:waypoint x="340" y="690" />
+        <di:waypoint x="385" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10b15um_di" bpmnElement="Flow_10b15um">
+        <di:waypoint x="410" y="475" />
+        <di:waypoint x="410" y="560" />
+        <di:waypoint x="482" y="560" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zjaac9_di" bpmnElement="Flow_0zjaac9">
+        <di:waypoint x="435" y="450" />
+        <di:waypoint x="480" y="450" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="449" y="432" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1q7frye_di" bpmnElement="Flow_1q7frye">
+        <di:waypoint x="198" y="450" />
+        <di:waypoint x="240" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yd57bl_di" bpmnElement="Flow_1yd57bl">
+        <di:waypoint x="340" y="450" />
+        <di:waypoint x="385" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0g9k299_di" bpmnElement="Flow_0g9k299">
+        <di:waypoint x="690" y="205" />
+        <di:waypoint x="690" y="100" />
+        <di:waypoint x="752" y="100" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="698" y="150" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00vt4gf_di" bpmnElement="Flow_00vt4gf">
+        <di:waypoint x="715" y="230" />
+        <di:waypoint x="800" y="230" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="749" y="212" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0uxerfg_di" bpmnElement="Flow_0uxerfg">
+        <di:waypoint x="620" y="230" />
+        <di:waypoint x="665" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10f44ab_di" bpmnElement="Flow_10f44ab">
+        <di:waypoint x="480" y="230" />
+        <di:waypoint x="520" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1cnfilb_di" bpmnElement="Flow_1cnfilb">
+        <di:waypoint x="198" y="940" />
+        <di:waypoint x="250" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0523saw_di" bpmnElement="Flow_0523saw">
+        <di:waypoint x="990" y="205" />
+        <di:waypoint x="990" y="130" />
+        <di:waypoint x="1062" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00fb28f_di" bpmnElement="Flow_00fb28f">
+        <di:waypoint x="1015" y="230" />
+        <di:waypoint x="1080" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00yl2jk_di" bpmnElement="Flow_00yl2jk">
+        <di:waypoint x="900" y="230" />
+        <di:waypoint x="965" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14z4acw_di" bpmnElement="Flow_14z4acw">
+        <di:waypoint x="340" y="230" />
+        <di:waypoint x="380" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rh43xe_di" bpmnElement="Flow_0rh43xe">
+        <di:waypoint x="198" y="230" />
+        <di:waypoint x="240" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_055gbp2_di" bpmnElement="Event_055gbp2">
+        <dc:Bounds x="162" y="212" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="168" y="255" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_12oq1sa_di" bpmnElement="Gateway_12oq1sa" isMarkerVisible="true">
+        <dc:Bounds x="965" y="205" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="945" y="265" width="90" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1v7p5kl_di" bpmnElement="Event_1n5z71a">
+        <dc:Bounds x="2152" y="212" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2137" y="255" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_01vyapf_di" bpmnElement="Event_0kkeo9m">
+        <dc:Bounds x="162" y="432" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="157" y="475" width="48" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1u3s42m_di" bpmnElement="Event_09ey569">
+        <dc:Bounds x="1742" y="672" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1728" y="715" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_01fudey_di" bpmnElement="Event_0rzo7gj">
+        <dc:Bounds x="1062" y="112" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1042" y="155" width="78" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0gx3ps0_di" bpmnElement="Event_0gx3ps0">
+        <dc:Bounds x="712" y="922" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="720" y="965" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0xcg677_di" bpmnElement="Gateway_0xcg677" isMarkerVisible="true">
+        <dc:Bounds x="665" y="205" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="647" y="262" width="86" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0nr3me0_di" bpmnElement="Gateway_0nr3me0" isMarkerVisible="true">
+        <dc:Bounds x="385" y="425" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="370" y="395" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0j998yp_di" bpmnElement="Event_0j998yp">
+        <dc:Bounds x="162" y="672" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="150" y="715" width="64" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_05lm9ln_di" bpmnElement="Event_1nqpg0o">
+        <dc:Bounds x="482" y="542" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="457" y="585" width="86" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0wv22e3_di" bpmnElement="Event_0ki3ncn">
+        <dc:Bounds x="1732" y="432" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1706" y="475" width="88" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1djcl9x_di" bpmnElement="Event_1djcl9x">
+        <dc:Bounds x="482" y="782" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="469" y="825" width="62" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0cemhjv_di" bpmnElement="Gateway_0cemhjv" isMarkerVisible="true">
+        <dc:Bounds x="385" y="665" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="368" y="635" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_00e6sqq_di" bpmnElement="Activity_089t9fj">
+        <dc:Bounds x="380" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_147vycg_di" bpmnElement="Activity_1fv6ljk">
+        <dc:Bounds x="240" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1465ih9_di" bpmnElement="Activity_19myg2v">
+        <dc:Bounds x="520" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16l1ykw_di" bpmnElement="Activity_1atych2">
+        <dc:Bounds x="800" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10uophi_di" bpmnElement="Activity_0iluozh">
+        <dc:Bounds x="1080" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0u2aqld_di" bpmnElement="Activity_0u2aqld">
+        <dc:Bounds x="1240" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hr68mt_di" bpmnElement="Activity_1hr68mt">
+        <dc:Bounds x="1400" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1xwu5f0_di" bpmnElement="Gateway_1xwu5f0" isMarkerVisible="true">
+        <dc:Bounds x="1565" y="205" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1564" y="175" width="54" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0yfi3mj_di" bpmnElement="Event_0yfi3mj">
+        <dc:Bounds x="1572" y="302" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1607" y="286" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03sbng2_di" bpmnElement="Activity_03sbng2">
+        <dc:Bounds x="1870" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08yj5gq_di" bpmnElement="Activity_08yj5gq">
+        <dc:Bounds x="2010" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1aesimf_di" bpmnElement="Activity_1aesimf" isExpanded="true">
+        <dc:Bounds x="210" y="1130" width="770" height="170" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1bqk5yt_di" bpmnElement="Flow_1bqk5yt">
+        <di:waypoint x="630" y="1234" />
+        <di:waypoint x="710" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tw7xsp_di" bpmnElement="Flow_0tw7xsp">
+        <di:waypoint x="278" y="1234" />
+        <di:waypoint x="380" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_075rb1i_di" bpmnElement="Flow_075rb1i">
+        <di:waypoint x="480" y="1234" />
+        <di:waypoint x="530" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0y0r82m_di" bpmnElement="Flow_0y0r82m">
+        <di:waypoint x="810" y="1234" />
+        <di:waypoint x="892" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_156ogc4_di" bpmnElement="Event_156ogc4">
+        <dc:Bounds x="242" y="1216" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1n2qjvx_di" bpmnElement="Event_1n2qjvx">
+        <dc:Bounds x="892" y="1216" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1eedm9e_di" bpmnElement="Activity_1eedm9e">
+        <dc:Bounds x="710" y="1194" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1szd5yp_di" bpmnElement="Activity_1szd5yp">
+        <dc:Bounds x="530" y="1194" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0lpw3j7_di" bpmnElement="Activity_0lpw3j7">
+        <dc:Bounds x="380" y="1194" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0hioign_di" bpmnElement="Activity_0hioign" isExpanded="true">
+        <dc:Bounds x="320" y="1420" width="440" height="140" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0cvs8zk_di" bpmnElement="Flow_0cvs8zk">
+        <di:waypoint x="408" y="1481" />
+        <di:waypoint x="473" y="1481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01jdnrt_di" bpmnElement="Flow_01jdnrt">
+        <di:waypoint x="573" y="1481" />
+        <di:waypoint x="672" y="1481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Activity_1f3cipf_di" bpmnElement="Activity_1f3cipf">
+        <dc:Bounds x="473" y="1441" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18qzt1n_di" bpmnElement="Event_18qzt1n">
+        <dc:Bounds x="672" y="1463" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0lvvn7i_di" bpmnElement="Event_0lvvn7i">
+        <dc:Bounds x="372" y="1463" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1u5yry2_di" bpmnElement="Activity_09e5oh6">
+        <dc:Bounds x="1700" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ng1vyl_di" bpmnElement="Activity_1fzg56b">
+        <dc:Bounds x="240" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vabe3f_di" bpmnElement="Activity_0gtw2p7">
+        <dc:Bounds x="480" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07cr1m2_di" bpmnElement="Activity_07cr1m2">
+        <dc:Bounds x="630" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03hbxfi_di" bpmnElement="Activity_03hbxfi">
+        <dc:Bounds x="790" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0br2i5b_di" bpmnElement="Activity_0br2i5b">
+        <dc:Bounds x="960" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1ot96tc_di" bpmnElement="Gateway_1ot96tc" isMarkerVisible="true">
+        <dc:Bounds x="1105" y="425" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="395" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0h9nwqd_di" bpmnElement="Event_0uco28x">
+        <dc:Bounds x="1112" y="522" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="565" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1t28p4r_di" bpmnElement="Activity_1t28p4r">
+        <dc:Bounds x="1580" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03o12kw_di" bpmnElement="Activity_1o0a55b">
+        <dc:Bounds x="1410" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hkx6j5_di" bpmnElement="Activity_068a0cy">
+        <dc:Bounds x="240" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18xtkyi_di" bpmnElement="Event_1azfo77">
+        <dc:Bounds x="162" y="922" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="156" y="965" width="48" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wvru6z_di" bpmnElement="Activity_02vl5kt">
+        <dc:Bounds x="480" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1kszh5k_di" bpmnElement="Activity_1kszh5k">
+        <dc:Bounds x="640" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_09jt4b0_di" bpmnElement="Activity_09jt4b0">
+        <dc:Bounds x="800" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1su25xm_di" bpmnElement="Activity_1su25xm">
+        <dc:Bounds x="970" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_114io6q_di" bpmnElement="Gateway_114io6q" isMarkerVisible="true">
+        <dc:Bounds x="1115" y="665" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1098" y="641" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_08ecfyj_di" bpmnElement="Event_08ecfyj">
+        <dc:Bounds x="1122" y="762" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1098" y="805" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ftm8b6_di" bpmnElement="Activity_0ftm8b6">
+        <dc:Bounds x="1410" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xnstqr_di" bpmnElement="Activity_1xnstqr">
+        <dc:Bounds x="1580" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_15f8u0i_di" bpmnElement="Activity_1xirwg3">
+        <dc:Bounds x="1220" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0xmezab_di" bpmnElement="Activity_0xmezab">
+        <dc:Bounds x="1230" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_17abdcy_di" bpmnElement="Activity_1j0xkqc">
+        <dc:Bounds x="250" y="900" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0huy5ph_di" bpmnElement="Activity_0huy5ph">
+        <dc:Bounds x="390" y="900" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tbardv_di" bpmnElement="Activity_1tbardv">
+        <dc:Bounds x="560" y="900" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0kp0sqc_di" bpmnElement="Event_0ocuo1o">
+        <dc:Bounds x="752" y="82" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="735" y="125" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..8ecce46
--- /dev/null
@@ -0,0 +1,207 @@
+<?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoActivateTransportNSSI" name="DoActivateTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Activate/Deactivate TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_1032bi1</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Activate or Deactivate successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0nhxd67" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def actionType = execution.getVariable("actionType")
+execution.setVariable("orchestrationStatus", actionType)
+def runScript = new DoActivateTnNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Activate or Deactivate TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.preprocessSdncActOrDeactTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0cpctye" sourceRef="Activity_1tw8eyy" targetRef="Activity_0p20esb" />
+    <bpmn:callActivity id="Activity_0p20esb" name="Call SDNC Adapter: Activate/Deactivate TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <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="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0cpctye</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fuabjs</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0fuabjs" sourceRef="Activity_0p20esb" targetRef="Activity_0phv8e5" />
+    <bpmn:scriptTask id="Activity_0phv8e5" name="Postprocess SDNC Activate/Deactivate TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fuabjs</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def runScript = new DoActivateTnNssi()
+runScript.validateSDNCResponse(execution, response)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="ScriptTask_19uxoi8" />
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" />
+    <bpmn:serviceTask id="Activity_0nhxd67" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1032bi1</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1032bi1" sourceRef="Activity_0nhxd67" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateTransportNSSI">
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="509" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+        <di:waypoint x="1080" y="121" />
+        <di:waypoint x="1220" y="121" />
+        <di:waypoint x="1220" y="210" />
+        <di:waypoint x="335" y="210" />
+        <di:waypoint x="335" y="310" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
+        <di:waypoint x="850" y="121" />
+        <di:waypoint x="959" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
+        <di:waypoint x="630" y="121" />
+        <di:waypoint x="729" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="385" y="350" />
+        <di:waypoint x="530" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="630" y="350" />
+        <di:waypoint x="740" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1032bi1_di" bpmnElement="Flow_1032bi1">
+        <di:waypoint x="840" y="350" />
+        <di:waypoint x="1002" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="163" y="146" width="81" height="53" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0nhxd67_di" bpmnElement="Activity_0nhxd67">
+        <dc:Bounds x="740" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1002" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1010" y="375" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="530" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="285" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+        <dc:Bounds x="509" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
+        <dc:Bounds x="729" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="959" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..9c12200
--- /dev/null
@@ -0,0 +1,960 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_05od9yd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoAllocateAccessNSSI" name="DoAllocateAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Start">
+      <bpmn:outgoing>Flow_163f3sq</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_1jj3kh9" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_163f3sq</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tica8m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0vhvubq" name="Get Subnet capabilities" scriptFormat="groovy">
+      <bpmn:incoming>Flow_00f37fu</bpmn:incoming>
+      <bpmn:outgoing>Flow_1w8whur</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.getSubnetCapabilities(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_11vdo22" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0833cha</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xw4abx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareOperationStatusUpdate(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1nfx154" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1xw4abx</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ll5x3u</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:endEvent id="Event_0vh1hs2">
+      <bpmn:incoming>Flow_0ll5x3u</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0833cha" sourceRef="Event_05jtdqp" targetRef="Activity_11vdo22" />
+    <bpmn:sequenceFlow id="Flow_1xw4abx" sourceRef="Activity_11vdo22" targetRef="Activity_1nfx154" />
+    <bpmn:sequenceFlow id="Flow_0ll5x3u" sourceRef="Activity_1nfx154" targetRef="Event_0vh1hs2" />
+    <bpmn:sequenceFlow id="Flow_1x3y2tg" sourceRef="Event_18r5xkz" targetRef="Activity_03dgcg5" />
+    <bpmn:scriptTask id="Activity_19laorl" name="prepare OOF request for RAN NF NSSI selection" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0rb4j9r</bpmn:incoming>
+      <bpmn:outgoing>Flow_0d0f3ie</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareOofRequestForRanNfNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_03dgcg5" name="send allocate FH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1x3y2tg</bpmn:incoming>
+      <bpmn:outgoing>Flow_0qhjtre</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareTnFhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_18y4ijb" name="send allocate MH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0zhr499</bpmn:incoming>
+      <bpmn:outgoing>Flow_04thflx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareTnMhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="Event_05jtdqp" name="Start operation status update">
+      <bpmn:outgoing>Flow_0833cha</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05sogjc" name="OperationStatusUpdate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="Event_0u9308h" name="Go to start  Â operation status update">
+      <bpmn:incoming>Flow_0kcvava</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1o9trjv" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_18r5xkz" name="start TN allocate">
+      <bpmn:outgoing>Flow_1x3y2tg</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_15hz0uh" name="startTnAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0zhr499" sourceRef="Activity_0qn2fvh" targetRef="Activity_18y4ijb" />
+    <bpmn:scriptTask id="Activity_0qn2fvh" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16z59pu</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zhr499</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processFhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_12szahe" name="Process OOF response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b14415</bpmn:incoming>
+      <bpmn:outgoing>Flow_1h7iq8l</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processOofResponseForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0vwhzem" name="prepare OOF request for RAN NSSI selection" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1w8whur</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tkzfhb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareOofRequestForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_163f3sq" sourceRef="StartEvent_1" targetRef="Activity_1jj3kh9" />
+    <bpmn:exclusiveGateway id="Gateway_1aesepd" name="Is Response NSSI?" default="Flow_0k39zt8">
+      <bpmn:incoming>Flow_09tjspa</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ipsxgh</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0k39zt8</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:intermediateThrowEvent id="Event_142r2sx" name="Go to start  Â operation status update">
+      <bpmn:incoming>Flow_0k8yakp</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_08wuatj" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateThrowEvent id="Event_15zn4zi" name="Goto start TN allocate">
+      <bpmn:incoming>Flow_1exjm0h</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_13crcza" name="startTnAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_1pxd5wf" name="Process OOF response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1nkqrpd</bpmn:incoming>
+      <bpmn:outgoing>Flow_1f9rw3m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processOofResponseForRanNfNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_0en9ki5" name="Is Response NSSI?" default="Flow_178fenq">
+      <bpmn:incoming>Flow_1ryi6ym</bpmn:incoming>
+      <bpmn:outgoing>Flow_178fenq</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0kn30g3</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="Activity_0a95zgv" name="prepare SDNR request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_178fenq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1pbiznt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createSdnrRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_118je0o" name="process SDNR response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_05yqmnj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ikdlkf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ipsxgh" name="yes" sourceRef="Gateway_1aesepd" targetRef="Activity_0xawnmh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isRspRanNssi" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_178fenq" name="No" sourceRef="Gateway_0en9ki5" targetRef="Activity_0a95zgv" />
+    <bpmn:sequenceFlow id="Flow_1w8whur" sourceRef="Activity_0vhvubq" targetRef="Activity_0vwhzem" />
+    <bpmn:sequenceFlow id="Flow_0tkzfhb" sourceRef="Activity_0vwhzem" targetRef="Activity_1u28lyv" />
+    <bpmn:sequenceFlow id="Flow_1h7iq8l" sourceRef="Activity_12szahe" targetRef="Event_0s8t1ji" />
+    <bpmn:intermediateThrowEvent id="Event_0s8t1ji" name="Go to start NSSI allocate">
+      <bpmn:incoming>Flow_1h7iq8l</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0yzxmpv" name="NSSIAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_1glt41l" name="start NSSI allocate">
+      <bpmn:outgoing>Flow_09tjspa</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05u2hpg" name="NSSIAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_09tjspa" sourceRef="Event_1glt41l" targetRef="Gateway_1aesepd" />
+    <bpmn:sequenceFlow id="Flow_0k39zt8" name="No" sourceRef="Gateway_1aesepd" targetRef="Activity_0fdm3in" />
+    <bpmn:scriptTask id="Activity_0p02joo" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0tica8m</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mcd9bo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0tica8m" sourceRef="Activity_1jj3kh9" targetRef="Activity_0p02joo" />
+    <bpmn:callActivity id="Activity_1u28lyv" name="Call DoCreateSubnetOption" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0tkzfhb</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b14415</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1b14415" sourceRef="Activity_1u28lyv" targetRef="Activity_12szahe" />
+    <bpmn:callActivity id="Activity_1ux83hz" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNFH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1p48xbl</bpmn:incoming>
+      <bpmn:outgoing>Flow_16z59pu</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_16z59pu" sourceRef="Activity_1ux83hz" targetRef="Activity_0qn2fvh" />
+    <bpmn:callActivity id="Activity_0c0cq9d" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNMH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0fdetmo</bpmn:incoming>
+      <bpmn:outgoing>Flow_1v3wpa2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="Activity_0y9xgkl" name="Call DoCreateSubnetOption" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nfNssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0d0f3ie</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nkqrpd</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1nkqrpd" sourceRef="Activity_0y9xgkl" targetRef="Activity_1pxd5wf" />
+    <bpmn:sequenceFlow id="Flow_0kn30g3" name="yes" sourceRef="Gateway_0en9ki5" targetRef="Activity_08i0hzk">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isRspRanNfNssi" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:callActivity id="Activity_0vbzhej" name="call sdnr for RAN NF NSSI creation" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="createNSSI_sdnrRequest" target="sdnrRequest" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_asyncCallbackResponse" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="createNSSI_correlator" target="correlator" />
+        <camunda:in source="createNSSI_messageType" target="messageType" />
+        <camunda:in source="createNSSI_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1pbiznt</bpmn:incoming>
+      <bpmn:outgoing>Flow_05yqmnj</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1pbiznt" sourceRef="Activity_0a95zgv" targetRef="Activity_0vbzhej" />
+    <bpmn:sequenceFlow id="Flow_05yqmnj" sourceRef="Activity_0vbzhej" targetRef="Activity_118je0o" />
+    <bpmn:sequenceFlow id="Flow_0qhjtre" sourceRef="Activity_03dgcg5" targetRef="Activity_12vtq69" />
+    <bpmn:sequenceFlow id="Flow_04thflx" sourceRef="Activity_18y4ijb" targetRef="Activity_0qpy2sg" />
+    <bpmn:scriptTask id="Activity_0zn4e4n" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1v3wpa2</bpmn:incoming>
+      <bpmn:outgoing>Flow_0bd6dhi</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processMhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1v3wpa2" sourceRef="Activity_0c0cq9d" targetRef="Activity_0zn4e4n" />
+    <bpmn:scriptTask id="Activity_1ll0nr1" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1i10qog</bpmn:incoming>
+      <bpmn:outgoing>Flow_00f37fu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_00f37fu" sourceRef="Activity_1ll0nr1" targetRef="Activity_0vhvubq" />
+    <bpmn:callActivity id="Activity_06hcbu6" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="ranNsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0mcd9bo</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i10qog</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0mcd9bo" sourceRef="Activity_0p02joo" targetRef="Activity_06hcbu6" />
+    <bpmn:sequenceFlow id="Flow_1i10qog" sourceRef="Activity_06hcbu6" targetRef="Activity_1ll0nr1" />
+    <bpmn:scriptTask id="Activity_1aweui4" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1k3vqxg</bpmn:incoming>
+      <bpmn:outgoing>Flow_0n1mh5c</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1bjike9" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1k0z6lp</bpmn:incoming>
+      <bpmn:outgoing>Flow_10j50jb</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1k0z6lp" sourceRef="Activity_0xawnmh" targetRef="Activity_1bjike9" />
+    <bpmn:scriptTask id="Activity_0xawnmh" name="prepare Modify Access NSSI inputs" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ipsxgh</bpmn:incoming>
+      <bpmn:outgoing>Flow_1k0z6lp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareModifyAccessNssiInputs(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0ffp1no" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="modifyRanNssiJobId" target="jobId" />
+        <camunda:out source="jobResponse" target="jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0ile39j</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mmpy7h</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0yfrqtb" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0mmpy7h</bpmn:incoming>
+      <bpmn:outgoing>Flow_0k8yakp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processModifyJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0mmpy7h" sourceRef="Activity_0ffp1no" targetRef="Activity_0yfrqtb" />
+    <bpmn:sequenceFlow id="Flow_0k8yakp" sourceRef="Activity_0yfrqtb" targetRef="Event_142r2sx" />
+    <bpmn:sequenceFlow id="Flow_0ile39j" sourceRef="Activity_1k94obj" targetRef="Activity_0ffp1no" />
+    <bpmn:scriptTask id="Activity_1k94obj" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_05s0wso</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ile39j</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createModifyNssiQueryJobStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_16w4zg9" name="Call ANModifyNSSI" calledElement="DoModifyAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="RANServiceInstanceId" target="serviceInstanceID" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="networkType" target="networkType" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="modifyRanNssiJobId" target="jobId" />
+        <camunda:in source="modifySliceParams" target="sliceParams" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="servicename" target="servicename" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_10j50jb</bpmn:incoming>
+      <bpmn:outgoing>Flow_05s0wso</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_10j50jb" sourceRef="Activity_1bjike9" targetRef="Activity_16w4zg9" />
+    <bpmn:sequenceFlow id="Flow_05s0wso" sourceRef="Activity_16w4zg9" targetRef="Activity_1k94obj" />
+    <bpmn:scriptTask id="Activity_0fdm3in" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0k39zt8</bpmn:incoming>
+      <bpmn:incoming>Flow_083bb3k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0reg6l5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareNsstDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0a7a04p" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="nsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0reg6l5</bpmn:incoming>
+      <bpmn:outgoing>Flow_0jdjta3</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:exclusiveGateway id="Gateway_1cmraqs" name="Is all nsst decomposed?" default="Flow_083bb3k">
+      <bpmn:incoming>Flow_0y78v1q</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rb4j9r</bpmn:outgoing>
+      <bpmn:outgoing>Flow_083bb3k</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="Activity_1nmk2rt" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0jdjta3</bpmn:incoming>
+      <bpmn:outgoing>Flow_0y78v1q</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processNsstDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0reg6l5" sourceRef="Activity_0fdm3in" targetRef="Activity_0a7a04p" />
+    <bpmn:sequenceFlow id="Flow_0jdjta3" sourceRef="Activity_0a7a04p" targetRef="Activity_1nmk2rt" />
+    <bpmn:sequenceFlow id="Flow_0y78v1q" sourceRef="Activity_1nmk2rt" targetRef="Gateway_1cmraqs" />
+    <bpmn:sequenceFlow id="Flow_0rb4j9r" name="yes" sourceRef="Gateway_1cmraqs" targetRef="Activity_19laorl">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNsstsDecomposed" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0d0f3ie" sourceRef="Activity_19laorl" targetRef="Activity_0y9xgkl" />
+    <bpmn:scriptTask id="Activity_027ic3j" name="create slice profiles in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1f9rw3m</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ryi6ym</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createSliceProfilesInAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1f9rw3m" sourceRef="Activity_1pxd5wf" targetRef="Activity_027ic3j" />
+    <bpmn:sequenceFlow id="Flow_1ryi6ym" sourceRef="Activity_027ic3j" targetRef="Gateway_0en9ki5" />
+    <bpmn:scriptTask id="Activity_12vtq69" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0qhjtre</bpmn:incoming>
+      <bpmn:outgoing>Flow_1p48xbl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1p48xbl" sourceRef="Activity_12vtq69" targetRef="Activity_1ux83hz" />
+    <bpmn:scriptTask id="Activity_0qpy2sg" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_04thflx</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fdetmo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0fdetmo" sourceRef="Activity_0qpy2sg" targetRef="Activity_0c0cq9d" />
+    <bpmn:scriptTask id="Activity_0pa8al6" name="create RAN NSSI and RAN NF NSSI in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ikdlkf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1exjm0h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.updateAaiWithRANInstances(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0ikdlkf" sourceRef="Activity_118je0o" targetRef="Activity_0pa8al6" />
+    <bpmn:sequenceFlow id="Flow_1exjm0h" sourceRef="Activity_0pa8al6" targetRef="Event_15zn4zi" />
+    <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Activity_0vf28ld" />
+    <bpmn:sequenceFlow id="Flow_0kcvava" sourceRef="Activity_0vf28ld" targetRef="Event_0u9308h" />
+    <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships">
+      <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming>
+      <bpmn:outgoing>Flow_0kcvava</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.updateAairelationships(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:subProcess id="Activity_0bcs8g1" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_077lf7i">
+        <bpmn:outgoing>Flow_18rrdsq</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1chyysm" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1p00v8c">
+        <bpmn:incoming>Flow_0c9dr7z</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_084fqbd" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0umohws</bpmn:incoming>
+        <bpmn:outgoing>Flow_0c9dr7z</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_0c9dr7z" sourceRef="Activity_084fqbd" targetRef="Event_1p00v8c" />
+      <bpmn:scriptTask id="Activity_1adxijg" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_18rrdsq</bpmn:incoming>
+        <bpmn:outgoing>Flow_11qgtdm</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_0p0mwue" name="Update Resource Operation Status">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                  <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>Flow_11qgtdm</bpmn:incoming>
+        <bpmn:outgoing>Flow_0umohws</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_18rrdsq" sourceRef="Event_077lf7i" targetRef="Activity_1adxijg" />
+      <bpmn:sequenceFlow id="Flow_11qgtdm" sourceRef="Activity_1adxijg" targetRef="Activity_0p0mwue" />
+      <bpmn:sequenceFlow id="Flow_0umohws" sourceRef="Activity_0p0mwue" targetRef="Activity_084fqbd" />
+    </bpmn:subProcess>
+    <bpmn:intermediateThrowEvent id="Event_1cqde7p" name="Goto start TN allocate">
+      <bpmn:incoming>Flow_0n1mh5c</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0da795k" name="startTnAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0n1mh5c" sourceRef="Activity_1aweui4" targetRef="Event_1cqde7p" />
+    <bpmn:callActivity id="Activity_08i0hzk" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="ranNfSliceProfile" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0kn30g3</bpmn:incoming>
+      <bpmn:outgoing>Flow_1k3vqxg</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1k3vqxg" sourceRef="Activity_08i0hzk" targetRef="Activity_1aweui4" />
+    <bpmn:sequenceFlow id="Flow_083bb3k" sourceRef="Gateway_1cmraqs" targetRef="Activity_0fdm3in" />
+  </bpmn:process>
+  <bpmn:message id="Message_1r7nv8u" name="WorkflowMessage" />
+  <bpmn:error id="Error_047rteq" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_0kcvava_di" bpmnElement="Flow_0kcvava">
+        <di:waypoint x="1800" y="820" />
+        <di:waypoint x="1882" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0bd6dhi_di" bpmnElement="Flow_0bd6dhi">
+        <di:waypoint x="1620" y="820" />
+        <di:waypoint x="1700" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1exjm0h_di" bpmnElement="Flow_1exjm0h">
+        <di:waypoint x="1850" y="680" />
+        <di:waypoint x="1882" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ikdlkf_di" bpmnElement="Flow_0ikdlkf">
+        <di:waypoint x="1720" y="680" />
+        <di:waypoint x="1750" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fdetmo_di" bpmnElement="Flow_0fdetmo">
+        <di:waypoint x="1260" y="820" />
+        <di:waypoint x="1340" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1p48xbl_di" bpmnElement="Flow_1p48xbl">
+        <di:waypoint x="580" y="820" />
+        <di:waypoint x="640" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ryi6ym_di" bpmnElement="Flow_1ryi6ym">
+        <di:waypoint x="1330" y="531" />
+        <di:waypoint x="1355" y="531" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1f9rw3m_di" bpmnElement="Flow_1f9rw3m">
+        <di:waypoint x="1210" y="531" />
+        <di:waypoint x="1230" y="531" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0d0f3ie_di" bpmnElement="Flow_0d0f3ie">
+        <di:waypoint x="950" y="530" />
+        <di:waypoint x="980" y="530" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rb4j9r_di" bpmnElement="Flow_0rb4j9r">
+        <di:waypoint x="815" y="529" />
+        <di:waypoint x="833" y="529" />
+        <di:waypoint x="833" y="530" />
+        <di:waypoint x="850" y="530" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="824" y="543" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0y78v1q_di" bpmnElement="Flow_0y78v1q">
+        <di:waypoint x="720" y="529" />
+        <di:waypoint x="765" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jdjta3_di" bpmnElement="Flow_0jdjta3">
+        <di:waypoint x="600" y="529" />
+        <di:waypoint x="620" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0reg6l5_di" bpmnElement="Flow_0reg6l5">
+        <di:waypoint x="470" y="529" />
+        <di:waypoint x="485" y="529" />
+        <di:waypoint x="485" y="530" />
+        <di:waypoint x="500" y="530" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05s0wso_di" bpmnElement="Flow_05s0wso">
+        <di:waypoint x="770" y="380" />
+        <di:waypoint x="810" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10j50jb_di" bpmnElement="Flow_10j50jb">
+        <di:waypoint x="630" y="380" />
+        <di:waypoint x="670" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ile39j_di" bpmnElement="Flow_0ile39j">
+        <di:waypoint x="910" y="380" />
+        <di:waypoint x="950" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k8yakp_di" bpmnElement="Flow_0k8yakp">
+        <di:waypoint x="1190" y="380" />
+        <di:waypoint x="1242" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mmpy7h_di" bpmnElement="Flow_0mmpy7h">
+        <di:waypoint x="1050" y="380" />
+        <di:waypoint x="1090" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1k0z6lp_di" bpmnElement="Flow_1k0z6lp">
+        <di:waypoint x="490" y="380" />
+        <di:waypoint x="530" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i10qog_di" bpmnElement="Flow_1i10qog">
+        <di:waypoint x="630" y="120" />
+        <di:waypoint x="690" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mcd9bo_di" bpmnElement="Flow_0mcd9bo">
+        <di:waypoint x="480" y="120" />
+        <di:waypoint x="530" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00f37fu_di" bpmnElement="Flow_00f37fu">
+        <di:waypoint x="790" y="120" />
+        <di:waypoint x="830" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1v3wpa2_di" bpmnElement="Flow_1v3wpa2">
+        <di:waypoint x="1440" y="820" />
+        <di:waypoint x="1520" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04thflx_di" bpmnElement="Flow_04thflx">
+        <di:waypoint x="1100" y="820" />
+        <di:waypoint x="1160" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0qhjtre_di" bpmnElement="Flow_0qhjtre">
+        <di:waypoint x="410" y="820" />
+        <di:waypoint x="480" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05yqmnj_di" bpmnElement="Flow_05yqmnj">
+        <di:waypoint x="1580" y="680" />
+        <di:waypoint x="1620" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pbiznt_di" bpmnElement="Flow_1pbiznt">
+        <di:waypoint x="1430" y="680" />
+        <di:waypoint x="1480" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0kn30g3_di" bpmnElement="Flow_0kn30g3">
+        <di:waypoint x="1403" y="529" />
+        <di:waypoint x="1460" y="529" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1413" y="513" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nkqrpd_di" bpmnElement="Flow_1nkqrpd">
+        <di:waypoint x="1080" y="531" />
+        <di:waypoint x="1110" y="531" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16z59pu_di" bpmnElement="Flow_16z59pu">
+        <di:waypoint x="740" y="820" />
+        <di:waypoint x="810" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b14415_di" bpmnElement="Flow_1b14415">
+        <di:waypoint x="1200" y="120" />
+        <di:waypoint x="1240" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tica8m_di" bpmnElement="Flow_0tica8m">
+        <di:waypoint x="340" y="120" />
+        <di:waypoint x="380" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k39zt8_di" bpmnElement="Flow_0k39zt8">
+        <di:waypoint x="270" y="405" />
+        <di:waypoint x="270" y="529" />
+        <di:waypoint x="370" y="529" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="249" y="421" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09tjspa_di" bpmnElement="Flow_09tjspa">
+        <di:waypoint x="198" y="380" />
+        <di:waypoint x="245" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1h7iq8l_di" bpmnElement="Flow_1h7iq8l">
+        <di:waypoint x="1340" y="120" />
+        <di:waypoint x="1372" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tkzfhb_di" bpmnElement="Flow_0tkzfhb">
+        <di:waypoint x="1060" y="120" />
+        <di:waypoint x="1100" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1w8whur_di" bpmnElement="Flow_1w8whur">
+        <di:waypoint x="930" y="120" />
+        <di:waypoint x="960" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_178fenq_di" bpmnElement="Flow_178fenq">
+        <di:waypoint x="1380" y="556" />
+        <di:waypoint x="1380" y="640" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1386" y="574" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ipsxgh_di" bpmnElement="Flow_1ipsxgh">
+        <di:waypoint x="295" y="380" />
+        <di:waypoint x="390" y="380" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="319" y="363" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_163f3sq_di" bpmnElement="Flow_163f3sq">
+        <di:waypoint x="198" y="120" />
+        <di:waypoint x="240" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zhr499_di" bpmnElement="Flow_0zhr499">
+        <di:waypoint x="910" y="820" />
+        <di:waypoint x="1000" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1x3y2tg_di" bpmnElement="Flow_1x3y2tg">
+        <di:waypoint x="228" y="820" />
+        <di:waypoint x="310" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ll5x3u_di" bpmnElement="Flow_0ll5x3u">
+        <di:waypoint x="600" y="1010" />
+        <di:waypoint x="692" y="1010" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xw4abx_di" bpmnElement="Flow_1xw4abx">
+        <di:waypoint x="420" y="1010" />
+        <di:waypoint x="500" y="1010" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0833cha_di" bpmnElement="Flow_0833cha">
+        <di:waypoint x="228" y="1010" />
+        <di:waypoint x="320" y="1010" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0n1mh5c_di" bpmnElement="Flow_0n1mh5c">
+        <di:waypoint x="1690" y="529" />
+        <di:waypoint x="1742" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1k3vqxg_di" bpmnElement="Flow_1k3vqxg">
+        <di:waypoint x="1560" y="529" />
+        <di:waypoint x="1590" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_083bb3k_di" bpmnElement="Flow_083bb3k">
+        <di:waypoint x="790" y="554" />
+        <di:waypoint x="790" y="730" />
+        <di:waypoint x="420" y="730" />
+        <di:waypoint x="420" y="569" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="162" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="167" y="152" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_01iduqx_di" bpmnElement="Activity_1jj3kh9">
+        <dc:Bounds x="240" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1gdi5bo_di" bpmnElement="Activity_0vhvubq">
+        <dc:Bounds x="830" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11vdo22_di" bpmnElement="Activity_11vdo22">
+        <dc:Bounds x="320" y="970" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nfx154_di" bpmnElement="Activity_1nfx154">
+        <dc:Bounds x="500" y="970" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0vh1hs2_di" bpmnElement="Event_0vh1hs2">
+        <dc:Bounds x="692" y="992" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0icw8wt_di" bpmnElement="Activity_19laorl">
+        <dc:Bounds x="850" y="490" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10z6k5t_di" bpmnElement="Activity_03dgcg5">
+        <dc:Bounds x="310" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1dracjc_di" bpmnElement="Activity_18y4ijb">
+        <dc:Bounds x="1000" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0g0i472_di" bpmnElement="Event_05jtdqp">
+        <dc:Bounds x="192" y="992" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="174" y="1035" width="73" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1ea1h0i_di" bpmnElement="Event_0u9308h">
+        <dc:Bounds x="1882" y="802" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1860" y="850" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1fj3anx_di" bpmnElement="Event_18r5xkz">
+        <dc:Bounds x="192" y="802" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="170" y="845" width="81" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0nm8unl_di" bpmnElement="Activity_0qn2fvh">
+        <dc:Bounds x="810" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_12szahe_di" bpmnElement="Activity_12szahe">
+        <dc:Bounds x="1240" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1oepxwk_di" bpmnElement="Activity_0vwhzem">
+        <dc:Bounds x="960" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1aesepd_di" bpmnElement="Gateway_1aesepd" isMarkerVisible="true">
+        <dc:Bounds x="245" y="355" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="239" y="326" width="62" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_142r2sx_di" bpmnElement="Event_142r2sx">
+        <dc:Bounds x="1242" y="362" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1220" y="397" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_15zn4zi_di" bpmnElement="Event_15zn4zi">
+        <dc:Bounds x="1882" y="662" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1868" y="705" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1pxd5wf_di" bpmnElement="Activity_1pxd5wf">
+        <dc:Bounds x="1110" y="491" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0en9ki5_di" bpmnElement="Gateway_0en9ki5" isMarkerVisible="true">
+        <dc:Bounds x="1355" y="506" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1349" y="476" width="62" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0a95zgv_di" bpmnElement="Activity_0a95zgv">
+        <dc:Bounds x="1330" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_118je0o_di" bpmnElement="Activity_118je0o">
+        <dc:Bounds x="1620" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0qwruv5_di" bpmnElement="Event_0s8t1ji">
+        <dc:Bounds x="1372" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1351" y="145" width="81" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1vfrb2l_di" bpmnElement="Event_1glt41l">
+        <dc:Bounds x="162" y="362" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="155" y="405" width="51" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p02joo_di" bpmnElement="Activity_0p02joo">
+        <dc:Bounds x="380" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1u28lyv_di" bpmnElement="Activity_1u28lyv">
+        <dc:Bounds x="1100" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ux83hz_di" bpmnElement="Activity_1ux83hz">
+        <dc:Bounds x="640" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0c0cq9d_di" bpmnElement="Activity_0c0cq9d">
+        <dc:Bounds x="1340" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0y9xgkl_di" bpmnElement="Activity_0y9xgkl">
+        <dc:Bounds x="980" y="491" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0vbzhej_di" bpmnElement="Activity_0vbzhej">
+        <dc:Bounds x="1480" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0zn4e4n_di" bpmnElement="Activity_0zn4e4n">
+        <dc:Bounds x="1520" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ll0nr1_di" bpmnElement="Activity_1ll0nr1">
+        <dc:Bounds x="690" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06hcbu6_di" bpmnElement="Activity_06hcbu6">
+        <dc:Bounds x="530" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xke4xc_di" bpmnElement="Activity_1aweui4">
+        <dc:Bounds x="1590" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1bjike9_di" bpmnElement="Activity_1bjike9">
+        <dc:Bounds x="530" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_02rsimm_di" bpmnElement="Activity_0xawnmh">
+        <dc:Bounds x="390" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ffp1no_di" bpmnElement="Activity_0ffp1no">
+        <dc:Bounds x="950" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0yfrqtb_di" bpmnElement="Activity_0yfrqtb">
+        <dc:Bounds x="1090" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wagv3s_di" bpmnElement="Activity_1k94obj">
+        <dc:Bounds x="810" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16w4zg9_di" bpmnElement="Activity_16w4zg9">
+        <dc:Bounds x="670" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0fdm3in_di" bpmnElement="Activity_0fdm3in">
+        <dc:Bounds x="370" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0a7a04p_di" bpmnElement="Activity_0a7a04p">
+        <dc:Bounds x="500" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1cmraqs_di" bpmnElement="Gateway_1cmraqs" isMarkerVisible="true">
+        <dc:Bounds x="765" y="504" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="755" y="467" width="70" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nmk2rt_di" bpmnElement="Activity_1nmk2rt">
+        <dc:Bounds x="620" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_027ic3j_di" bpmnElement="Activity_027ic3j">
+        <dc:Bounds x="1230" y="491" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_12vtq69_di" bpmnElement="Activity_12vtq69">
+        <dc:Bounds x="480" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0qpy2sg_di" bpmnElement="Activity_0qpy2sg">
+        <dc:Bounds x="1160" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0pa8al6_di" bpmnElement="Activity_0pa8al6">
+        <dc:Bounds x="1750" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1riw9uv_di" bpmnElement="Activity_0vf28ld">
+        <dc:Bounds x="1700" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1cqde7p_di" bpmnElement="Event_1cqde7p">
+        <dc:Bounds x="1742" y="511" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1728" y="554" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08i0hzk_di" bpmnElement="Activity_08i0hzk">
+        <dc:Bounds x="1460" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0bcs8g1_di" bpmnElement="Activity_0bcs8g1" isExpanded="true">
+        <dc:Bounds x="410" y="1160" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0umohws_di" bpmnElement="Flow_0umohws">
+        <di:waypoint x="800" y="1264" />
+        <di:waypoint x="870" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11qgtdm_di" bpmnElement="Flow_11qgtdm">
+        <di:waypoint x="640" y="1264" />
+        <di:waypoint x="700" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18rrdsq_di" bpmnElement="Flow_18rrdsq">
+        <di:waypoint x="476" y="1264" />
+        <di:waypoint x="540" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0c9dr7z_di" bpmnElement="Flow_0c9dr7z">
+        <di:waypoint x="970" y="1264" />
+        <di:waypoint x="1078" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_077lf7i_di" bpmnElement="Event_077lf7i">
+        <dc:Bounds x="440" y="1246" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1p00v8c_di" bpmnElement="Event_1p00v8c">
+        <dc:Bounds x="1078" y="1246" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_084fqbd_di" bpmnElement="Activity_084fqbd">
+        <dc:Bounds x="870" y="1224" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1adxijg_di" bpmnElement="Activity_1adxijg">
+        <dc:Bounds x="540" y="1224" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p0mwue_di" bpmnElement="Activity_0p0mwue">
+        <dc:Bounds x="700" y="1224" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSIV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSIV2.bpmn
new file mode 100644 (file)
index 0000000..071960a
--- /dev/null
@@ -0,0 +1,598 @@
+<?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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+  <bpmn:process id="DoAllocateNSIandNSSIV2" name="DoAllocateNSIandNSSIV2" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1ym3sha" name="Start">
+      <bpmn:outgoing>SequenceFlow_0xgfj7z</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0xgfj7z" sourceRef="StartEvent_1ym3sha" targetRef="Task_027u6m6" />
+    <bpmn:scriptTask id="Task_027u6m6" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0xgfj7z</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_00aukg6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dansi = new DoAllocateNSIandNSSI()
+dansi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0qorxd9" name="Process NSI options" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_00aukg6</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ggo6s5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dansi = new DoAllocateNSIandNSSI()
+dansi.retriveSliceOption(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_00aukg6" sourceRef="Task_027u6m6" targetRef="ScriptTask_0qorxd9" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_00pt1ek" name="Is nsi option available?" default="SequenceFlow_0c986i9">
+      <bpmn:incoming>SequenceFlow_1ggo6s5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0c986i9</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_03ye8m4</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1ggo6s5" sourceRef="ScriptTask_0qorxd9" targetRef="ExclusiveGateway_00pt1ek" />
+    <bpmn:sequenceFlow id="SequenceFlow_0c986i9" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_1tizl6b" />
+    <bpmn:scriptTask id="ScriptTask_1tizl6b" name="create NSI in AAI and Update relationship" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0c986i9</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1k3cspv</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createNSIinAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1k3cspv" sourceRef="ScriptTask_1tizl6b" targetRef="ScriptTask_1r6kuwy" />
+    <bpmn:sequenceFlow id="SequenceFlow_03ye8m4" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_07sgklo">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0fx1nyj" name="GoTo Create Slice Profile">
+      <bpmn:incoming>SequenceFlow_0t0wddg</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_05ovikm</bpmn:incoming>
+      <bpmn:linkEventDefinition name="CreateSliceProfile" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0k54pph" name="Create Slice Profile">
+      <bpmn:outgoing>SequenceFlow_0ct8yh4</bpmn:outgoing>
+      <bpmn:linkEventDefinition name="CreateSliceProfile" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0ct8yh4" sourceRef="IntermediateThrowEvent_0k54pph" targetRef="ExclusiveGateway_00ufetn" />
+    <bpmn:parallelGateway id="ExclusiveGateway_00ufetn">
+      <bpmn:incoming>SequenceFlow_0ct8yh4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1m68yca</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0k5iu2n</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1m68yca" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1tv7jy5" />
+    <bpmn:sequenceFlow id="SequenceFlow_0k5iu2n" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1en3luv" />
+    <bpmn:callActivity id="CallActivity_1yh9tiq" name="Call DoAllocateNSSI(RAN)" calledElement="DoAllocateNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="nsstInput" target="nsstInput" />
+        <camunda:in source="serviceProfile" target="serviceProfile" />
+        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="uuiRequest" target="uuiRequest" />
+        <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
+        <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
+        <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
+        <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+        <camunda:in source="taskId" target="CSSOT_taskId" />
+        <camunda:in source="taskName" target="CSSOT_name" />
+        <camunda:in source="taskStatus" target="CSSOT_status" />
+        <camunda:in source="isManual" target="CSSOT_isManual" />
+        <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+        <camunda:in source="anSliceTaskInfo" target="sliceTaskInfo" />
+        <camunda:out source="nssiAllocateResult" target="nssiAllocateResult" />
+        <camunda:in source="AnAllocateNssiNbiRequest" target="nbiRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0npsyye</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1xb5nx1</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1hfjn79" sourceRef="Task_1tv7jy5" targetRef="ScriptTask_1r2li91" />
+    <bpmn:callActivity id="CallActivity_1ixah3o" name="Call DoAllocateNSSI(Core)" calledElement="DoAllocateNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="nsstInput" target="nsstInput" />
+        <camunda:in source="serviceProfile" target="serviceProfile" />
+        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="uuiRequest" target="uuiRequest" />
+        <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
+        <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
+        <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
+        <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+        <camunda:in source="taskId" target="CSSOT_taskId" />
+        <camunda:in source="taskName" target="CSSOT_name" />
+        <camunda:in source="taskStatus" target="CSSOT_status" />
+        <camunda:in source="isManual" target="CSSOT_isManual" />
+        <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+        <camunda:in source="cnSliceTaskInfo" target="sliceTaskInfo" />
+        <camunda:in source="domainType" target="domainType" />
+        <camunda:out source="nssiAllocateResult" target="nssiAllocateResult" />
+        <camunda:in source="CnAllocateNssiNbiRequest" target="nbiRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0cwbtmr</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1l74seh</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_0f36cu2" sourceRef="Task_1en3luv" targetRef="Task_1g8n8iz" />
+    <bpmn:sequenceFlow id="SequenceFlow_1xb5nx1" sourceRef="CallActivity_1yh9tiq" targetRef="ScriptTask_0mls87v" />
+    <bpmn:parallelGateway id="ExclusiveGateway_19ru3hp">
+      <bpmn:incoming>SequenceFlow_1gkb7iy</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_03zglrh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0ax2c4p</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:scriptTask id="ScriptTask_07sgklo" name="Update relationship between NSI and Service Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03ye8m4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0t0wddg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.updateRelationship(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0t0wddg" sourceRef="ScriptTask_07sgklo" targetRef="IntermediateThrowEvent_0fx1nyj" />
+    <bpmn:scriptTask id="ScriptTask_1r6kuwy" name="create relationship between nsi and SP" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1k3cspv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_05ovikm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createRelationship(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_05ovikm" sourceRef="ScriptTask_1r6kuwy" targetRef="IntermediateThrowEvent_0fx1nyj" />
+    <bpmn:scriptTask id="Task_1tv7jy5" name="Create RAN Slice Profile Instance" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1m68yca</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1hfjn79</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createAnSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1r2li91" name="Create RAN Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1hfjn79</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0zbd2tq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createAnSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0zbd2tq" sourceRef="ScriptTask_1r2li91" targetRef="ScriptTask_0s8vhha" />
+    <bpmn:scriptTask id="Task_1en3luv" name="Create Core Slice Profile Instance" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0k5iu2n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0f36cu2</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createCnSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_1g8n8iz" name="Create Core Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0f36cu2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1wffel4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createCnSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0ax2c4p" sourceRef="ExclusiveGateway_19ru3hp" targetRef="EndEvent_02c8wsp" />
+    <bpmn:scriptTask id="ScriptTask_0stnvp3" name="Create TN (BH) Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0paqrtx</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1d48cil</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createTnBHSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1f4o46q" name="Create TN(BH) Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1d48cil</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_00dexhy</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createTnBHSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_0b28wlb" name="Call DoAllocateNSSI(TN)" calledElement="DoAllocateNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="nsstInput" target="nsstInput" />
+        <camunda:in source="serviceProfile" target="serviceProfile" />
+        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="uuiRequest" target="uuiRequest" />
+        <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
+        <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
+        <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
+        <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+        <camunda:in source="taskId" target="CSSOT_taskId" />
+        <camunda:in source="taskName" target="CSSOT_name" />
+        <camunda:in source="taskStatus" target="CSSOT_status" />
+        <camunda:in source="isManual" target="CSSOT_isManual" />
+        <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+        <camunda:in source="tnBHSliceTaskInfo" target="sliceTaskInfo" />
+        <camunda:out source="nssiAllocateResult" target="nssiAllocateResult" />
+        <camunda:in source="TnBHAllocateNssiNbiRequest" target="nbiRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_01isn2q</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1omynpt</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1d48cil" sourceRef="ScriptTask_0stnvp3" targetRef="ScriptTask_1f4o46q" />
+    <bpmn:sequenceFlow id="SequenceFlow_00dexhy" sourceRef="ScriptTask_1f4o46q" targetRef="ScriptTask_0ci5g6y" />
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08wpvhs" name="Create Tn SliceProfile">
+      <bpmn:outgoing>SequenceFlow_0paqrtx</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1beugxy" name="CreateTnSliceProfile" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0paqrtx" sourceRef="IntermediateCatchEvent_08wpvhs" targetRef="ScriptTask_0stnvp3" />
+    <bpmn:scriptTask id="ScriptTask_0sssiii" name="Update relationship between NSI and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1omynpt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_150xio1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1me5mt6" name="Update relationship between  Slice Profile and Service Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_150xio1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_040fu80</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0vrzjir" name="Update RelationShip between SliceProfile and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_040fu80</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1uti8ls</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_150xio1" sourceRef="ScriptTask_0sssiii" targetRef="ScriptTask_1me5mt6" />
+    <bpmn:sequenceFlow id="SequenceFlow_040fu80" sourceRef="ScriptTask_1me5mt6" targetRef="ScriptTask_0vrzjir" />
+    <bpmn:scriptTask id="ScriptTask_0mls87v" name="Update relationship between NSI and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1xb5nx1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0xx5bwa</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0xx5bwa" sourceRef="ScriptTask_0mls87v" targetRef="ScriptTask_0g8dgo6" />
+    <bpmn:scriptTask id="ScriptTask_0g8dgo6" name="Update relationship between  Slice Profile and Service Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0xx5bwa</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1sckufj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1sckufj" sourceRef="ScriptTask_0g8dgo6" targetRef="ScriptTask_0blxroa" />
+    <bpmn:scriptTask id="ScriptTask_0blxroa" name="Update RelationShip between SliceProfile and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1sckufj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1gkb7iy</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1gkb7iy" sourceRef="ScriptTask_0blxroa" targetRef="ExclusiveGateway_19ru3hp" />
+    <bpmn:scriptTask id="ScriptTask_0z9x5uh" name="Update relationship between NSI and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1l74seh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0jqxxjq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_09197ms" name="Update relationship between  Slice Profile and Service Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0jqxxjq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_02qun80</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_127nizg" name="Update RelationShip between SliceProfile and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_02qun80</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_03zglrh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1l74seh" sourceRef="CallActivity_1ixah3o" targetRef="ScriptTask_0z9x5uh" />
+    <bpmn:sequenceFlow id="SequenceFlow_0jqxxjq" sourceRef="ScriptTask_0z9x5uh" targetRef="ScriptTask_09197ms" />
+    <bpmn:sequenceFlow id="SequenceFlow_02qun80" sourceRef="ScriptTask_09197ms" targetRef="ScriptTask_127nizg" />
+    <bpmn:sequenceFlow id="SequenceFlow_03zglrh" sourceRef="ScriptTask_127nizg" targetRef="ExclusiveGateway_19ru3hp" />
+    <bpmn:sequenceFlow id="SequenceFlow_1omynpt" sourceRef="CallActivity_0b28wlb" targetRef="ScriptTask_0sssiii" />
+    <bpmn:endEvent id="EndEvent_0elqlhv">
+      <bpmn:incoming>SequenceFlow_1uti8ls</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1uti8ls" sourceRef="ScriptTask_0vrzjir" targetRef="EndEvent_0elqlhv" />
+    <bpmn:intermediateThrowEvent id="EndEvent_02c8wsp" name="GoTo Create Tn SliceProfile">
+      <bpmn:incoming>SequenceFlow_0ax2c4p</bpmn:incoming>
+      <bpmn:linkEventDefinition name="CreateTnSliceProfile" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="ScriptTask_0s8vhha" name="prepare Allocate An Nssi" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0zbd2tq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0npsyye</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0npsyye" sourceRef="ScriptTask_0s8vhha" targetRef="CallActivity_1yh9tiq" />
+    <bpmn:scriptTask id="ScriptTask_0z0ec5b" name="prepare Allocate An Nssi" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1wffel4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0cwbtmr</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateCnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0cwbtmr" sourceRef="ScriptTask_0z0ec5b" targetRef="CallActivity_1ixah3o" />
+    <bpmn:sequenceFlow id="SequenceFlow_1wffel4" sourceRef="Task_1g8n8iz" targetRef="ScriptTask_0z0ec5b" />
+    <bpmn:scriptTask id="ScriptTask_0ci5g6y" name="prepare Allocate Tn-BH Nssi" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_00dexhy</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_01isn2q</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_01isn2q" sourceRef="ScriptTask_0ci5g6y" targetRef="CallActivity_0b28wlb" />
+  </bpmn:process>
+  <bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSIV2">
+      <bpmndi:BPMNShape id="StartEvent_1ym3sha_di" bpmnElement="StartEvent_1ym3sha">
+        <dc:Bounds x="138" y="122" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="144" y="165" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xgfj7z_di" bpmnElement="SequenceFlow_0xgfj7z">
+        <di:waypoint x="174" y="140" />
+        <di:waypoint x="224" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0q0td74_di" bpmnElement="Task_027u6m6">
+        <dc:Bounds x="224" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0qorxd9_di" bpmnElement="ScriptTask_0qorxd9">
+        <dc:Bounds x="404" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_00aukg6_di" bpmnElement="SequenceFlow_00aukg6">
+        <di:waypoint x="324" y="140" />
+        <di:waypoint x="404" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ExclusiveGateway_00pt1ek_di" bpmnElement="ExclusiveGateway_00pt1ek" isMarkerVisible="true">
+        <dc:Bounds x="609" y="115" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="604" y="78" width="59" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ggo6s5_di" bpmnElement="SequenceFlow_1ggo6s5">
+        <di:waypoint x="504" y="140" />
+        <di:waypoint x="609" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0c986i9_di" bpmnElement="SequenceFlow_0c986i9">
+        <di:waypoint x="659" y="140" />
+        <di:waypoint x="800" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1tizl6b_di" bpmnElement="ScriptTask_1tizl6b">
+        <dc:Bounds x="800" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1k3cspv_di" bpmnElement="SequenceFlow_1k3cspv">
+        <di:waypoint x="900" y="140" />
+        <di:waypoint x="970" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03ye8m4_di" bpmnElement="SequenceFlow_03ye8m4">
+        <di:waypoint x="634" y="165" />
+        <di:waypoint x="634" y="260" />
+        <di:waypoint x="930" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0zuxkap_di" bpmnElement="IntermediateThrowEvent_0fx1nyj">
+        <dc:Bounds x="1412" y="122" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1388" y="92" width="90" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_1u7g80x_di" bpmnElement="IntermediateThrowEvent_0k54pph">
+        <dc:Bounds x="138" y="502" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="126" y="545" width="60" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ct8yh4_di" bpmnElement="SequenceFlow_0ct8yh4">
+        <di:waypoint x="174" y="520" />
+        <di:waypoint x="239" y="520" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ParallelGateway_0q9h79n_di" bpmnElement="ExclusiveGateway_00ufetn">
+        <dc:Bounds x="239" y="495" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1m68yca_di" bpmnElement="SequenceFlow_1m68yca">
+        <di:waypoint x="264" y="495" />
+        <di:waypoint x="264" y="440" />
+        <di:waypoint x="310" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0k5iu2n_di" bpmnElement="SequenceFlow_0k5iu2n">
+        <di:waypoint x="264" y="545" />
+        <di:waypoint x="264" y="630" />
+        <di:waypoint x="310" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_1yh9tiq_di" bpmnElement="CallActivity_1yh9tiq">
+        <dc:Bounds x="730" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1hfjn79_di" bpmnElement="SequenceFlow_1hfjn79">
+        <di:waypoint x="410" y="440" />
+        <di:waypoint x="440" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_1ixah3o_di" bpmnElement="CallActivity_1ixah3o">
+        <dc:Bounds x="730" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0f36cu2_di" bpmnElement="SequenceFlow_0f36cu2">
+        <di:waypoint x="410" y="630" />
+        <di:waypoint x="440" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1xb5nx1_di" bpmnElement="SequenceFlow_1xb5nx1">
+        <di:waypoint x="830" y="440" />
+        <di:waypoint x="880" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ParallelGateway_15vgf7c_di" bpmnElement="ExclusiveGateway_19ru3hp">
+        <dc:Bounds x="1325" y="505" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_07sgklo_di" bpmnElement="ScriptTask_07sgklo">
+        <dc:Bounds x="930" y="220" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0t0wddg_di" bpmnElement="SequenceFlow_0t0wddg">
+        <di:waypoint x="1030" y="260" />
+        <di:waypoint x="1430" y="260" />
+        <di:waypoint x="1430" y="158" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1r6kuwy_di" bpmnElement="ScriptTask_1r6kuwy">
+        <dc:Bounds x="970" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_05ovikm_di" bpmnElement="SequenceFlow_05ovikm">
+        <di:waypoint x="1070" y="140" />
+        <di:waypoint x="1412" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_17cq3xj_di" bpmnElement="Task_1tv7jy5">
+        <dc:Bounds x="310" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1r2li91_di" bpmnElement="ScriptTask_1r2li91">
+        <dc:Bounds x="440" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0zbd2tq_di" bpmnElement="SequenceFlow_0zbd2tq">
+        <di:waypoint x="540" y="440" />
+        <di:waypoint x="584" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_01n5nmt_di" bpmnElement="Task_1en3luv">
+        <dc:Bounds x="310" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0juh1xy_di" bpmnElement="Task_1g8n8iz">
+        <dc:Bounds x="440" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ax2c4p_di" bpmnElement="SequenceFlow_0ax2c4p">
+        <di:waypoint x="1375" y="530" />
+        <di:waypoint x="1412" y="530" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0stnvp3_di" bpmnElement="ScriptTask_0stnvp3">
+        <dc:Bounds x="310" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1f4o46q_di" bpmnElement="ScriptTask_1f4o46q">
+        <dc:Bounds x="440" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0b28wlb_di" bpmnElement="CallActivity_0b28wlb">
+        <dc:Bounds x="730" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1d48cil_di" bpmnElement="SequenceFlow_1d48cil">
+        <di:waypoint x="410" y="880" />
+        <di:waypoint x="440" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_00dexhy_di" bpmnElement="SequenceFlow_00dexhy">
+        <di:waypoint x="540" y="880" />
+        <di:waypoint x="584" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_08wpvhs_di" bpmnElement="IntermediateCatchEvent_08wpvhs">
+        <dc:Bounds x="138" y="862" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="129" y="905" width="56" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0paqrtx_di" bpmnElement="SequenceFlow_0paqrtx">
+        <di:waypoint x="174" y="880" />
+        <di:waypoint x="310" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0sssiii_di" bpmnElement="ScriptTask_0sssiii">
+        <dc:Bounds x="880" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1me5mt6_di" bpmnElement="ScriptTask_1me5mt6">
+        <dc:Bounds x="1050" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0vrzjir_di" bpmnElement="ScriptTask_0vrzjir">
+        <dc:Bounds x="1210" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_150xio1_di" bpmnElement="SequenceFlow_150xio1">
+        <di:waypoint x="980" y="880" />
+        <di:waypoint x="1050" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_040fu80_di" bpmnElement="SequenceFlow_040fu80">
+        <di:waypoint x="1150" y="880" />
+        <di:waypoint x="1210" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0mls87v_di" bpmnElement="ScriptTask_0mls87v">
+        <dc:Bounds x="880" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xx5bwa_di" bpmnElement="SequenceFlow_0xx5bwa">
+        <di:waypoint x="980" y="440" />
+        <di:waypoint x="1040" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0g8dgo6_di" bpmnElement="ScriptTask_0g8dgo6">
+        <dc:Bounds x="1040" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1sckufj_di" bpmnElement="SequenceFlow_1sckufj">
+        <di:waypoint x="1140" y="440" />
+        <di:waypoint x="1190" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0blxroa_di" bpmnElement="ScriptTask_0blxroa">
+        <dc:Bounds x="1190" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1gkb7iy_di" bpmnElement="SequenceFlow_1gkb7iy">
+        <di:waypoint x="1290" y="440" />
+        <di:waypoint x="1350" y="440" />
+        <di:waypoint x="1350" y="505" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0z9x5uh_di" bpmnElement="ScriptTask_0z9x5uh">
+        <dc:Bounds x="880" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_09197ms_di" bpmnElement="ScriptTask_09197ms">
+        <dc:Bounds x="1040" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_127nizg_di" bpmnElement="ScriptTask_127nizg">
+        <dc:Bounds x="1190" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1l74seh_di" bpmnElement="SequenceFlow_1l74seh">
+        <di:waypoint x="830" y="630" />
+        <di:waypoint x="880" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0jqxxjq_di" bpmnElement="SequenceFlow_0jqxxjq">
+        <di:waypoint x="980" y="630" />
+        <di:waypoint x="1040" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_02qun80_di" bpmnElement="SequenceFlow_02qun80">
+        <di:waypoint x="1140" y="630" />
+        <di:waypoint x="1190" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03zglrh_di" bpmnElement="SequenceFlow_03zglrh">
+        <di:waypoint x="1290" y="630" />
+        <di:waypoint x="1350" y="630" />
+        <di:waypoint x="1350" y="555" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1omynpt_di" bpmnElement="SequenceFlow_1omynpt">
+        <di:waypoint x="830" y="880" />
+        <di:waypoint x="880" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_0elqlhv_di" bpmnElement="EndEvent_0elqlhv">
+        <dc:Bounds x="1412" y="862" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1uti8ls_di" bpmnElement="SequenceFlow_1uti8ls">
+        <di:waypoint x="1310" y="880" />
+        <di:waypoint x="1412" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0gz4vi6_di" bpmnElement="EndEvent_02c8wsp">
+        <dc:Bounds x="1412" y="512" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1392" y="555" width="79" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0s8vhha_di" bpmnElement="ScriptTask_0s8vhha">
+        <dc:Bounds x="584" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0npsyye_di" bpmnElement="SequenceFlow_0npsyye">
+        <di:waypoint x="684" y="440" />
+        <di:waypoint x="730" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0z0ec5b_di" bpmnElement="ScriptTask_0z0ec5b">
+        <dc:Bounds x="584" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0cwbtmr_di" bpmnElement="SequenceFlow_0cwbtmr">
+        <di:waypoint x="684" y="630" />
+        <di:waypoint x="730" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1wffel4_di" bpmnElement="SequenceFlow_1wffel4">
+        <di:waypoint x="540" y="630" />
+        <di:waypoint x="584" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0ci5g6y_di" bpmnElement="ScriptTask_0ci5g6y">
+        <dc:Bounds x="584" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_01isn2q_di" bpmnElement="SequenceFlow_01isn2q">
+        <di:waypoint x="684" y="880" />
+        <di:waypoint x="730" y="880" />
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSIV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSIV2.bpmn
new file mode 100644 (file)
index 0000000..bcb48a6
--- /dev/null
@@ -0,0 +1,233 @@
+<?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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+  <bpmn:process id="DoAllocateNSSIV2" name="DoAllocateNSSIV2" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_0zs8ezi" name="Start">
+      <bpmn:outgoing>SequenceFlow_07xkshs</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="ScriptTask_0n2z0z7" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07xkshs</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0h6mn7j</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07xkshs" sourceRef="StartEvent_0zs8ezi" targetRef="ScriptTask_0n2z0z7" />
+    <bpmn:scriptTask id="ScriptTask_15a7mua" name="send allocate request to NSSMF adapter" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1iw5oad</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1wclf50</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_11w6bb3" name="Is NSSI sharable?">
+      <bpmn:incoming>SequenceFlow_0ib27f2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1iw5oad</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0haiyzv</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="ScriptTask_16zhp9e" name="send modify request to NSSMF adapter" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0haiyzv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ellzst</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0jx00mv">
+      <bpmn:incoming>SequenceFlow_1wclf50</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1ellzst</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0ejdefw</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1iw5oad" name="No" sourceRef="ExclusiveGateway_11w6bb3" targetRef="ScriptTask_15a7mua">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "create")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_1wclf50" sourceRef="ScriptTask_15a7mua" targetRef="ExclusiveGateway_0jx00mv" />
+    <bpmn:sequenceFlow id="SequenceFlow_0haiyzv" name="yes" sourceRef="ExclusiveGateway_11w6bb3" targetRef="ScriptTask_16zhp9e">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "update")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_1ellzst" sourceRef="ScriptTask_16zhp9e" targetRef="ExclusiveGateway_0jx00mv" />
+    <bpmn:sequenceFlow id="SequenceFlow_0h6mn7j" sourceRef="ScriptTask_0n2z0z7" targetRef="ScriptTask_1e7tchy" />
+    <bpmn:scriptTask id="ScriptTask_1e7tchy" name="Prepare NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0h6mn7j</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0ib27f2</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.getNSSTInfo(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0ib27f2" sourceRef="ScriptTask_1e7tchy" targetRef="ExclusiveGateway_11w6bb3" />
+    <bpmn:sequenceFlow id="SequenceFlow_0ejdefw" sourceRef="ExclusiveGateway_0jx00mv" targetRef="Task_1ym947s" />
+    <bpmn:scriptTask id="Task_1ym947s" name="Query NSSI progress from adapter" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0ejdefw</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0gpgxw4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0p9gd2n</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.queryNSSIStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0ki1c4k" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0p9gd2n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ozi7ed</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_0knipxf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+      <bpmn:extensionElements>
+        <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+        <camunda:out source="response" target="CSSOT_dbResponse" />
+        <camunda:in source="CSSOT_taskId" target="taskId" />
+        <camunda:in source="msoRequestId" target="requestId" />
+        <camunda:in source="CSSOT_name" target="taskName" />
+        <camunda:in source="CSSOT_status" target="taskStatus" />
+        <camunda:in source="CSSOT_isManual" target="isManual" />
+        <camunda:in source="CSSOT_paramJson" target="paramJson" />
+        <camunda:in source="CSSOT_requestMethod" target="method" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1ozi7ed</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0hgv9c5</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1ozi7ed" sourceRef="ScriptTask_0ki1c4k" targetRef="CallActivity_0knipxf" />
+    <bpmn:sequenceFlow id="SequenceFlow_0p9gd2n" sourceRef="Task_1ym947s" targetRef="ScriptTask_0ki1c4k" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_11gv703" name="Completed">
+      <bpmn:incoming>SequenceFlow_0hgv9c5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0y5jr25</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_170frn3</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_0hgv9c5" sourceRef="CallActivity_0knipxf" targetRef="ExclusiveGateway_11gv703" />
+    <bpmn:scriptTask id="ScriptTask_1s7bt3s" name="Time delay" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0y5jr25</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0gpgxw4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0y5jr25" name="false" sourceRef="ExclusiveGateway_11gv703" targetRef="ScriptTask_1s7bt3s" />
+    <bpmn:sequenceFlow id="SequenceFlow_0gpgxw4" sourceRef="ScriptTask_1s7bt3s" targetRef="Task_1ym947s" />
+    <bpmn:sequenceFlow id="SequenceFlow_170frn3" sourceRef="ExclusiveGateway_11gv703" targetRef="IntermediateThrowEvent_10xe1qh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "update")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:endEvent id="IntermediateThrowEvent_10xe1qh">
+      <bpmn:incoming>SequenceFlow_170frn3</bpmn:incoming>
+    </bpmn:endEvent>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSIV2">
+      <bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi">
+        <dc:Bounds x="147" y="272" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="152" y="313" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0n2z0z7_di" bpmnElement="ScriptTask_0n2z0z7">
+        <dc:Bounds x="235" y="250" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_07xkshs_di" bpmnElement="SequenceFlow_07xkshs">
+        <di:waypoint x="183" y="290" />
+        <di:waypoint x="235" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_15a7mua_di" bpmnElement="ScriptTask_15a7mua">
+        <dc:Bounds x="660" y="430" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_11w6bb3_di" bpmnElement="ExclusiveGateway_11w6bb3" isMarkerVisible="true">
+        <dc:Bounds x="591" y="265" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="645" y="283" width="89" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_16zhp9e_di" bpmnElement="ScriptTask_16zhp9e">
+        <dc:Bounds x="660" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0jx00mv_di" bpmnElement="ExclusiveGateway_0jx00mv" isMarkerVisible="true">
+        <dc:Bounds x="785" y="265" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1iw5oad_di" bpmnElement="SequenceFlow_1iw5oad">
+        <di:waypoint x="616" y="315" />
+        <di:waypoint x="616" y="470" />
+        <di:waypoint x="660" y="470" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="631" y="393" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1wclf50_di" bpmnElement="SequenceFlow_1wclf50">
+        <di:waypoint x="760" y="470" />
+        <di:waypoint x="810" y="470" />
+        <di:waypoint x="810" y="315" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0haiyzv_di" bpmnElement="SequenceFlow_0haiyzv">
+        <di:waypoint x="616" y="265" />
+        <di:waypoint x="616" y="121" />
+        <di:waypoint x="660" y="121" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="635" y="173" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ellzst_di" bpmnElement="SequenceFlow_1ellzst">
+        <di:waypoint x="760" y="121" />
+        <di:waypoint x="810" y="121" />
+        <di:waypoint x="810" y="265" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0h6mn7j_di" bpmnElement="SequenceFlow_0h6mn7j">
+        <di:waypoint x="335" y="290" />
+        <di:waypoint x="410" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1e7tchy_di" bpmnElement="ScriptTask_1e7tchy">
+        <dc:Bounds x="410" y="250" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ib27f2_di" bpmnElement="SequenceFlow_0ib27f2">
+        <di:waypoint x="510" y="290" />
+        <di:waypoint x="591" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ejdefw_di" bpmnElement="SequenceFlow_0ejdefw">
+        <di:waypoint x="835" y="290" />
+        <di:waypoint x="910" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0bt5d96_di" bpmnElement="Task_1ym947s">
+        <dc:Bounds x="910" y="250" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0ki1c4k_di" bpmnElement="ScriptTask_0ki1c4k">
+        <dc:Bounds x="1090" y="250" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0knipxf_di" bpmnElement="CallActivity_0knipxf">
+        <dc:Bounds x="1238" y="250" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ozi7ed_di" bpmnElement="SequenceFlow_1ozi7ed">
+        <di:waypoint x="1190" y="290" />
+        <di:waypoint x="1238" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0p9gd2n_di" bpmnElement="SequenceFlow_0p9gd2n">
+        <di:waypoint x="1010" y="290" />
+        <di:waypoint x="1090" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ExclusiveGateway_11gv703_di" bpmnElement="ExclusiveGateway_11gv703" isMarkerVisible="true">
+        <dc:Bounds x="1395" y="265" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1393" y="241" width="54" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0hgv9c5_di" bpmnElement="SequenceFlow_0hgv9c5">
+        <di:waypoint x="1338" y="290" />
+        <di:waypoint x="1395" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1s7bt3s_di" bpmnElement="ScriptTask_1s7bt3s">
+        <dc:Bounds x="1370" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0y5jr25_di" bpmnElement="SequenceFlow_0y5jr25">
+        <di:waypoint x="1420" y="315" />
+        <di:waypoint x="1420" y="390" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1401" y="355" width="23" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0gpgxw4_di" bpmnElement="SequenceFlow_0gpgxw4">
+        <di:waypoint x="1370" y="430" />
+        <di:waypoint x="960" y="430" />
+        <di:waypoint x="960" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_170frn3_di" bpmnElement="SequenceFlow_170frn3">
+        <di:waypoint x="1445" y="290" />
+        <di:waypoint x="1522" y="290" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_1q1vntz_di" bpmnElement="IntermediateThrowEvent_10xe1qh">
+        <dc:Bounds x="1522" y="272" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..f488632
--- /dev/null
@@ -0,0 +1,493 @@
+<?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoAllocateTransportNSSI" name="DoAllocateTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Allocate TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="OOF TN NSSI Selection">
+      <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="OofTnNssiSelect" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new TnAllocateNssi()
+css.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1jgtb0y" name="Process OOF Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1cv0wop</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_197cm2e</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.processOofSelection(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Use Existing TN NSSI?" default="SequenceFlow_038lb9m">
+      <bpmn:incoming>SequenceFlow_197cm2e</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="ScriptTask_0l3d1ai" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1t19ips</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0jrclmc</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.processDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_18eld2o" name="Is Allocation Successful?" default="SequenceFlow_1c6ka9h">
+      <bpmn:incoming>SequenceFlow_0mlrlbv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1c6ka9h</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0n4xku8</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="EndEvent_0x406rw">
+      <bpmn:incoming>SequenceFlow_1c6ka9h</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0mlneuw" errorRef="Error_03akl5v" />
+    </bpmn:endEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_06rrcwf</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1xxag1o" name="Prepare Init Service Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def rupScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI started")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection">
+      <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="OofTnNssiSelect" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Allocated TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="sliceServiceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="tnNsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0q7yc2c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1k88aak</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare OOF TN NSSI Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.prepareOofSelection(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0pkvfun" name="Allocate TN NSSI">
+      <bpmn:outgoing>SequenceFlow_1bevt3a</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1vlfclx" name="TnAllocateNssi" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ktwpki" name="Goto Allocate TN NSSI">
+      <bpmn:incoming>SequenceFlow_12t5exy</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_16f2ri9" name="TnAllocateNssi" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:endEvent id="EndEvent_1oouvuh" name="End">
+      <bpmn:incoming>Flow_0pbq5q0</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoCreateTnNssiInstance&#10;" calledElement="DoCreateTnNssiInstance">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="sliceServiceInstanceId" target="sliceServiceInstanceId" />
+        <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+        <camunda:in source="modelUuid" target="modelUuid" />
+        <camunda:in source="sliceServiceInstanceName" target="sliceServiceInstanceName" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="operationId" target="operationId" />
+        <camunda:in source="sliceProfile" target="sliceProfile" />
+        <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" />
+        <camunda:in source="nsiInfo" target="nsiInfo" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="rollbackData" target="rollbackData" />
+        <camunda:out source="rolledBack" target="rolledBack" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" />
+    <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="Activity_187hs2t" targetRef="ScriptTask_1jgtb0y" />
+    <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" />
+    <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="No" sourceRef="ExclusiveGateway_0elbczl" targetRef="IntermediateThrowEvent_0ktwpki">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isOofTnNssiSelected")  == false)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="Yes" sourceRef="ExclusiveGateway_0elbczl" targetRef="Activity_1mh10j4" />
+    <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" />
+    <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" />
+    <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" />
+    <bpmn:sequenceFlow id="SequenceFlow_0n4xku8" name="Yes" sourceRef="ExclusiveGateway_18eld2o" targetRef="ScriptTask_19uxoi8">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="Activity_14an583" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_1xko5pk" />
+    <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" />
+    <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="Activity_187hs2t" />
+    <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" />
+    <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_08wim95" />
+    <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "allocated")
+def runScript = new TnAllocateNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_1mh10j4" name="Prepare Update Resource Oper Status(finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming>
+      <bpmn:outgoing>Flow_1853sgs</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Allocated TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1853sgs" sourceRef="Activity_1mh10j4" targetRef="Activity_124z7q2" />
+    <bpmn:callActivity id="Activity_187hs2t" name="Handle TN NSSI Selection OOF request" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:serviceTask id="Activity_124z7q2" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1853sgs</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pbq5q0</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0pbq5q0" sourceRef="Activity_124z7q2" targetRef="EndEvent_1oouvuh" />
+    <bpmn:serviceTask id="Activity_14an583" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1k88aak</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1k88aak" sourceRef="Activity_14an583" targetRef="ScriptTask_0o2r07o" />
+    <bpmn:serviceTask id="Activity_1xko5pk" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_06rrcwf</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_06rrcwf" sourceRef="Activity_1xko5pk" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_06rrcwf_di" bpmnElement="Flow_06rrcwf">
+        <di:waypoint x="1140" y="680" />
+        <di:waypoint x="1252" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1k88aak_di" bpmnElement="Flow_1k88aak">
+        <di:waypoint x="750" y="121" />
+        <di:waypoint x="850" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pbq5q0_di" bpmnElement="Flow_0pbq5q0">
+        <di:waypoint x="1460" y="500" />
+        <di:waypoint x="1562" y="500" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1853sgs_di" bpmnElement="Flow_1853sgs">
+        <di:waypoint x="1270" y="500" />
+        <di:waypoint x="1360" y="500" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="770" y="680" />
+        <di:waypoint x="860" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc">
+        <di:waypoint x="1420" y="121" />
+        <di:waypoint x="1532" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
+        <di:waypoint x="214" y="330" />
+        <di:waypoint x="320" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
+        <di:waypoint x="228" y="680" />
+        <di:waypoint x="320" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
+        <di:waypoint x="420" y="330" />
+        <di:waypoint x="540" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
+        <di:waypoint x="950" y="121" />
+        <di:waypoint x="1090" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="960" y="680" />
+        <di:waypoint x="1040" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
+        <di:waypoint x="568" y="121" />
+        <di:waypoint x="650" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8">
+        <di:waypoint x="538" y="680" />
+        <di:waypoint x="670" y="680" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="585" y="662" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h">
+        <di:waypoint x="513" y="705" />
+        <di:waypoint x="513" y="762" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="522" y="705" width="14" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv">
+        <di:waypoint x="420" y="680" />
+        <di:waypoint x="488" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips">
+        <di:waypoint x="1190" y="121" />
+        <di:waypoint x="1320" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
+        <di:waypoint x="1090" y="355" />
+        <di:waypoint x="1090" y="500" />
+        <di:waypoint x="1170" y="500" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1100" y="413" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
+        <di:waypoint x="1115" y="330" />
+        <di:waypoint x="1292" y="330" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1183" y="313" width="14" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
+        <di:waypoint x="890" y="330" />
+        <di:waypoint x="1065" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
+        <di:waypoint x="640" y="330" />
+        <di:waypoint x="790" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="468" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="146" width="86" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0vilb24_di" bpmnElement="IntermediateCatchEvent_0vilb24">
+        <dc:Bounds x="178" y="312" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="162" y="355" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y">
+        <dc:Bounds x="790" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true">
+        <dc:Bounds x="1065" y="305" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1050" y="276" width="79" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
+        <dc:Bounds x="1320" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_18eld2o_di" bpmnElement="ExclusiveGateway_18eld2o" isMarkerVisible="true">
+        <dc:Bounds x="488" y="655" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="482.5" y="617.5" width="61" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw">
+        <dc:Bounds x="495" y="762" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1252" y="662" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1260" y="705" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
+        <dc:Bounds x="468" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9">
+        <dc:Bounds x="1532" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1522" y="144" width="74" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="860" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz">
+        <dc:Bounds x="1090" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o">
+        <dc:Bounds x="850" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95">
+        <dc:Bounds x="320" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun">
+        <dc:Bounds x="192" y="662" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="173" y="705" width="86" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki">
+        <dc:Bounds x="1292" y="312" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1280" y="353" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
+        <dc:Bounds x="1562" y="482" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1570" y="525" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i">
+        <dc:Bounds x="320" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="670" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1mh10j4_di" bpmnElement="Activity_1mh10j4">
+        <dc:Bounds x="1170" y="460" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_187hs2t_di" bpmnElement="Activity_187hs2t">
+        <dc:Bounds x="540" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_124z7q2_di" bpmnElement="Activity_124z7q2">
+        <dc:Bounds x="1360" y="460" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14an583_di" bpmnElement="Activity_14an583">
+        <dc:Bounds x="650" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xko5pk_di" bpmnElement="Activity_1xko5pk">
+        <dc:Bounds x="1040" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOptionV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOptionV2.bpmn
new file mode 100644 (file)
index 0000000..5d9e53a
--- /dev/null
@@ -0,0 +1,563 @@
+<?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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+  <bpmn:process id="DoCreateSliceServiceOptionV2" name="DoCreateSliceServiceOptionV2" isExecutable="true">
+    <bpmn:parallelGateway id="ParallelGateway_0f11kcw">
+      <bpmn:incoming>SequenceFlow_17otbuu</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_00t0340</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_06uu0eh</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_09see8v</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_14s7fck</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1c374y2</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:parallelGateway id="ParallelGateway_05o7mbp">
+      <bpmn:incoming>SequenceFlow_04avf98</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_00xa5wa</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_064p1n6</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1a699ly</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:scriptTask id="ScriptTask_0sznvim" name="Prepare OOF Select NSI options request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_16qt6r2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_175xozh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.preNSIRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1sik00k" name="Query TN Sub-net capability" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_09see8v</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_04avf98</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.queryTNSubnetCapability(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1sukxzw" name="Query CN Sub-net capability" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_14s7fck</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_00xa5wa</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.queryCNSubnetCapability(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_02u3dmq" name="Query AN Sub-net capability" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1c374y2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_064p1n6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.queryANSubnetCapability(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_04avf98" sourceRef="ScriptTask_1sik00k" targetRef="ParallelGateway_05o7mbp" />
+    <bpmn:sequenceFlow id="SequenceFlow_00xa5wa" sourceRef="ScriptTask_1sukxzw" targetRef="ParallelGateway_05o7mbp" />
+    <bpmn:sequenceFlow id="SequenceFlow_064p1n6" sourceRef="ScriptTask_02u3dmq" targetRef="ParallelGateway_05o7mbp" />
+    <bpmn:sequenceFlow id="SequenceFlow_1a699ly" sourceRef="ParallelGateway_05o7mbp" targetRef="Task_1kqbsvd" />
+    <bpmn:scriptTask id="ScriptTask_11rb2ju" name="prepare NST decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_00t0340</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1kzy63m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.prepareDecomposeNST(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_0c567r4" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="nstServiceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="nstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1kzy63m</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1t317y2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="ScriptTask_0z0dwk2" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1t317y2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1rwl882</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0f0rh4w" name="prepare NSST decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_06uu0eh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1dtfpqp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.prepareNSTDecompose(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_1tmbgfs" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="nsstServiceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="nsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1dtfpqp</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0fdqj9b</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="ScriptTask_0m6v98c" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0fdqj9b</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0d2lpv3</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1kzy63m" sourceRef="ScriptTask_11rb2ju" targetRef="CallActivity_0c567r4" />
+    <bpmn:sequenceFlow id="SequenceFlow_1t317y2" sourceRef="CallActivity_0c567r4" targetRef="ScriptTask_0z0dwk2" />
+    <bpmn:sequenceFlow id="SequenceFlow_1dtfpqp" sourceRef="ScriptTask_0f0rh4w" targetRef="CallActivity_1tmbgfs" />
+    <bpmn:sequenceFlow id="SequenceFlow_0fdqj9b" sourceRef="CallActivity_1tmbgfs" targetRef="ScriptTask_0m6v98c" />
+    <bpmn:sequenceFlow id="SequenceFlow_1rwl882" sourceRef="ScriptTask_0z0dwk2" targetRef="ParallelGateway_1v1unh1" />
+    <bpmn:sequenceFlow id="SequenceFlow_0d2lpv3" sourceRef="ScriptTask_0m6v98c" targetRef="ParallelGateway_1v1unh1" />
+    <bpmn:callActivity id="CallActivity_15kmmuf" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nsiSelectionUrl" target="apiPath" />
+        <camunda:in source="nsiSelection_correlator" target="correlator" />
+        <camunda:in source="nsiSelection_messageType" target="messageType" />
+        <camunda:in source="nsiSelection_timeout" target="timeout" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nsiSelection_oofResponse" />
+        <camunda:in source="nsiSelection_oofRequest" target="oofRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_175xozh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_188g03z</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_175xozh" sourceRef="ScriptTask_0sznvim" targetRef="CallActivity_15kmmuf" />
+    <bpmn:scriptTask id="ScriptTask_0woac2j" name="Process OOF response " scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_188g03z</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17emrud</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processNSIResp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_188g03z" sourceRef="CallActivity_15kmmuf" targetRef="ScriptTask_0woac2j" />
+    <bpmn:sequenceFlow id="SequenceFlow_17emrud" sourceRef="ScriptTask_0woac2j" targetRef="EndEvent_15dimzx" />
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0pstvd4" name=" Select NSSI ">
+      <bpmn:outgoing>SequenceFlow_1sg6mqd</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1slqdh4" name="SelectNSSI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:parallelGateway id="ParallelGateway_05zg916">
+      <bpmn:incoming>SequenceFlow_1sg6mqd</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:parallelGateway id="ParallelGateway_06a2n9u">
+      <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSST Selection OOF request" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nstSelectionUrl" target="apiPath" />
+        <camunda:in source="nstSelection_correlator" target="correlator" />
+        <camunda:in source="nstSelection_messageType" target="messageType" />
+        <camunda:in source="nstSelection_timeout" target="timeout" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" />
+        <camunda:in source="nstSelection_oofRequest" target="oofRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0abqxa1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1tqg26p</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1sg6mqd" sourceRef="IntermediateCatchEvent_0pstvd4" targetRef="ParallelGateway_05zg916" />
+    <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" />
+    <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" />
+    <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" />
+    <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" />
+    <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" />
+    <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" />
+    <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" />
+    <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" />
+    <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" />
+    <bpmn:intermediateThrowEvent id="EndEvent_15dimzx" name="Goto Select NSSI ">
+      <bpmn:incoming>SequenceFlow_17emrud</bpmn:incoming>
+      <bpmn:linkEventDefinition name="SelectNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:endEvent id="EndEvent_0p0cjhl">
+      <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:parallelGateway id="ParallelGateway_1v1unh1">
+      <bpmn:incoming>SequenceFlow_1rwl882</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0d2lpv3</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_06t1dq5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_16qt6r2</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_16qt6r2" sourceRef="ParallelGateway_1v1unh1" targetRef="ScriptTask_0sznvim" />
+    <bpmn:startEvent id="StartEvent_0mwlirs" name="Start">
+      <bpmn:outgoing>SequenceFlow_1fuwy35</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="ScriptTask_0w34e57" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1fuwy35</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17otbuu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1fuwy35" sourceRef="StartEvent_0mwlirs" targetRef="ScriptTask_0w34e57" />
+    <bpmn:sequenceFlow id="SequenceFlow_17otbuu" sourceRef="ScriptTask_0w34e57" targetRef="ParallelGateway_0f11kcw" />
+    <bpmn:sequenceFlow id="SequenceFlow_00t0340" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_11rb2ju" />
+    <bpmn:sequenceFlow id="SequenceFlow_06uu0eh" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_0f0rh4w" />
+    <bpmn:sequenceFlow id="SequenceFlow_09see8v" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_1sik00k" />
+    <bpmn:sequenceFlow id="SequenceFlow_14s7fck" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_1sukxzw" />
+    <bpmn:sequenceFlow id="SequenceFlow_1c374y2" sourceRef="ParallelGateway_0f11kcw" targetRef="ScriptTask_02u3dmq" />
+    <bpmn:scriptTask id="CallActivity_1vzxvna" name="TN NSSMF supports NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_05250mp</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_14rhmx9</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.getNSSISelectionCap4TN(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="CallActivity_0melx8d" name="CN NSSMF supports NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0euwvgf</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_103oxyw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.getNSSISelectionCap4CN(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="CallActivity_0otry7e" name="AN NSSMF supports NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0il5j01</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0aasemn</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.getNSSISelectionCap4AN(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_06t1dq5" sourceRef="Task_1kqbsvd" targetRef="ParallelGateway_1v1unh1" />
+    <bpmn:scriptTask id="Task_1kqbsvd" name="handle sub-net capability info" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1a699ly</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_06t1dq5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.handleSubnetCapabilityResp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_1m9qoo3" name="Prepare NSSI Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_126j77n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0abqxa1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.preNSSIRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_00nfg5x" name="Process NSST Solutions" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1tqg26p</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1i3j8c3</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processNSSIResp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i">
+      <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "update")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" />
+    <bpmn:sequenceFlow id="SequenceFlow_1i3j8c3" sourceRef="Task_00nfg5x" targetRef="Task_1jyj2vs" />
+    <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" />
+    <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1i3j8c3</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.handleNssiSelect(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:group id="Group_1k2kt9q" categoryValueRef="CategoryValue_1eh1etw" />
+    <bpmn:group id="Group_19fk2vp" categoryValueRef="CategoryValue_1x9qkyq" />
+    <bpmn:group id="Group_01yft6a" categoryValueRef="CategoryValue_1nwi9c3" />
+  </bpmn:process>
+  <bpmn:category id="Category_0s5hs8l">
+    <bpmn:categoryValue id="CategoryValue_1eh1etw" value="subnetCapabilities" />
+  </bpmn:category>
+  <bpmn:category id="Category_1ahkzyt">
+    <bpmn:categoryValue id="CategoryValue_1x9qkyq" value="nst -&#62; NSTInfo" />
+  </bpmn:category>
+  <bpmn:category id="Category_0ne04nd">
+    <bpmn:categoryValue id="CategoryValue_1nwi9c3" value="nsst -&#62; NSSTInfo" />
+  </bpmn:category>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOptionV2">
+      <bpmndi:BPMNShape id="ParallelGateway_0f11kcw_di" bpmnElement="ParallelGateway_0f11kcw">
+        <dc:Bounds x="355" y="525" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ParallelGateway_05o7mbp_di" bpmnElement="ParallelGateway_05o7mbp">
+        <dc:Bounds x="697" y="215" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0sznvim_di" bpmnElement="ScriptTask_0sznvim">
+        <dc:Bounds x="1110" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1sik00k_di" bpmnElement="ScriptTask_1sik00k">
+        <dc:Bounds x="520" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1sukxzw_di" bpmnElement="ScriptTask_1sukxzw">
+        <dc:Bounds x="520" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_02u3dmq_di" bpmnElement="ScriptTask_02u3dmq">
+        <dc:Bounds x="520" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_04avf98_di" bpmnElement="SequenceFlow_04avf98">
+        <di:waypoint x="620" y="130" />
+        <di:waypoint x="722" y="130" />
+        <di:waypoint x="722" y="215" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_00xa5wa_di" bpmnElement="SequenceFlow_00xa5wa">
+        <di:waypoint x="620" y="240" />
+        <di:waypoint x="697" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_064p1n6_di" bpmnElement="SequenceFlow_064p1n6">
+        <di:waypoint x="620" y="350" />
+        <di:waypoint x="722" y="350" />
+        <di:waypoint x="722" y="265" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1a699ly_di" bpmnElement="SequenceFlow_1a699ly">
+        <di:waypoint x="747" y="240" />
+        <di:waypoint x="820" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Group_1k2kt9q_di" bpmnElement="Group_1k2kt9q">
+        <dc:Bounds x="487" y="77" width="485" height="325" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="739" y="78" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju">
+        <dc:Bounds x="520" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0c567r4_di" bpmnElement="CallActivity_0c567r4">
+        <dc:Bounds x="660" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0z0dwk2_di" bpmnElement="ScriptTask_0z0dwk2">
+        <dc:Bounds x="820" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0f0rh4w_di" bpmnElement="ScriptTask_0f0rh4w">
+        <dc:Bounds x="520" y="740" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_1tmbgfs_di" bpmnElement="CallActivity_1tmbgfs">
+        <dc:Bounds x="660" y="740" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0m6v98c_di" bpmnElement="ScriptTask_0m6v98c">
+        <dc:Bounds x="820" y="740" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1kzy63m_di" bpmnElement="SequenceFlow_1kzy63m">
+        <di:waypoint x="620" y="550" />
+        <di:waypoint x="660" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1t317y2_di" bpmnElement="SequenceFlow_1t317y2">
+        <di:waypoint x="760" y="550" />
+        <di:waypoint x="820" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1dtfpqp_di" bpmnElement="SequenceFlow_1dtfpqp">
+        <di:waypoint x="620" y="780" />
+        <di:waypoint x="660" y="780" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0fdqj9b_di" bpmnElement="SequenceFlow_0fdqj9b">
+        <di:waypoint x="760" y="780" />
+        <di:waypoint x="820" y="780" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1rwl882_di" bpmnElement="SequenceFlow_1rwl882">
+        <di:waypoint x="920" y="550" />
+        <di:waypoint x="995" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0d2lpv3_di" bpmnElement="SequenceFlow_0d2lpv3">
+        <di:waypoint x="920" y="780" />
+        <di:waypoint x="1020" y="780" />
+        <di:waypoint x="1020" y="575" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_15kmmuf_di" bpmnElement="CallActivity_15kmmuf">
+        <dc:Bounds x="1280" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_175xozh_di" bpmnElement="SequenceFlow_175xozh">
+        <di:waypoint x="1210" y="550" />
+        <di:waypoint x="1280" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0woac2j_di" bpmnElement="ScriptTask_0woac2j">
+        <dc:Bounds x="1420" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_188g03z_di" bpmnElement="SequenceFlow_188g03z">
+        <di:waypoint x="1380" y="550" />
+        <di:waypoint x="1420" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Group_19fk2vp_di" bpmnElement="Group_19fk2vp">
+        <dc:Bounds x="495" y="450" width="453" height="180" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="686" y="457" width="72" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_17emrud_di" bpmnElement="SequenceFlow_17emrud">
+        <di:waypoint x="1520" y="550" />
+        <di:waypoint x="1562" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0pstvd4_di" bpmnElement="IntermediateCatchEvent_0pstvd4">
+        <dc:Bounds x="198" y="1202" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="191" y="1245" width="60" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916">
+        <dc:Bounds x="335" y="1195" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u">
+        <dc:Bounds x="675" y="1195" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0">
+        <dc:Bounds x="1200" y="1040" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1sg6mqd_di" bpmnElement="SequenceFlow_1sg6mqd">
+        <di:waypoint x="234" y="1220" />
+        <di:waypoint x="335" y="1220" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp">
+        <di:waypoint x="360" y="1195" />
+        <di:waypoint x="360" y="1080" />
+        <di:waypoint x="500" y="1080" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9">
+        <di:waypoint x="600" y="1080" />
+        <di:waypoint x="700" y="1080" />
+        <di:waypoint x="700" y="1195" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf">
+        <di:waypoint x="385" y="1220" />
+        <di:waypoint x="500" y="1220" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw">
+        <di:waypoint x="600" y="1220" />
+        <di:waypoint x="675" y="1220" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01">
+        <di:waypoint x="360" y="1245" />
+        <di:waypoint x="360" y="1340" />
+        <di:waypoint x="500" y="1340" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn">
+        <di:waypoint x="600" y="1340" />
+        <di:waypoint x="700" y="1340" />
+        <di:waypoint x="700" y="1245" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d">
+        <di:waypoint x="725" y="1220" />
+        <di:waypoint x="800" y="1220" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1">
+        <di:waypoint x="1250" y="1180" />
+        <di:waypoint x="1250" y="1120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p">
+        <di:waypoint x="1200" y="1080" />
+        <di:waypoint x="900" y="1080" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0ubqlvg_di" bpmnElement="EndEvent_15dimzx">
+        <dc:Bounds x="1562" y="532" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1539" y="575" width="87" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl">
+        <dc:Bounds x="1232" y="1322" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Group_01yft6a_di" bpmnElement="Group_01yft6a">
+        <dc:Bounds x="495" y="690" width="453" height="180" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="680" y="697" width="85" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ParallelGateway_1v1unh1_di" bpmnElement="ParallelGateway_1v1unh1">
+        <dc:Bounds x="995" y="525" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_16qt6r2_di" bpmnElement="SequenceFlow_16qt6r2">
+        <di:waypoint x="1045" y="550" />
+        <di:waypoint x="1110" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs">
+        <dc:Bounds x="162" y="532" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="169" y="568" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0w34e57_di" bpmnElement="ScriptTask_0w34e57">
+        <dc:Bounds x="230" y="510" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fuwy35_di" bpmnElement="SequenceFlow_1fuwy35">
+        <di:waypoint x="198" y="550" />
+        <di:waypoint x="230" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_17otbuu_di" bpmnElement="SequenceFlow_17otbuu">
+        <di:waypoint x="330" y="550" />
+        <di:waypoint x="355" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_00t0340_di" bpmnElement="SequenceFlow_00t0340">
+        <di:waypoint x="405" y="550" />
+        <di:waypoint x="520" y="550" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_06uu0eh_di" bpmnElement="SequenceFlow_06uu0eh">
+        <di:waypoint x="380" y="575" />
+        <di:waypoint x="380" y="780" />
+        <di:waypoint x="520" y="780" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_09see8v_di" bpmnElement="SequenceFlow_09see8v">
+        <di:waypoint x="380" y="525" />
+        <di:waypoint x="380" y="130" />
+        <di:waypoint x="520" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_14s7fck_di" bpmnElement="SequenceFlow_14s7fck">
+        <di:waypoint x="380" y="525" />
+        <di:waypoint x="380" y="240" />
+        <di:waypoint x="520" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1c374y2_di" bpmnElement="SequenceFlow_1c374y2">
+        <di:waypoint x="380" y="525" />
+        <di:waypoint x="380" y="350" />
+        <di:waypoint x="520" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1anc3ln_di" bpmnElement="CallActivity_1vzxvna">
+        <dc:Bounds x="500" y="1040" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1xgkaqi_di" bpmnElement="CallActivity_0melx8d">
+        <dc:Bounds x="500" y="1180" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_11y7ba5_di" bpmnElement="CallActivity_0otry7e">
+        <dc:Bounds x="500" y="1300" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_06t1dq5_di" bpmnElement="SequenceFlow_06t1dq5">
+        <di:waypoint x="920" y="240" />
+        <di:waypoint x="1020" y="240" />
+        <di:waypoint x="1020" y="525" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1xkxr0x_di" bpmnElement="Task_1kqbsvd">
+        <dc:Bounds x="820" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1icyh1a_di" bpmnElement="Task_1m9qoo3">
+        <dc:Bounds x="1200" y="1180" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x">
+        <dc:Bounds x="800" y="1040" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true">
+        <dc:Bounds x="1025" y="1195" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1008" y="1183" width="85" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n">
+        <di:waypoint x="1075" y="1220" />
+        <di:waypoint x="1200" y="1220" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1129" y="1202" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i">
+        <di:waypoint x="1050" y="1245" />
+        <di:waypoint x="1050" y="1340" />
+        <di:waypoint x="1232" y="1340" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1i3j8c3_di" bpmnElement="SequenceFlow_1i3j8c3">
+        <di:waypoint x="850" y="1120" />
+        <di:waypoint x="850" y="1180" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz">
+        <di:waypoint x="900" y="1220" />
+        <di:waypoint x="1025" y="1220" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs">
+        <dc:Bounds x="800" y="1180" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn
new file mode 100644 (file)
index 0000000..e9cbbb7
--- /dev/null
@@ -0,0 +1,179 @@
+<?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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoCreateTnNssiInstance" name="DoCreateTnNssiInstance" isExecutable="true">
+    <bpmn:startEvent id="allocateTnNssi_StartEvent" name="allocateTnNssi_StartEvent">
+      <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateTnNssi_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" />
+    <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="instantiate_NSTask" name="create Service Instance in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.createServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Activity_16luyg1" targetRef="Event_1rsf7yb" />
+    <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="Activity_08tw2di" />
+    <bpmn:scriptTask id="ScriptTask_18rzwzb" name="Create Allottedsource in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_106ei42</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17u69c4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.createAllottedResource(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Event_1a9swwa" />
+    <bpmn:intermediateCatchEvent id="Event_0l9vk9p" name="Start SDNC Operation">
+      <bpmn:outgoing>Flow_1c8zr59</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0uwmpn2" name="SdncOperation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_0eh82ds" name="PreProcess SDNC Allocate TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1c8zr59</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pko5tm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.preprocessSdncAllocateTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1fs2182" name="Call SDNC Adapter: Allocate TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <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="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0pko5tm</bpmn:incoming>
+      <bpmn:outgoing>Flow_11kadz7</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_16luyg1" name="Postprocess SDNC Allocate TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_11kadz7</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1c8zr59" name="" sourceRef="Event_0l9vk9p" targetRef="Activity_0eh82ds" />
+    <bpmn:sequenceFlow id="Flow_0pko5tm" name="" sourceRef="Activity_0eh82ds" targetRef="Activity_1fs2182" />
+    <bpmn:sequenceFlow id="Flow_11kadz7" name="" sourceRef="Activity_1fs2182" targetRef="Activity_16luyg1" />
+    <bpmn:endEvent id="Event_1rsf7yb">
+      <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:intermediateThrowEvent id="Event_1a9swwa" name="Goto SDNC operation">
+      <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1skl6p7" name="SdncOperation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_08tw2di" name="create Slice Profile in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming>
+      <bpmn:outgoing>Flow_106ei42</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.createSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_106ei42" sourceRef="Activity_08tw2di" targetRef="ScriptTask_18rzwzb" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateTnNssiInstance">
+      <bpmndi:BPMNEdge id="Flow_11kadz7_di" bpmnElement="Flow_11kadz7">
+        <di:waypoint x="610" y="375" />
+        <di:waypoint x="719" y="375" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pko5tm_di" bpmnElement="Flow_0pko5tm">
+        <di:waypoint x="420" y="375" />
+        <di:waypoint x="489" y="375" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1c8zr59_di" bpmnElement="Flow_1c8zr59">
+        <di:waypoint x="211" y="375" />
+        <di:waypoint x="299" y="375" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4">
+        <di:waypoint x="930" y="129" />
+        <di:waypoint x="1102" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl">
+        <di:waypoint x="574" y="129" />
+        <di:waypoint x="650" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
+        <di:waypoint x="840" y="375" />
+        <di:waypoint x="972" y="375" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="631" y="108" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+        <di:waypoint x="393" y="129" />
+        <di:waypoint x="474" y="129" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="436" y="108" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+        <di:waypoint x="211" y="129" />
+        <di:waypoint x="251" y="129" />
+        <di:waypoint x="251" y="129" />
+        <di:waypoint x="293" y="129" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="266" y="123" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_106ei42_di" bpmnElement="Flow_106ei42">
+        <di:waypoint x="750" y="129" />
+        <di:waypoint x="830" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateTnNssi_StartEvent">
+        <dc:Bounds x="175" y="111" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="153" y="147" width="86" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+        <dc:Bounds x="293" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
+        <dc:Bounds x="474" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0l9vk9p_di" bpmnElement="Event_0l9vk9p">
+        <dc:Bounds x="175" y="357" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="165" y="400" width="58" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0eh82ds_di" bpmnElement="Activity_0eh82ds">
+        <dc:Bounds x="299" y="328" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1fs2182_di" bpmnElement="Activity_1fs2182">
+        <dc:Bounds x="489" y="328" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16luyg1_di" bpmnElement="Activity_16luyg1">
+        <dc:Bounds x="719" y="328" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1rsf7yb_di" bpmnElement="Event_1rsf7yb">
+        <dc:Bounds x="972" y="357" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1a9swwa_di" bpmnElement="Event_1a9swwa">
+        <dc:Bounds x="1102" y="111" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1093" y="154" width="59" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb">
+        <dc:Bounds x="830" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08tw2di_di" bpmnElement="Activity_08tw2di">
+        <dc:Bounds x="650" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..5e4b730
--- /dev/null
@@ -0,0 +1,1226 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_17amn3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoDeallocateAccessNSSI" name="DoDeallocateAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="Event_0seox25" name="Start">
+      <bpmn:outgoing>Flow_14g5p2j</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="Flow_14g5p2j" sourceRef="Event_0seox25" targetRef="Activity_00sen5i" />
+    <bpmn:scriptTask id="Activity_00sen5i" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_14g5p2j</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hm17vz</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1hm17vz" sourceRef="Activity_00sen5i" targetRef="Activity_1i58rru" />
+    <bpmn:sequenceFlow id="Flow_0kt6k2i" sourceRef="Activity_1i58rru" targetRef="Activity_0kpwy97" />
+    <bpmn:sequenceFlow id="Flow_08ncj77" sourceRef="Activity_0kpwy97" targetRef="Activity_1v9avqp" />
+    <bpmn:exclusiveGateway id="Gateway_05fdvbz" name="Terminate AN NSSi ?" default="Flow_0m12xsi">
+      <bpmn:incoming>Flow_150eq0z</bpmn:incoming>
+      <bpmn:outgoing>Flow_12fyi2n</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0m12xsi</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_150eq0z" sourceRef="Activity_1v9avqp" targetRef="Gateway_05fdvbz" />
+    <bpmn:sequenceFlow id="Flow_12fyi2n" name="Yes" sourceRef="Gateway_05fdvbz" targetRef="Activity_0hpe14n">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("terminateAnNSSI") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0m3x1ra" sourceRef="Activity_0hpe14n" targetRef="Activity_0gzrekf" />
+    <bpmn:sequenceFlow id="Flow_1o2mo3u" sourceRef="Activity_0gzrekf" targetRef="Gateway_1ypyzn3" />
+    <bpmn:exclusiveGateway id="Gateway_1ypyzn3" default="Flow_16hk034">
+      <bpmn:incoming>Flow_1o2mo3u</bpmn:incoming>
+      <bpmn:outgoing>Flow_02jtaed</bpmn:outgoing>
+      <bpmn:outgoing>Flow_16hk034</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_02jtaed" name="Yes" sourceRef="Gateway_1ypyzn3" targetRef="Activity_0szls0v">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("terminateAnNfNSSI") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_16hk034" name="No" sourceRef="Gateway_1ypyzn3" targetRef="Activity_0umktii" />
+    <bpmn:sequenceFlow id="Flow_1she7i5" sourceRef="Activity_0szls0v" targetRef="Activity_0tbndh6" />
+    <bpmn:intermediateThrowEvent id="Event_0vthuwp" name="Goto Terminate TN FH/MH NSSI">
+      <bpmn:incoming>Flow_1lfvp5s</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0dpa9td" name="TerminateTnNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_0opsm2p" name="TN FH/MH Termination">
+      <bpmn:outgoing>Flow_0cj22bs</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1gactc9" name="TerminateTnNSSI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0cj22bs" sourceRef="Event_0opsm2p" targetRef="Activity_0uul9fb" />
+    <bpmn:sequenceFlow id="Flow_0412ven" sourceRef="Activity_0qho4pw" targetRef="Activity_03zg1pp" />
+    <bpmn:sequenceFlow id="Flow_0tlog6y" sourceRef="Activity_03zg1pp" targetRef="Activity_1ri9jrn" />
+    <bpmn:sequenceFlow id="Flow_1lfvp5s" sourceRef="Activity_1v1ra2k" targetRef="Event_0vthuwp" />
+    <bpmn:scriptTask id="Activity_1i58rru" name="Fetch Related NSSI and Slice profile details" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1hm17vz</bpmn:incoming>
+      <bpmn:outgoing>Flow_0kt6k2i</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.getRelatedInstances(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0kpwy97" name="Prepare AN NSSI Termination request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0kt6k2i</bpmn:incoming>
+      <bpmn:outgoing>Flow_08ncj77</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareOOFAnNssiTerminationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1v9avqp" name="Call OOF for AN NSSI Termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_08ncj77</bpmn:incoming>
+      <bpmn:outgoing>Flow_150eq0z</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.performOofAnNSSITerminationCall(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0hpe14n" name="Prepare OOF Terminate RAN NF NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_12fyi2n</bpmn:incoming>
+      <bpmn:outgoing>Flow_0m3x1ra</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareOOFAnNfNssiTerminationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0gzrekf" name="Call OOF flow for AN NF termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0m3x1ra</bpmn:incoming>
+      <bpmn:outgoing>Flow_1o2mo3u</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.performOofAnNfNSSITerminationCall(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateThrowEvent id="Event_18fpd51" name="Goto Terminate TN FH/MH NSSI">
+      <bpmn:incoming>Flow_1x4e0k3</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_07j10pb" name="TerminateTnNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_1v1ra2k" name="Delete RAN NF NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0hdpgak</bpmn:incoming>
+      <bpmn:outgoing>Flow_1lfvp5s</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deallocateAnNfNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_05frw6w" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1bgguw0</bpmn:incoming>
+      <bpmn:outgoing>Flow_1x4e0k3</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1bgguw0" sourceRef="Activity_17w3onz" targetRef="Activity_05frw6w" />
+    <bpmn:sequenceFlow id="Flow_1x4e0k3" sourceRef="Activity_05frw6w" targetRef="Event_18fpd51" />
+    <bpmn:scriptTask id="Activity_17w3onz" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0vcn5tl</bpmn:incoming>
+      <bpmn:outgoing>Flow_1bgguw0</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI deallocated")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1irtrgt" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0hlt6jq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1pm77xu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI deleted")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1vyon97" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1pm77xu</bpmn:incoming>
+      <bpmn:outgoing>Flow_0hdpgak</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1pm77xu" sourceRef="Activity_1irtrgt" targetRef="Activity_1vyon97" />
+    <bpmn:sequenceFlow id="Flow_0hdpgak" sourceRef="Activity_1vyon97" targetRef="Activity_1v1ra2k" />
+    <bpmn:scriptTask id="Activity_1w9w7a5" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0azlxam</bpmn:incoming>
+      <bpmn:outgoing>Flow_1njlj9z</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+String responseDescriptor = execution.getVariable("an_responseDescriptor")
+
+deallocator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1dyluu0" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1nh3x4j</bpmn:incoming>
+      <bpmn:outgoing>Flow_1g9lfjr</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"finished","100","Deallocated successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1x2fc4q" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1g9lfjr</bpmn:incoming>
+      <bpmn:outgoing>Flow_04bem88</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1g9lfjr" sourceRef="Activity_1dyluu0" targetRef="Activity_1x2fc4q" />
+    <bpmn:scriptTask id="Activity_0wlygp0" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0m12xsi</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xqtf63</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","20","callingmodifyNSSI modifyAction-deallocate")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1e1s439" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1xqtf63</bpmn:incoming>
+      <bpmn:outgoing>Flow_1s5fdmz</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1xqtf63" sourceRef="Activity_0wlygp0" targetRef="Activity_1e1s439" />
+    <bpmn:sequenceFlow id="Flow_0m12xsi" sourceRef="Gateway_05fdvbz" targetRef="Activity_0wlygp0" />
+    <bpmn:scriptTask id="Activity_1ih5cjh" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_07m650f</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ib3uzg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","60","TN-FH terminated")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1clwk2x" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ib3uzg</bpmn:incoming>
+      <bpmn:outgoing>Flow_15bkzm7</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ib3uzg" sourceRef="Activity_1ih5cjh" targetRef="Activity_1clwk2x" />
+    <bpmn:sequenceFlow id="Flow_15bkzm7" sourceRef="Activity_1clwk2x" targetRef="Activity_114fx71" />
+    <bpmn:sequenceFlow id="Flow_1nh3x4j" sourceRef="Activity_1ri9jrn" targetRef="Activity_1dyluu0" />
+    <bpmn:endEvent id="Event_19tcky7">
+      <bpmn:incoming>Flow_04bem88</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_04bem88" sourceRef="Activity_1x2fc4q" targetRef="Event_19tcky7" />
+    <bpmn:scriptTask id="Activity_0uul9fb" name="Call NSSMF adapter for TN_FH NSSI Termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cj22bs</bpmn:incoming>
+      <bpmn:outgoing>Flow_0x1wi2t</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.terminateTNFHNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_114fx71" name="Do TN_MH NSSI Termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_15bkzm7</bpmn:incoming>
+      <bpmn:outgoing>Flow_04coe09</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.terminateTNMHNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:subProcess id="Activity_0qbd3cz" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_13wl9ag">
+        <bpmn:outgoing>Flow_1q1450g</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1z0jo5h" errorRef="Error_0i5gql0" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_0ugnt78">
+        <bpmn:incoming>Flow_035ivcv</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1mzoss1" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0nsc2oc</bpmn:incoming>
+        <bpmn:outgoing>Flow_035ivcv</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_035ivcv" sourceRef="Activity_1mzoss1" targetRef="Event_0ugnt78" />
+      <bpmn:serviceTask id="Activity_055w5hr" name="Update Resource Operation Status">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                  <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>Flow_0alqcat</bpmn:incoming>
+        <bpmn:outgoing>Flow_0nsc2oc</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:scriptTask id="Activity_1nr7xyr" name="Update Job status" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1q1450g</bpmn:incoming>
+        <bpmn:outgoing>Flow_0alqcat</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"failed","0","Job Failed")</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_0alqcat" sourceRef="Activity_1nr7xyr" targetRef="Activity_055w5hr" />
+      <bpmn:sequenceFlow id="Flow_1q1450g" sourceRef="Event_13wl9ag" targetRef="Activity_1nr7xyr" />
+      <bpmn:sequenceFlow id="Flow_0nsc2oc" sourceRef="Activity_055w5hr" targetRef="Activity_1mzoss1" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="Activity_0jtob0z" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="an_esrInfo" target="esrInfo" />
+        <camunda:in source="an_responseId" target="responseId" />
+        <camunda:in source="modificationJobId" target="jobId" />
+        <camunda:in source="an_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="an_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_12cm0xq</bpmn:incoming>
+      <bpmn:outgoing>Flow_0azlxam</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0azlxam" sourceRef="Activity_0jtob0z" targetRef="Activity_1w9w7a5" />
+    <bpmn:scriptTask id="Activity_1l3vkx0" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_01xixn8</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ai7sri</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"finished","100","Deallocated successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_0tuhk79" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ai7sri</bpmn:incoming>
+      <bpmn:outgoing>Flow_17mns9c</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ai7sri" sourceRef="Activity_1l3vkx0" targetRef="Activity_0tuhk79" />
+    <bpmn:scriptTask id="Activity_0szls0v" name="Prepare SDNR request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_02jtaed</bpmn:incoming>
+      <bpmn:outgoing>Flow_1she7i5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareSdnrRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0tbndh6" name="Call SDNR subprocess" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="sdnrRequest" target="sdnrRequest" />
+        <camunda:in source="SDNR_messageType" target="messageType" />
+        <camunda:in source="SDNR_timeout" target="timeout" />
+        <camunda:in source="msoRequestId" target="correlator" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_Response" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1she7i5</bpmn:incoming>
+      <bpmn:outgoing>Flow_02pdd51</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:exclusiveGateway id="Gateway_1p35k2g" name="Is Success response" default="Flow_1uz3kjn">
+      <bpmn:incoming>Flow_1bpg97k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0hlt6jq</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1uz3kjn</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0hlt6jq" name="Yes" sourceRef="Gateway_1p35k2g" targetRef="Activity_1irtrgt">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isAnNfTerminated") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1uz3kjn" name="No" sourceRef="Gateway_1p35k2g" targetRef="Event_1icw8fg" />
+    <bpmn:endEvent id="Event_1icw8fg" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_1uz3kjn</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0kdeuox" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_02pdd51" sourceRef="Activity_0tbndh6" targetRef="Activity_0lszayp" />
+    <bpmn:sequenceFlow id="Flow_1bpg97k" sourceRef="Activity_0lszayp" targetRef="Gateway_1p35k2g" />
+    <bpmn:scriptTask id="Activity_0lszayp" name="Process sdnr response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_02pdd51</bpmn:incoming>
+      <bpmn:outgoing>Flow_1bpg97k</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:subProcess id="Activity_0c0vkj6" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_1bqq1on">
+        <bpmn:outgoing>Flow_0bkcs42</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0tgpoyd" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_0qb738v">
+        <bpmn:incoming>Flow_1b5mtc4</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_0187ysa" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0bkcs42</bpmn:incoming>
+        <bpmn:outgoing>Flow_1b5mtc4</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_1b5mtc4" sourceRef="Activity_0187ysa" targetRef="Event_0qb738v" />
+      <bpmn:sequenceFlow id="Flow_0bkcs42" sourceRef="Event_1bqq1on" targetRef="Activity_0187ysa" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="Activity_115teb9" name="Call ANModifyNSSI" calledElement="DoModifyAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="networkType" target="networkType" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="modificationJobId" target="jobId" />
+        <camunda:in source="modificationsliceParams" target="sliceParams" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="servicename" target="servicename" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ywvasn</bpmn:incoming>
+      <bpmn:outgoing>Flow_1udlwb4</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1s5fdmz" sourceRef="Activity_1e1s439" targetRef="Activity_1wu2d9y" />
+    <bpmn:scriptTask id="Activity_1wu2d9y" name="Prepare NSSI modification job" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1s5fdmz</bpmn:incoming>
+      <bpmn:outgoing>Flow_0x71rer</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.preparejobForANNSSIModification(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_0drkoau" name="UpdateModify Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0x71rer</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ywvasn</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ywvasn" sourceRef="Activity_0drkoau" targetRef="Activity_115teb9" />
+    <bpmn:endEvent id="Event_14cxrjq">
+      <bpmn:incoming>Flow_17mns9c</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_17mns9c" sourceRef="Activity_0tuhk79" targetRef="Event_14cxrjq" />
+    <bpmn:sequenceFlow id="Flow_1udlwb4" sourceRef="Activity_115teb9" targetRef="Activity_1x1p1fc" />
+    <bpmn:sequenceFlow id="Flow_12cm0xq" sourceRef="Activity_1x1p1fc" targetRef="Activity_0jtob0z" />
+    <bpmn:scriptTask id="Activity_1x1p1fc" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1udlwb4</bpmn:incoming>
+      <bpmn:outgoing>Flow_12cm0xq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("modificationJobId")
+String networkType="an"
+String nssiid=execution.getVariable("serviceInstanceID")
+
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1nm5kq2" name="Is Job complete?" default="Flow_0klaefp">
+      <bpmn:incoming>Flow_1njlj9z</bpmn:incoming>
+      <bpmn:outgoing>Flow_01xixn8</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0klaefp</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1njlj9z" sourceRef="Activity_1w9w7a5" targetRef="Gateway_1nm5kq2" />
+    <bpmn:sequenceFlow id="Flow_01xixn8" name="Yes" sourceRef="Gateway_1nm5kq2" targetRef="Activity_1l3vkx0">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:endEvent id="Event_0ayhmk4" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_0klaefp</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1y9usob" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0klaefp" name="No" sourceRef="Gateway_1nm5kq2" targetRef="Event_0ayhmk4" />
+    <bpmn:callActivity id="Activity_0mda4y4" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_FH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tnFh_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_11vezy6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0sg1a2h</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1e7m0zn" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0sg1a2h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yidpp1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+String responseDescriptor = execution.getVariable("tnFh_responseDescriptor")
+
+deallocator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_18ykcln" name="Is Job complete?" default="Flow_1gr7m1w">
+      <bpmn:incoming>Flow_1yidpp1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1gr7m1w</bpmn:outgoing>
+      <bpmn:outgoing>Flow_07m650f</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_0r83tv9" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_1gr7m1w</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_118q048" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0sg1a2h" sourceRef="Activity_0mda4y4" targetRef="Activity_1e7m0zn" />
+    <bpmn:sequenceFlow id="Flow_1yidpp1" sourceRef="Activity_1e7m0zn" targetRef="Gateway_18ykcln" />
+    <bpmn:sequenceFlow id="Flow_1gr7m1w" name="No" sourceRef="Gateway_18ykcln" targetRef="Event_0r83tv9" />
+    <bpmn:callActivity id="Activity_0zlr24k" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_MH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tnMh_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_16qo8iw</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cmkk7f</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0q7ghdf" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cmkk7f</bpmn:incoming>
+      <bpmn:outgoing>Flow_17caqnb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+String responseDescriptor = execution.getVariable("tnMh_responseDescriptor")
+
+deallocator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1dylwav" name="Is Job complete?" default="Flow_0jz37j1">
+      <bpmn:incoming>Flow_17caqnb</bpmn:incoming>
+      <bpmn:outgoing>Flow_0jz37j1</bpmn:outgoing>
+      <bpmn:outgoing>Flow_03fig6p</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_0wlpcd6" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_0jz37j1</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1w46vnr" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0cmkk7f" sourceRef="Activity_0zlr24k" targetRef="Activity_0q7ghdf" />
+    <bpmn:sequenceFlow id="Flow_17caqnb" sourceRef="Activity_0q7ghdf" targetRef="Gateway_1dylwav" />
+    <bpmn:sequenceFlow id="Flow_0jz37j1" name="No" sourceRef="Gateway_1dylwav" targetRef="Event_0wlpcd6" />
+    <bpmn:scriptTask id="Activity_0506p7p" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_04coe09</bpmn:incoming>
+      <bpmn:outgoing>Flow_16qo8iw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_MH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnMHNSSIId")
+
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_04coe09" sourceRef="Activity_114fx71" targetRef="Activity_0506p7p" />
+    <bpmn:sequenceFlow id="Flow_16qo8iw" sourceRef="Activity_0506p7p" targetRef="Activity_0zlr24k" />
+    <bpmn:sequenceFlow id="Flow_07m650f" name="Yes" sourceRef="Gateway_18ykcln" targetRef="Activity_1ih5cjh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_11w4jgm" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0x1wi2t</bpmn:incoming>
+      <bpmn:outgoing>Flow_11vezy6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_FH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnFHNSSIId")
+
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_11vezy6" sourceRef="Activity_11w4jgm" targetRef="Activity_0mda4y4" />
+    <bpmn:sequenceFlow id="Flow_0x1wi2t" sourceRef="Activity_0uul9fb" targetRef="Activity_11w4jgm" />
+    <bpmn:sequenceFlow id="Flow_03fig6p" name="Yes" sourceRef="Gateway_1dylwav" targetRef="Event_1mf8gxd">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="Event_1mf8gxd" name="Goto AAI Updates">
+      <bpmn:incoming>Flow_03fig6p</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0ocsblp" name="UpdateAAI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_0dewj8o" name="AAI Updates">
+      <bpmn:outgoing>Flow_0omhxaj</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_06yz8px" name="UpdateAAI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0omhxaj" sourceRef="Event_0dewj8o" targetRef="Activity_0qho4pw" />
+    <bpmn:scriptTask id="Activity_0qho4pw" name="Delete RAN NF Slice profile in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0omhxaj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0412ven</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deleteRanNfSliceProfileInAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_03zg1pp" name="Delete TN Slice profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0412ven</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tlog6y</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deleteTNSliceProfileInAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1ri9jrn" name="Delete RAN NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0tlog6y</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nh3x4j</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deleteANNSSI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0umktii" name="Modify RAN NF NSSI" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="anNfNssiId" target="serviceInstanceID" />
+        <camunda:in source="anNfSliceProfileId" target="SliceProfileId" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="sNssaiList" target="snssaiList" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_16hk034</bpmn:incoming>
+      <bpmn:outgoing>Flow_18y4ab2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:exclusiveGateway id="Gateway_0g02vzi" name="Is RAN NF deallocated?" default="Flow_0k55zuy">
+      <bpmn:incoming>Flow_18y4ab2</bpmn:incoming>
+      <bpmn:outgoing>Flow_0vcn5tl</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0k55zuy</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_18y4ab2" sourceRef="Activity_0umktii" targetRef="Gateway_0g02vzi" />
+    <bpmn:sequenceFlow id="Flow_0vcn5tl" name="Yes" sourceRef="Gateway_0g02vzi" targetRef="Activity_17w3onz">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ranNfStatus") == "success"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0k55zuy" name="No" sourceRef="Gateway_0g02vzi" targetRef="Event_161u9s2" />
+    <bpmn:endEvent id="Event_161u9s2">
+      <bpmn:incoming>Flow_0k55zuy</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_031y5kl" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0x71rer" sourceRef="Activity_1wu2d9y" targetRef="Activity_0drkoau" />
+  </bpmn:process>
+  <bpmn:error id="Error_0i5gql0" name="DeallocateWorkflowError" errorCode="2500" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_0omhxaj_di" bpmnElement="Flow_0omhxaj">
+        <di:waypoint x="238" y="1110" />
+        <di:waypoint x="360" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_03fig6p_di" bpmnElement="Flow_03fig6p">
+        <di:waypoint x="2085" y="880" />
+        <di:waypoint x="2182" y="880" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2125" y="862" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0x1wi2t_di" bpmnElement="Flow_0x1wi2t">
+        <di:waypoint x="380" y="880" />
+        <di:waypoint x="420" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11vezy6_di" bpmnElement="Flow_11vezy6">
+        <di:waypoint x="520" y="880" />
+        <di:waypoint x="570" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_07m650f_di" bpmnElement="Flow_07m650f">
+        <di:waypoint x="965" y="880" />
+        <di:waypoint x="1030" y="880" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="989" y="862" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16qo8iw_di" bpmnElement="Flow_16qo8iw">
+        <di:waypoint x="1590" y="880" />
+        <di:waypoint x="1660" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04coe09_di" bpmnElement="Flow_04coe09">
+        <di:waypoint x="1430" y="880" />
+        <di:waypoint x="1490" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jz37j1_di" bpmnElement="Flow_0jz37j1">
+        <di:waypoint x="2060" y="905" />
+        <di:waypoint x="2060" y="962" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2068" y="931" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17caqnb_di" bpmnElement="Flow_17caqnb">
+        <di:waypoint x="1940" y="880" />
+        <di:waypoint x="2035" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cmkk7f_di" bpmnElement="Flow_0cmkk7f">
+        <di:waypoint x="1760" y="880" />
+        <di:waypoint x="1840" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1gr7m1w_di" bpmnElement="Flow_1gr7m1w">
+        <di:waypoint x="940" y="905" />
+        <di:waypoint x="940" y="962" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="948" y="931" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yidpp1_di" bpmnElement="Flow_1yidpp1">
+        <di:waypoint x="830" y="880" />
+        <di:waypoint x="915" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0sg1a2h_di" bpmnElement="Flow_0sg1a2h">
+        <di:waypoint x="670" y="880" />
+        <di:waypoint x="730" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0klaefp_di" bpmnElement="Flow_0klaefp">
+        <di:waypoint x="2140" y="675" />
+        <di:waypoint x="2140" y="732" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2148" y="701" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01xixn8_di" bpmnElement="Flow_01xixn8">
+        <di:waypoint x="2165" y="650" />
+        <di:waypoint x="2220" y="650" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2184" y="632" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1njlj9z_di" bpmnElement="Flow_1njlj9z">
+        <di:waypoint x="2050" y="650" />
+        <di:waypoint x="2115" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_12cm0xq_di" bpmnElement="Flow_12cm0xq">
+        <di:waypoint x="1720" y="650" />
+        <di:waypoint x="1780" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1udlwb4_di" bpmnElement="Flow_1udlwb4">
+        <di:waypoint x="1560" y="650" />
+        <di:waypoint x="1620" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17mns9c_di" bpmnElement="Flow_17mns9c">
+        <di:waypoint x="2490" y="650" />
+        <di:waypoint x="2552" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ywvasn_di" bpmnElement="Flow_1ywvasn">
+        <di:waypoint x="1420" y="650" />
+        <di:waypoint x="1460" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0x71rer_di" bpmnElement="Flow_0x71rer">
+        <di:waypoint x="1275" y="650" />
+        <di:waypoint x="1320" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1s5fdmz_di" bpmnElement="Flow_1s5fdmz">
+        <di:waypoint x="1130" y="650" />
+        <di:waypoint x="1175" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1bpg97k_di" bpmnElement="Flow_1bpg97k">
+        <di:waypoint x="1820" y="410" />
+        <di:waypoint x="1875" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02pdd51_di" bpmnElement="Flow_02pdd51">
+        <di:waypoint x="1680" y="410" />
+        <di:waypoint x="1720" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1uz3kjn_di" bpmnElement="Flow_1uz3kjn">
+        <di:waypoint x="1900" y="435" />
+        <di:waypoint x="1900" y="482" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1908" y="456" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0hlt6jq_di" bpmnElement="Flow_0hlt6jq">
+        <di:waypoint x="1925" y="410" />
+        <di:waypoint x="1970" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1939" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ai7sri_di" bpmnElement="Flow_1ai7sri">
+        <di:waypoint x="2320" y="650" />
+        <di:waypoint x="2390" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0azlxam_di" bpmnElement="Flow_0azlxam">
+        <di:waypoint x="1880" y="650" />
+        <di:waypoint x="1950" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04bem88_di" bpmnElement="Flow_04bem88">
+        <di:waypoint x="1130" y="1110" />
+        <di:waypoint x="1207" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nh3x4j_di" bpmnElement="Flow_1nh3x4j">
+        <di:waypoint x="810" y="1110" />
+        <di:waypoint x="880" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15bkzm7_di" bpmnElement="Flow_15bkzm7">
+        <di:waypoint x="1280" y="880" />
+        <di:waypoint x="1330" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ib3uzg_di" bpmnElement="Flow_1ib3uzg">
+        <di:waypoint x="1130" y="880" />
+        <di:waypoint x="1180" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0m12xsi_di" bpmnElement="Flow_0m12xsi">
+        <di:waypoint x="880" y="435" />
+        <di:waypoint x="880" y="650" />
+        <di:waypoint x="900" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xqtf63_di" bpmnElement="Flow_1xqtf63">
+        <di:waypoint x="1000" y="650" />
+        <di:waypoint x="1030" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1g9lfjr_di" bpmnElement="Flow_1g9lfjr">
+        <di:waypoint x="980" y="1110" />
+        <di:waypoint x="1030" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0hdpgak_di" bpmnElement="Flow_0hdpgak">
+        <di:waypoint x="2220" y="410" />
+        <di:waypoint x="2280" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pm77xu_di" bpmnElement="Flow_1pm77xu">
+        <di:waypoint x="2070" y="410" />
+        <di:waypoint x="2120" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1x4e0k3_di" bpmnElement="Flow_1x4e0k3">
+        <di:waypoint x="2130" y="240" />
+        <di:waypoint x="2232" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1bgguw0_di" bpmnElement="Flow_1bgguw0">
+        <di:waypoint x="1920" y="240" />
+        <di:waypoint x="2030" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1lfvp5s_di" bpmnElement="Flow_1lfvp5s">
+        <di:waypoint x="2380" y="410" />
+        <di:waypoint x="2422" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tlog6y_di" bpmnElement="Flow_0tlog6y">
+        <di:waypoint x="630" y="1110" />
+        <di:waypoint x="710" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0412ven_di" bpmnElement="Flow_0412ven">
+        <di:waypoint x="460" y="1110" />
+        <di:waypoint x="530" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cj22bs_di" bpmnElement="Flow_0cj22bs">
+        <di:waypoint x="238" y="880" />
+        <di:waypoint x="280" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1she7i5_di" bpmnElement="Flow_1she7i5">
+        <di:waypoint x="1500" y="410" />
+        <di:waypoint x="1580" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16hk034_di" bpmnElement="Flow_16hk034">
+        <di:waypoint x="1290" y="385" />
+        <di:waypoint x="1290" y="240" />
+        <di:waypoint x="1400" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1298" y="312" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02jtaed_di" bpmnElement="Flow_02jtaed">
+        <di:waypoint x="1315" y="410" />
+        <di:waypoint x="1400" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1349" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1o2mo3u_di" bpmnElement="Flow_1o2mo3u">
+        <di:waypoint x="1200" y="410" />
+        <di:waypoint x="1265" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0m3x1ra_di" bpmnElement="Flow_0m3x1ra">
+        <di:waypoint x="1050" y="410" />
+        <di:waypoint x="1100" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_12fyi2n_di" bpmnElement="Flow_12fyi2n">
+        <di:waypoint x="905" y="410" />
+        <di:waypoint x="950" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="919" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_150eq0z_di" bpmnElement="Flow_150eq0z">
+        <di:waypoint x="810" y="410" />
+        <di:waypoint x="855" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_08ncj77_di" bpmnElement="Flow_08ncj77">
+        <di:waypoint x="670" y="410" />
+        <di:waypoint x="710" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0kt6k2i_di" bpmnElement="Flow_0kt6k2i">
+        <di:waypoint x="530" y="410" />
+        <di:waypoint x="570" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hm17vz_di" bpmnElement="Flow_1hm17vz">
+        <di:waypoint x="390" y="410" />
+        <di:waypoint x="430" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14g5p2j_di" bpmnElement="Flow_14g5p2j">
+        <di:waypoint x="238" y="410" />
+        <di:waypoint x="290" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18y4ab2_di" bpmnElement="Flow_18y4ab2">
+        <di:waypoint x="1500" y="240" />
+        <di:waypoint x="1625" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0vcn5tl_di" bpmnElement="Flow_0vcn5tl">
+        <di:waypoint x="1675" y="240" />
+        <di:waypoint x="1820" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1739" y="222" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k55zuy_di" bpmnElement="Flow_0k55zuy">
+        <di:waypoint x="1650" y="215" />
+        <di:waypoint x="1650" y="100" />
+        <di:waypoint x="1822" y="100" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1658" y="155" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0seox25_di" bpmnElement="Event_0seox25">
+        <dc:Bounds x="202" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="208" y="435" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ahytqr_di" bpmnElement="Activity_00sen5i">
+        <dc:Bounds x="290" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_05fdvbz_di" bpmnElement="Gateway_05fdvbz" isMarkerVisible="true">
+        <dc:Bounds x="855" y="385" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="847" y="355" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1ypyzn3_di" bpmnElement="Gateway_1ypyzn3" isMarkerVisible="true">
+        <dc:Bounds x="1265" y="385" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1dvx4n9_di" bpmnElement="Event_0vthuwp">
+        <dc:Bounds x="2422" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2399" y="438" width="82" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1ekryu8_di" bpmnElement="Event_0opsm2p">
+        <dc:Bounds x="202" y="862" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="192" y="905" width="57" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_18i5si0_di" bpmnElement="Activity_1i58rru">
+        <dc:Bounds x="430" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0u528ge_di" bpmnElement="Activity_0kpwy97">
+        <dc:Bounds x="570" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tgprdn_di" bpmnElement="Activity_1v9avqp">
+        <dc:Bounds x="710" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11wbmk9_di" bpmnElement="Activity_0hpe14n">
+        <dc:Bounds x="950" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1h4jup8_di" bpmnElement="Activity_0gzrekf">
+        <dc:Bounds x="1100" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18fpd51_di" bpmnElement="Event_18fpd51">
+        <dc:Bounds x="2232" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2209" y="268" width="82" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0m43umg_di" bpmnElement="Activity_1v1ra2k">
+        <dc:Bounds x="2280" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1i1fknn_di" bpmnElement="Activity_1irtrgt">
+        <dc:Bounds x="1970" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vyon97_di" bpmnElement="Activity_1vyon97">
+        <dc:Bounds x="2120" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w9w7a5_di" bpmnElement="Activity_1w9w7a5">
+        <dc:Bounds x="1950" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1dyluu0_di" bpmnElement="Activity_1dyluu0">
+        <dc:Bounds x="880" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1x2fc4q_di" bpmnElement="Activity_1x2fc4q">
+        <dc:Bounds x="1030" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0wlygp0_di" bpmnElement="Activity_0wlygp0">
+        <dc:Bounds x="900" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1e1s439_di" bpmnElement="Activity_1e1s439">
+        <dc:Bounds x="1030" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ih5cjh_di" bpmnElement="Activity_1ih5cjh">
+        <dc:Bounds x="1030" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1clwk2x_di" bpmnElement="Activity_1clwk2x">
+        <dc:Bounds x="1180" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_19tcky7_di" bpmnElement="Event_19tcky7">
+        <dc:Bounds x="1207" y="1092" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0pm19vk_di" bpmnElement="Activity_0uul9fb">
+        <dc:Bounds x="280" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1i9b3oi_di" bpmnElement="Activity_114fx71">
+        <dc:Bounds x="1330" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_01s2lve_di" bpmnElement="Activity_0umktii">
+        <dc:Bounds x="1400" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_05frw6w_di" bpmnElement="Activity_05frw6w">
+        <dc:Bounds x="2030" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0njdei2_di" bpmnElement="Activity_17w3onz">
+        <dc:Bounds x="1820" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0g02vzi_di" bpmnElement="Gateway_0g02vzi" isMarkerVisible="true">
+        <dc:Bounds x="1625" y="215" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1619" y="272" width="63" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0jtob0z_di" bpmnElement="Activity_0jtob0z">
+        <dc:Bounds x="1780" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1l3vkx0_di" bpmnElement="Activity_1l3vkx0">
+        <dc:Bounds x="2220" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tuhk79_di" bpmnElement="Activity_0tuhk79">
+        <dc:Bounds x="2390" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mddd28_di" bpmnElement="Activity_0szls0v">
+        <dc:Bounds x="1400" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0zhag3x_di" bpmnElement="Activity_0tbndh6">
+        <dc:Bounds x="1580" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1p35k2g_di" bpmnElement="Gateway_1p35k2g" isMarkerVisible="true">
+        <dc:Bounds x="1875" y="385" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1874" y="355" width="54" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1us3hum_di" bpmnElement="Event_1icw8fg">
+        <dc:Bounds x="1882" y="482" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1918" y="466" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10vgzv9_di" bpmnElement="Activity_0lszayp">
+        <dc:Bounds x="1720" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_115teb9_di" bpmnElement="Activity_115teb9">
+        <dc:Bounds x="1460" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1kzmrir_di" bpmnElement="Activity_1wu2d9y">
+        <dc:Bounds x="1175" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0drkoau_di" bpmnElement="Activity_0drkoau">
+        <dc:Bounds x="1320" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_14cxrjq_di" bpmnElement="Event_14cxrjq">
+        <dc:Bounds x="2552" y="632" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1i80irm_di" bpmnElement="Activity_1x1p1fc">
+        <dc:Bounds x="1620" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1nm5kq2_di" bpmnElement="Gateway_1nm5kq2" isMarkerVisible="true">
+        <dc:Bounds x="2115" y="625" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2099" y="595" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ayhmk4_di" bpmnElement="Event_0ayhmk4">
+        <dc:Bounds x="2122" y="732" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2158" y="716" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mda4y4_di" bpmnElement="Activity_0mda4y4">
+        <dc:Bounds x="570" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1e7m0zn_di" bpmnElement="Activity_1e7m0zn">
+        <dc:Bounds x="730" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_18ykcln_di" bpmnElement="Gateway_18ykcln" isMarkerVisible="true">
+        <dc:Bounds x="915" y="855" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="899" y="825" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0r83tv9_di" bpmnElement="Event_0r83tv9">
+        <dc:Bounds x="922" y="962" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="998" y="948" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0zlr24k_di" bpmnElement="Activity_0zlr24k">
+        <dc:Bounds x="1660" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0q7ghdf_di" bpmnElement="Activity_0q7ghdf">
+        <dc:Bounds x="1840" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1dylwav_di" bpmnElement="Gateway_1dylwav" isMarkerVisible="true">
+        <dc:Bounds x="2035" y="855" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2019" y="825" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0wlpcd6_di" bpmnElement="Event_0wlpcd6">
+        <dc:Bounds x="2042" y="962" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2078" y="946" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0506p7p_di" bpmnElement="Activity_0506p7p">
+        <dc:Bounds x="1490" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11w4jgm_di" bpmnElement="Activity_11w4jgm">
+        <dc:Bounds x="420" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0y0f7aq_di" bpmnElement="Event_1mf8gxd">
+        <dc:Bounds x="2182" y="862" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2156" y="905" width="89" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_066h3ef_di" bpmnElement="Event_0dewj8o">
+        <dc:Bounds x="202" y="1092" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="189" y="1135" width="62" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0r4899a_di" bpmnElement="Activity_0qho4pw">
+        <dc:Bounds x="360" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0b0pl0x_di" bpmnElement="Activity_03zg1pp">
+        <dc:Bounds x="530" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0dreslj_di" bpmnElement="Activity_1ri9jrn">
+        <dc:Bounds x="710" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1m6hsxq_di" bpmnElement="Event_161u9s2">
+        <dc:Bounds x="1822" y="82" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0qbd3cz_di" bpmnElement="Activity_0qbd3cz" isExpanded="true">
+        <dc:Bounds x="820" y="1310" width="770" height="170" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0nsc2oc_di" bpmnElement="Flow_0nsc2oc">
+        <di:waypoint x="1240" y="1414" />
+        <di:waypoint x="1320" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1q1450g_di" bpmnElement="Flow_1q1450g">
+        <di:waypoint x="888" y="1414" />
+        <di:waypoint x="990" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0alqcat_di" bpmnElement="Flow_0alqcat">
+        <di:waypoint x="1090" y="1414" />
+        <di:waypoint x="1140" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_035ivcv_di" bpmnElement="Flow_035ivcv">
+        <di:waypoint x="1420" y="1414" />
+        <di:waypoint x="1502" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_13wl9ag_di" bpmnElement="Event_13wl9ag">
+        <dc:Bounds x="852" y="1396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ugnt78_di" bpmnElement="Event_0ugnt78">
+        <dc:Bounds x="1502" y="1396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1mzoss1_di" bpmnElement="Activity_1mzoss1">
+        <dc:Bounds x="1320" y="1374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_055w5hr_di" bpmnElement="Activity_055w5hr">
+        <dc:Bounds x="1140" y="1374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nr7xyr_di" bpmnElement="Activity_1nr7xyr">
+        <dc:Bounds x="990" y="1374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0c0vkj6_di" bpmnElement="Activity_0c0vkj6" isExpanded="true">
+        <dc:Bounds x="930" y="1600" width="440" height="140" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0bkcs42_di" bpmnElement="Flow_0bkcs42">
+        <di:waypoint x="1018" y="1661" />
+        <di:waypoint x="1083" y="1661" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b5mtc4_di" bpmnElement="Flow_1b5mtc4">
+        <di:waypoint x="1183" y="1661" />
+        <di:waypoint x="1282" y="1661" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_1bqq1on_di" bpmnElement="Event_1bqq1on">
+        <dc:Bounds x="982" y="1643" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0qb738v_di" bpmnElement="Event_0qb738v">
+        <dc:Bounds x="1282" y="1643" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0187ysa_di" bpmnElement="Activity_0187ysa">
+        <dc:Bounds x="1083" y="1621" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..a800289
--- /dev/null
@@ -0,0 +1,221 @@
+<?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoDeallocateTransportNSSI" name="DoDeallocateTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Deallocate TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Deallocated TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "deallocated")
+def runScript = new DoDeallocateTnNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Deallocate TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoDeallocateTnNssi()
+runScript.preprocessSdncDeallocateTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0cpctye" sourceRef="Activity_1tw8eyy" targetRef="Activity_0p20esb" />
+    <bpmn:callActivity id="Activity_0p20esb" name="Call SDNC Adapter: Deallocate TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <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="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0cpctye</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fuabjs</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0fuabjs" sourceRef="Activity_0p20esb" targetRef="Activity_0phv8e5" />
+    <bpmn:scriptTask id="Activity_0phv8e5" name="Postprocess SDNC Deallocate TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fuabjs</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def runScript = new DoDeallocateTnNssi()
+runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_013rjwc" name="Delete Service Instance (TN NSSI) in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jygjln</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoDeallocateTnNssi()
+runScript.deleteServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_013rjwc" />
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoDeallocateTnNssi()
+runScript.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" />
+    <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_19uxoi8" />
+    <bpmn:serviceTask id="Activity_0rgeefb" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ca4l8d</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0ca4l8d" sourceRef="Activity_0rgeefb" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln">
+        <di:waypoint x="360" y="350" />
+        <di:waypoint x="520" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="509" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+        <di:waypoint x="1080" y="121" />
+        <di:waypoint x="1220" y="121" />
+        <di:waypoint x="1220" y="210" />
+        <di:waypoint x="310" y="210" />
+        <di:waypoint x="310" y="310" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
+        <di:waypoint x="850" y="121" />
+        <di:waypoint x="959" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
+        <di:waypoint x="630" y="121" />
+        <di:waypoint x="729" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="620" y="350" />
+        <di:waypoint x="740" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="840" y="350" />
+        <di:waypoint x="990" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d">
+        <di:waypoint x="1090" y="350" />
+        <di:waypoint x="1202" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="166" y="146" width="70" height="53" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb">
+        <dc:Bounds x="990" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1202" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1210" y="375" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="740" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="520" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+        <dc:Bounds x="509" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
+        <dc:Bounds x="729" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="959" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc">
+        <dc:Bounds x="260" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleSdnrDmaapRequest.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleSdnrDmaapRequest.bpmn
new file mode 100644 (file)
index 0000000..d4e50c4
--- /dev/null
@@ -0,0 +1,98 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1347ugu" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoHandleSdnrDmaapRequest" name="CallSdnrForSliceSubnetActions" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>Flow_05aj74g</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:callActivity id="Activity_1930vdf" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage">
+      <bpmn:extensionElements>
+        <camunda:in source="true" target="isDebugLogEnabled" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="messageType" target="RCVWFMSG_messageType" />
+        <camunda:in source="correlator" target="RCVWFMSG_correlator" />
+        <camunda:in source="timeout" target="RCVWFMSG_timeout" />
+        <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ujhb0b</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ygvrm7</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0ygvrm7" sourceRef="Activity_1930vdf" targetRef="Event_0axmcg1" />
+    <bpmn:endEvent id="Event_0axmcg1">
+      <bpmn:incoming>Flow_0ygvrm7</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_05aj74g" sourceRef="StartEvent_1" targetRef="Activity_0se24pv" />
+    <bpmn:subProcess id="Activity_1br4yea" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_06b1eun">
+        <bpmn:outgoing>Flow_1if0x9d</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0y90o3x" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1q3xxjf">
+        <bpmn:incoming>Flow_04gv65b</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_0k6o70p" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1if0x9d</bpmn:incoming>
+        <bpmn:outgoing>Flow_04gv65b</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_1if0x9d" sourceRef="Event_06b1eun" targetRef="Activity_0k6o70p" />
+      <bpmn:sequenceFlow id="Flow_04gv65b" sourceRef="Activity_0k6o70p" targetRef="Event_1q3xxjf" />
+    </bpmn:subProcess>
+    <bpmn:sequenceFlow id="Flow_1ujhb0b" sourceRef="Activity_0se24pv" targetRef="Activity_1930vdf" />
+    <bpmn:serviceTask id="Activity_0se24pv" name="send request to SDNR" camunda:class="org.onap.so.client.sdnc.common.SendRequestToSdnr">
+      <bpmn:incoming>Flow_05aj74g</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ujhb0b</bpmn:outgoing>
+    </bpmn:serviceTask>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoHandleSdnrDmaapRequest">
+      <bpmndi:BPMNEdge id="Flow_05aj74g_di" bpmnElement="Flow_05aj74g">
+        <di:waypoint x="308" y="120" />
+        <di:waypoint x="350" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ygvrm7_di" bpmnElement="Flow_0ygvrm7">
+        <di:waypoint x="581" y="118" />
+        <di:waypoint x="622" y="118" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ujhb0b_di" bpmnElement="Flow_1ujhb0b">
+        <di:waypoint x="450" y="120" />
+        <di:waypoint x="481" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="272" y="102" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1930vdf_di" bpmnElement="Activity_1930vdf">
+        <dc:Bounds x="481" y="78" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0axmcg1_di" bpmnElement="Event_0axmcg1">
+        <dc:Bounds x="622" y="100" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1f7ncbf_di" bpmnElement="Activity_0se24pv">
+        <dc:Bounds x="350" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1br4yea_di" bpmnElement="Activity_1br4yea" isExpanded="true">
+        <dc:Bounds x="140" y="310" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_04gv65b_di" bpmnElement="Flow_04gv65b">
+        <di:waypoint x="534" y="414" />
+        <di:waypoint x="808" y="414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1if0x9d_di" bpmnElement="Flow_1if0x9d">
+        <di:waypoint x="206" y="414" />
+        <di:waypoint x="434" y="414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_06b1eun_di" bpmnElement="Event_06b1eun">
+        <dc:Bounds x="170" y="396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1q3xxjf_di" bpmnElement="Event_1q3xxjf">
+        <dc:Bounds x="808" y="396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0k6o70p_di" bpmnElement="Activity_0k6o70p">
+        <dc:Bounds x="434" y="374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
+
+
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..c62b143
--- /dev/null
@@ -0,0 +1,886 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1igy8ns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoModifyAccessNSSI" name="DoModifyAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="Event_1sy6p6u" name="Start">
+      <bpmn:outgoing>Flow_1yfvjui</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_1eiktpg" name="preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1yfvjui</bpmn:incoming>
+      <bpmn:outgoing>Flow_09sxq6k</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_00u5sgf" name="prepare OOF request for RAN NSS slice profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0hzibw4</bpmn:incoming>
+      <bpmn:outgoing>Flow_0714cfa</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareOofRequestForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1qswyrk" name="Call DoCreateSubnetOption" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0714cfa</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ei9866</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1w537ie" name="Process OOF response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ei9866</bpmn:incoming>
+      <bpmn:outgoing>Flow_14xj79h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processOofResponseForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1yfvjui" sourceRef="Event_1sy6p6u" targetRef="Activity_1eiktpg" />
+    <bpmn:sequenceFlow id="Flow_0714cfa" sourceRef="Activity_00u5sgf" targetRef="Activity_1qswyrk" />
+    <bpmn:sequenceFlow id="Flow_0ei9866" sourceRef="Activity_1qswyrk" targetRef="Activity_1w537ie" />
+    <bpmn:exclusiveGateway id="Gateway_0gi40v8" name="check modify action">
+      <bpmn:incoming>Flow_09sxq6k</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ycw1zo</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1orjrjp</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1p5ruyv</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1ycw1zo" name="allocate" sourceRef="Gateway_0gi40v8" targetRef="Activity_0vki9dw">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isModifyallocate" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1orjrjp" name="deallocate" sourceRef="Gateway_0gi40v8" targetRef="Activity_10zcvcv">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isModifydeallocate" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_0vki9dw" name="query AAI for slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ycw1zo</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ym755g</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_14xj79h" sourceRef="Activity_1w537ie" targetRef="Activity_0c8tzf1" />
+    <bpmn:sequenceFlow id="Flow_1p5ruyv" name="reconfigure" sourceRef="Gateway_0gi40v8" targetRef="Activity_0kcrid0">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isModifyreconfigure" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_0c8tzf1" name="get NSSIs from AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_14xj79h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1fpw4gf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getNssisFromAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1fpw4gf" sourceRef="Activity_0c8tzf1" targetRef="Activity_1so8vif" />
+    <bpmn:sequenceFlow id="Flow_05cl21h" sourceRef="Activity_1so8vif" targetRef="Activity_0uxxkp1" />
+    <bpmn:scriptTask id="Activity_0uxxkp1" name="update AAI relationships">
+      <bpmn:incoming>Flow_05cl21h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1jwk3jy</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.updateRelationshipInAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1so8vif" name="create slice profiles in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1fpw4gf</bpmn:incoming>
+      <bpmn:outgoing>Flow_05cl21h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createSliceProfiles(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1jwk3jy" sourceRef="Activity_0uxxkp1" targetRef="Event_1wm97cy" />
+    <bpmn:intermediateThrowEvent id="Event_1wm97cy" name="Go to modify allocate">
+      <bpmn:incoming>Flow_1jwk3jy</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_02uw07i" name="modifyAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_058xrlc" name="Modify allocate">
+      <bpmn:outgoing>Flow_06hymr5</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0j8kv6s" name="modifyAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:callActivity id="Activity_1nexxhu" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="ranNfSliceProfile" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_06hymr5</bpmn:incoming>
+      <bpmn:outgoing>Flow_19p3d5t</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1rweifb" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_19p3d5t</bpmn:incoming>
+      <bpmn:outgoing>Flow_0t8y3x5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_19p3d5t" sourceRef="Activity_1nexxhu" targetRef="Activity_1rweifb" />
+    <bpmn:sequenceFlow id="Flow_06hymr5" sourceRef="Event_058xrlc" targetRef="Activity_1nexxhu" />
+    <bpmn:scriptTask id="Activity_0dr4umy" name="send modify allocate FH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0t8y3x5</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cd38vb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnFhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0e0ldfk" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cd38vb</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yfkps3</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_07kzsym" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNFH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1yfkps3</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tkrh8z</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_06pgtv8" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0tkrh8z</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ygfojp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processFhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0cd38vb" sourceRef="Activity_0dr4umy" targetRef="Activity_0e0ldfk" />
+    <bpmn:sequenceFlow id="Flow_1yfkps3" sourceRef="Activity_0e0ldfk" targetRef="Activity_07kzsym" />
+    <bpmn:sequenceFlow id="Flow_0tkrh8z" sourceRef="Activity_07kzsym" targetRef="Activity_06pgtv8" />
+    <bpmn:sequenceFlow id="Flow_0t8y3x5" sourceRef="Activity_1rweifb" targetRef="Activity_0dr4umy" />
+    <bpmn:scriptTask id="Activity_11ohmvk" name="send modify allocate MH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ygfojp</bpmn:incoming>
+      <bpmn:outgoing>Flow_1702ljm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnMhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_11kv5jk" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1702ljm</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hzswil</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_031x96n" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNMH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1hzswil</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zh5p33</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1x48i50" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0zh5p33</bpmn:incoming>
+      <bpmn:outgoing>Flow_0wgumc4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processMhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1702ljm" sourceRef="Activity_11ohmvk" targetRef="Activity_11kv5jk" />
+    <bpmn:sequenceFlow id="Flow_1hzswil" sourceRef="Activity_11kv5jk" targetRef="Activity_031x96n" />
+    <bpmn:sequenceFlow id="Flow_0zh5p33" sourceRef="Activity_031x96n" targetRef="Activity_1x48i50" />
+    <bpmn:sequenceFlow id="Flow_0ygfojp" sourceRef="Activity_06pgtv8" targetRef="Activity_11ohmvk" />
+    <bpmn:callActivity id="Activity_1pqb2g0" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="additionalProperties" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_09p79e6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ks2ut4</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0mleulg" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ks2ut4</bpmn:incoming>
+      <bpmn:outgoing>Flow_1mu3zgb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0ks2ut4" sourceRef="Activity_1pqb2g0" targetRef="Activity_0mleulg" />
+    <bpmn:scriptTask id="Activity_1xdke18" name="send modify deallocate FH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1mu3zgb</bpmn:incoming>
+      <bpmn:outgoing>Flow_01vilkh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnFhDeallocateRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_06meubi" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_01vilkh</bpmn:incoming>
+      <bpmn:outgoing>Flow_0r7bejs</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0sjyngn" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TN_FH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0r7bejs</bpmn:incoming>
+      <bpmn:outgoing>Flow_06lgxk9</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0j3bxt8" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_06lgxk9</bpmn:incoming>
+      <bpmn:outgoing>Flow_120fe2z</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processFhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_01vilkh" sourceRef="Activity_1xdke18" targetRef="Activity_06meubi" />
+    <bpmn:sequenceFlow id="Flow_0r7bejs" sourceRef="Activity_06meubi" targetRef="Activity_0sjyngn" />
+    <bpmn:sequenceFlow id="Flow_06lgxk9" sourceRef="Activity_0sjyngn" targetRef="Activity_0j3bxt8" />
+    <bpmn:sequenceFlow id="Flow_1mu3zgb" sourceRef="Activity_0mleulg" targetRef="Activity_1xdke18" />
+    <bpmn:scriptTask id="Activity_10zcvcv" name="get NSSIs from AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1orjrjp</bpmn:incoming>
+      <bpmn:outgoing>Flow_1atfnov</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getNssisFromAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0m97fsi" name="send modify deallocate MH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1489mpe</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ueq9wo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnMhDeallocateRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1wwt0yj" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ueq9wo</bpmn:incoming>
+      <bpmn:outgoing>Flow_05junp8</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_18gqpmg" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TN_MH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_05junp8</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xchogr</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1j4c00v" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1xchogr</bpmn:incoming>
+      <bpmn:outgoing>Flow_11aacst</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processMhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ueq9wo" sourceRef="Activity_0m97fsi" targetRef="Activity_1wwt0yj" />
+    <bpmn:sequenceFlow id="Flow_05junp8" sourceRef="Activity_1wwt0yj" targetRef="Activity_18gqpmg" />
+    <bpmn:sequenceFlow id="Flow_1xchogr" sourceRef="Activity_18gqpmg" targetRef="Activity_1j4c00v" />
+    <bpmn:sequenceFlow id="Flow_120fe2z" sourceRef="Activity_0j3bxt8" targetRef="Event_1x3sb7x" />
+    <bpmn:intermediateThrowEvent id="Event_1x3sb7x" name="Go to modify deallocate">
+      <bpmn:incoming>Flow_120fe2z</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1wixp6w" name="modifydeAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_16lc641" sourceRef="Event_1vdrrdl" targetRef="Activity_0w9oree" />
+    <bpmn:intermediateCatchEvent id="Event_1vdrrdl" name="Modify deallocate">
+      <bpmn:outgoing>Flow_16lc641</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1aw5yul" name="modifydeAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_09ku290" name="remove TN MH slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_11aacst</bpmn:incoming>
+      <bpmn:outgoing>Flow_05gp3p7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.deleteMhSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1489mpe" sourceRef="Activity_0w9oree" targetRef="Activity_0m97fsi" />
+    <bpmn:scriptTask id="Activity_0w9oree" name="remove TN FH slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16lc641</bpmn:incoming>
+      <bpmn:outgoing>Flow_1489mpe</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.deleteFhSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_11aacst" sourceRef="Activity_1j4c00v" targetRef="Activity_09ku290" />
+    <bpmn:scriptTask id="Activity_121aiqf" name="remove RAN slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_05gp3p7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nyp1l1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.deleteAnSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_05gp3p7" sourceRef="Activity_09ku290" targetRef="Activity_121aiqf" />
+    <bpmn:subProcess id="Activity_0sp6bx7" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_0gr296x">
+        <bpmn:outgoing>Flow_0yj2tlu</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1do1xse" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1hq0k3q">
+        <bpmn:incoming>Flow_07c6g27</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1awhkox" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0dafrg8</bpmn:incoming>
+        <bpmn:outgoing>Flow_07c6g27</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:scriptTask id="Activity_16up0r1" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0yj2tlu</bpmn:incoming>
+        <bpmn:outgoing>Flow_0jar916</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1h1crsr" name="Update Resource Operation Status">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                  <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>Flow_0jar916</bpmn:incoming>
+        <bpmn:outgoing>Flow_0dafrg8</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_07c6g27" sourceRef="Activity_1awhkox" targetRef="Event_1hq0k3q" />
+      <bpmn:sequenceFlow id="Flow_0yj2tlu" sourceRef="Event_0gr296x" targetRef="Activity_16up0r1" />
+      <bpmn:sequenceFlow id="Flow_0jar916" sourceRef="Activity_16up0r1" targetRef="Activity_1h1crsr" />
+      <bpmn:sequenceFlow id="Flow_0dafrg8" sourceRef="Activity_1h1crsr" targetRef="Activity_1awhkox" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="Activity_0kcrid0" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="sliceProfileId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="additionalProperties" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1p5ruyv</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fkl1gv</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_05m354s" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fkl1gv</bpmn:incoming>
+      <bpmn:outgoing>Flow_17dxvu5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0fkl1gv" sourceRef="Activity_0kcrid0" targetRef="Activity_05m354s" />
+    <bpmn:sequenceFlow id="Flow_09sxq6k" sourceRef="Activity_1eiktpg" targetRef="Gateway_0gi40v8" />
+    <bpmn:scriptTask id="Activity_1w8iqt0" name="Get Subnet capabilities" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ym755g</bpmn:incoming>
+      <bpmn:outgoing>Flow_0hzibw4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getSubnetCapabilities(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ym755g" sourceRef="Activity_0vki9dw" targetRef="Activity_1w8iqt0" />
+    <bpmn:sequenceFlow id="Flow_0hzibw4" sourceRef="Activity_1w8iqt0" targetRef="Activity_00u5sgf" />
+    <bpmn:scriptTask id="Activity_137i4pg" name="get sice profiles from AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1atfnov</bpmn:incoming>
+      <bpmn:outgoing>Flow_09p79e6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getSliceProfilesFromAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1atfnov" sourceRef="Activity_10zcvcv" targetRef="Activity_137i4pg" />
+    <bpmn:sequenceFlow id="Flow_09p79e6" sourceRef="Activity_137i4pg" targetRef="Activity_1pqb2g0" />
+    <bpmn:intermediateCatchEvent id="Event_00zdcuh" name="Start operation status update">
+      <bpmn:outgoing>Flow_0ei2q6r</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1ohe6f7" name="OperationStatusUpdate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_0mr7bh2" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ei2q6r</bpmn:incoming>
+      <bpmn:outgoing>Flow_1giua78</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareOperationStatusUpdate(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_125mjhq" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1giua78</bpmn:incoming>
+      <bpmn:outgoing>Flow_1oubjfe</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:endEvent id="Event_159m6y8">
+      <bpmn:incoming>Flow_1oubjfe</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_1giua78" sourceRef="Activity_0mr7bh2" targetRef="Activity_125mjhq" />
+    <bpmn:sequenceFlow id="Flow_1oubjfe" sourceRef="Activity_125mjhq" targetRef="Event_159m6y8" />
+    <bpmn:intermediateThrowEvent id="Event_1gy8um0" name="Go to start  Â operation status update">
+      <bpmn:incoming>Flow_0wgumc4</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0kburcf" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0wgumc4" sourceRef="Activity_1x48i50" targetRef="Event_1gy8um0" />
+    <bpmn:sequenceFlow id="Flow_0ei2q6r" sourceRef="Event_00zdcuh" targetRef="Activity_0mr7bh2" />
+    <bpmn:intermediateThrowEvent id="Event_1304mrw" name="Go to start  Â operation status update">
+      <bpmn:incoming>Flow_1nyp1l1</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1rrc1x9" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_1nyp1l1" sourceRef="Activity_121aiqf" targetRef="Event_1304mrw" />
+    <bpmn:intermediateThrowEvent id="Event_00vqmnl" name="Go to start  Â operation status update">
+      <bpmn:incoming>Flow_17dxvu5</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_158e1rq" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_17dxvu5" sourceRef="Activity_05m354s" targetRef="Event_00vqmnl" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_09sxq6k_di" bpmnElement="Flow_09sxq6k">
+        <di:waypoint x="330" y="240" />
+        <di:waypoint x="395" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fkl1gv_di" bpmnElement="Flow_0fkl1gv">
+        <di:waypoint x="620" y="120" />
+        <di:waypoint x="680" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05gp3p7_di" bpmnElement="Flow_05gp3p7">
+        <di:waypoint x="1080" y="760" />
+        <di:waypoint x="1130" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11aacst_di" bpmnElement="Flow_11aacst">
+        <di:waypoint x="940" y="760" />
+        <di:waypoint x="980" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1489mpe_di" bpmnElement="Flow_1489mpe">
+        <di:waypoint x="360" y="760" />
+        <di:waypoint x="400" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16lc641_di" bpmnElement="Flow_16lc641">
+        <di:waypoint x="188" y="760" />
+        <di:waypoint x="260" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_120fe2z_di" bpmnElement="Flow_120fe2z">
+        <di:waypoint x="1610" y="380" />
+        <di:waypoint x="1652" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xchogr_di" bpmnElement="Flow_1xchogr">
+        <di:waypoint x="780" y="760" />
+        <di:waypoint x="840" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05junp8_di" bpmnElement="Flow_05junp8">
+        <di:waypoint x="640" y="760" />
+        <di:waypoint x="680" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ueq9wo_di" bpmnElement="Flow_1ueq9wo">
+        <di:waypoint x="500" y="760" />
+        <di:waypoint x="540" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1mu3zgb_di" bpmnElement="Flow_1mu3zgb">
+        <di:waypoint x="1060" y="380" />
+        <di:waypoint x="1100" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06lgxk9_di" bpmnElement="Flow_06lgxk9">
+        <di:waypoint x="1470" y="380" />
+        <di:waypoint x="1510" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0r7bejs_di" bpmnElement="Flow_0r7bejs">
+        <di:waypoint x="1330" y="380" />
+        <di:waypoint x="1370" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01vilkh_di" bpmnElement="Flow_01vilkh">
+        <di:waypoint x="1200" y="380" />
+        <di:waypoint x="1230" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ks2ut4_di" bpmnElement="Flow_0ks2ut4">
+        <di:waypoint x="920" y="380" />
+        <di:waypoint x="960" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ygfojp_di" bpmnElement="Flow_0ygfojp">
+        <di:waypoint x="940" y="570" />
+        <di:waypoint x="960" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zh5p33_di" bpmnElement="Flow_0zh5p33">
+        <di:waypoint x="1300" y="570" />
+        <di:waypoint x="1330" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hzswil_di" bpmnElement="Flow_1hzswil">
+        <di:waypoint x="1180" y="570" />
+        <di:waypoint x="1200" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1702ljm_di" bpmnElement="Flow_1702ljm">
+        <di:waypoint x="1060" y="570" />
+        <di:waypoint x="1080" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0t8y3x5_di" bpmnElement="Flow_0t8y3x5">
+        <di:waypoint x="450" y="570" />
+        <di:waypoint x="480" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tkrh8z_di" bpmnElement="Flow_0tkrh8z">
+        <di:waypoint x="820" y="570" />
+        <di:waypoint x="840" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yfkps3_di" bpmnElement="Flow_1yfkps3">
+        <di:waypoint x="700" y="570" />
+        <di:waypoint x="720" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cd38vb_di" bpmnElement="Flow_0cd38vb">
+        <di:waypoint x="580" y="570" />
+        <di:waypoint x="600" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06hymr5_di" bpmnElement="Flow_06hymr5">
+        <di:waypoint x="188" y="570" />
+        <di:waypoint x="220" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_19p3d5t_di" bpmnElement="Flow_19p3d5t">
+        <di:waypoint x="320" y="570" />
+        <di:waypoint x="350" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jwk3jy_di" bpmnElement="Flow_1jwk3jy">
+        <di:waypoint x="1620" y="240" />
+        <di:waypoint x="1652" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05cl21h_di" bpmnElement="Flow_05cl21h">
+        <di:waypoint x="1480" y="240" />
+        <di:waypoint x="1520" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1fpw4gf_di" bpmnElement="Flow_1fpw4gf">
+        <di:waypoint x="1340" y="240" />
+        <di:waypoint x="1380" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1p5ruyv_di" bpmnElement="Flow_1p5ruyv">
+        <di:waypoint x="420" y="215" />
+        <di:waypoint x="420" y="120" />
+        <di:waypoint x="520" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="409" y="103" width="56" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14xj79h_di" bpmnElement="Flow_14xj79h">
+        <di:waypoint x="1200" y="240" />
+        <di:waypoint x="1240" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1orjrjp_di" bpmnElement="Flow_1orjrjp">
+        <di:waypoint x="420" y="265" />
+        <di:waypoint x="420" y="380" />
+        <di:waypoint x="520" y="380" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="437" y="363" width="51" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ycw1zo_di" bpmnElement="Flow_1ycw1zo">
+        <di:waypoint x="445" y="240" />
+        <di:waypoint x="520" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="463" y="222" width="39" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ei9866_di" bpmnElement="Flow_0ei9866">
+        <di:waypoint x="1050" y="240" />
+        <di:waypoint x="1100" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0714cfa_di" bpmnElement="Flow_0714cfa">
+        <di:waypoint x="890" y="240" />
+        <di:waypoint x="950" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yfvjui_di" bpmnElement="Flow_1yfvjui">
+        <di:waypoint x="188" y="240" />
+        <di:waypoint x="230" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ym755g_di" bpmnElement="Flow_1ym755g">
+        <di:waypoint x="620" y="240" />
+        <di:waypoint x="660" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0hzibw4_di" bpmnElement="Flow_0hzibw4">
+        <di:waypoint x="760" y="240" />
+        <di:waypoint x="790" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1atfnov_di" bpmnElement="Flow_1atfnov">
+        <di:waypoint x="620" y="380" />
+        <di:waypoint x="670" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09p79e6_di" bpmnElement="Flow_09p79e6">
+        <di:waypoint x="770" y="380" />
+        <di:waypoint x="820" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1giua78_di" bpmnElement="Flow_1giua78">
+        <di:waypoint x="340" y="920" />
+        <di:waypoint x="380" y="920" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1oubjfe_di" bpmnElement="Flow_1oubjfe">
+        <di:waypoint x="480" y="920" />
+        <di:waypoint x="512" y="920" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0wgumc4_di" bpmnElement="Flow_0wgumc4">
+        <di:waypoint x="1430" y="570" />
+        <di:waypoint x="1482" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ei2q6r_di" bpmnElement="Flow_0ei2q6r">
+        <di:waypoint x="198" y="920" />
+        <di:waypoint x="240" y="920" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nyp1l1_di" bpmnElement="Flow_1nyp1l1">
+        <di:waypoint x="1230" y="760" />
+        <di:waypoint x="1282" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17dxvu5_di" bpmnElement="Flow_17dxvu5">
+        <di:waypoint x="780" y="120" />
+        <di:waypoint x="832" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_1sy6p6u_di" bpmnElement="Event_1sy6p6u">
+        <dc:Bounds x="152" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="265" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_01kasfm_di" bpmnElement="Activity_1eiktpg">
+        <dc:Bounds x="230" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0gi40v8_di" bpmnElement="Gateway_0gi40v8" isMarkerVisible="true">
+        <dc:Bounds x="395" y="215" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="347" y="265.5" width="65" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1djbf1x_di" bpmnElement="Activity_0vki9dw">
+        <dc:Bounds x="520" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_09vilc7_di" bpmnElement="Event_058xrlc">
+        <dc:Bounds x="152" y="552" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="133" y="595" width="74" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nexxhu_di" bpmnElement="Activity_1nexxhu">
+        <dc:Bounds x="220" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1rweifb_di" bpmnElement="Activity_1rweifb">
+        <dc:Bounds x="350" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0dr4umy_di" bpmnElement="Activity_0dr4umy">
+        <dc:Bounds x="480" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0e0ldfk_di" bpmnElement="Activity_0e0ldfk">
+        <dc:Bounds x="600" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07kzsym_di" bpmnElement="Activity_07kzsym">
+        <dc:Bounds x="720" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06pgtv8_di" bpmnElement="Activity_06pgtv8">
+        <dc:Bounds x="840" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11ohmvk_di" bpmnElement="Activity_11ohmvk">
+        <dc:Bounds x="960" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11kv5jk_di" bpmnElement="Activity_11kv5jk">
+        <dc:Bounds x="1080" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_031x96n_di" bpmnElement="Activity_031x96n">
+        <dc:Bounds x="1200" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1x48i50_di" bpmnElement="Activity_1x48i50">
+        <dc:Bounds x="1330" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10zcvcv_di" bpmnElement="Activity_10zcvcv">
+        <dc:Bounds x="520" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0m97fsi_di" bpmnElement="Activity_0m97fsi">
+        <dc:Bounds x="400" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wwt0yj_di" bpmnElement="Activity_1wwt0yj">
+        <dc:Bounds x="540" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_18gqpmg_di" bpmnElement="Activity_18gqpmg">
+        <dc:Bounds x="680" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1j4c00v_di" bpmnElement="Activity_1j4c00v">
+        <dc:Bounds x="840" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1uqka61_di" bpmnElement="Event_1vdrrdl">
+        <dc:Bounds x="152" y="742" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="127" y="785" width="86" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_09ku290_di" bpmnElement="Activity_09ku290">
+        <dc:Bounds x="980" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1de2pwc_di" bpmnElement="Activity_0w9oree">
+        <dc:Bounds x="260" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06x7003_di" bpmnElement="Activity_121aiqf">
+        <dc:Bounds x="1130" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w8iqt0_di" bpmnElement="Activity_1w8iqt0">
+        <dc:Bounds x="660" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_00u5sgf_di" bpmnElement="Activity_00u5sgf">
+        <dc:Bounds x="790" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1qswyrk_di" bpmnElement="Activity_1qswyrk">
+        <dc:Bounds x="950" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w537ie_di" bpmnElement="Activity_1w537ie">
+        <dc:Bounds x="1100" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1yl3g1d_di" bpmnElement="Activity_0c8tzf1">
+        <dc:Bounds x="1240" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_12zdzs0_di" bpmnElement="Activity_1so8vif">
+        <dc:Bounds x="1380" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1j6uaol_di" bpmnElement="Event_1wm97cy">
+        <dc:Bounds x="1652" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1639" y="265" width="63" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07pdl82_di" bpmnElement="Activity_0uxxkp1">
+        <dc:Bounds x="1520" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0p57tcv_di" bpmnElement="Event_1x3sb7x">
+        <dc:Bounds x="1652" y="362" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1642" y="405" width="63" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0j3bxt8_di" bpmnElement="Activity_0j3bxt8">
+        <dc:Bounds x="1510" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0sjyngn_di" bpmnElement="Activity_0sjyngn">
+        <dc:Bounds x="1370" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06meubi_di" bpmnElement="Activity_06meubi">
+        <dc:Bounds x="1230" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xdke18_di" bpmnElement="Activity_1xdke18">
+        <dc:Bounds x="1100" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mleulg_di" bpmnElement="Activity_0mleulg">
+        <dc:Bounds x="960" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1pqb2g0_di" bpmnElement="Activity_1pqb2g0">
+        <dc:Bounds x="820" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_171ya99_di" bpmnElement="Activity_137i4pg">
+        <dc:Bounds x="670" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_00zdcuh_di" bpmnElement="Event_00zdcuh">
+        <dc:Bounds x="162" y="902" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="144" y="945" width="73" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mr7bh2_di" bpmnElement="Activity_0mr7bh2">
+        <dc:Bounds x="240" y="880" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_125mjhq_di" bpmnElement="Activity_125mjhq">
+        <dc:Bounds x="380" y="880" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_159m6y8_di" bpmnElement="Event_159m6y8">
+        <dc:Bounds x="512" y="902" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1gy8um0_di" bpmnElement="Event_1gy8um0">
+        <dc:Bounds x="1482" y="552" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1460" y="587" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1304mrw_di" bpmnElement="Event_1304mrw">
+        <dc:Bounds x="1282" y="742" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1260" y="777" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0kcrid0_di" bpmnElement="Activity_0kcrid0">
+        <dc:Bounds x="520" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_05m354s_di" bpmnElement="Activity_05m354s">
+        <dc:Bounds x="680" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_00vqmnl_di" bpmnElement="Event_00vqmnl">
+        <dc:Bounds x="832" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="810" y="137" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0sp6bx7_di" bpmnElement="Activity_0sp6bx7" isExpanded="true">
+        <dc:Bounds x="430" y="1070" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0dafrg8_di" bpmnElement="Flow_0dafrg8">
+        <di:waypoint x="820" y="1174" />
+        <di:waypoint x="890" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jar916_di" bpmnElement="Flow_0jar916">
+        <di:waypoint x="660" y="1174" />
+        <di:waypoint x="720" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0yj2tlu_di" bpmnElement="Flow_0yj2tlu">
+        <di:waypoint x="496" y="1174" />
+        <di:waypoint x="560" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_07c6g27_di" bpmnElement="Flow_07c6g27">
+        <di:waypoint x="990" y="1174" />
+        <di:waypoint x="1098" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0gr296x_di" bpmnElement="Event_0gr296x">
+        <dc:Bounds x="460" y="1156" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1hq0k3q_di" bpmnElement="Event_1hq0k3q">
+        <dc:Bounds x="1098" y="1156" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1awhkox_di" bpmnElement="Activity_1awhkox">
+        <dc:Bounds x="890" y="1134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16up0r1_di" bpmnElement="Activity_16up0r1">
+        <dc:Bounds x="560" y="1134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1h1crsr_di" bpmnElement="Activity_1h1crsr">
+        <dc:Bounds x="720" y="1134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn
new file mode 100644 (file)
index 0000000..fa167d4
--- /dev/null
@@ -0,0 +1,311 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1ejx57e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="Process_1nmtzzp" isExecutable="true">
+    <bpmn:startEvent id="Event_0fbqt56" name="Modify Core NSSI Flow">
+      <bpmn:outgoing>Flow_0e007rx</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0tf735w" name="Get Network Service Instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_06j2avj</bpmn:incoming>
+      <bpmn:outgoing>Flow_1mqjtfk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.getNetworkServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1ce41n6" name="Get constitute VNF from Network Service Instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1mqjtfk</bpmn:incoming>
+      <bpmn:outgoing>Flow_184tfp7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.getConstituteVNFFromNetworkServiceInst(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1mqjtfk" sourceRef="Activity_0tf735w" targetRef="Activity_1ce41n6" />
+    <bpmn:scriptTask id="Activity_02skgkj" name="Get NSSI associated profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_184tfp7</bpmn:incoming>
+      <bpmn:outgoing>Flow_0s31teg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.getNSSIAssociatedProfiles(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_184tfp7" sourceRef="Activity_1ce41n6" targetRef="Activity_02skgkj" />
+    <bpmn:exclusiveGateway id="Gateway_1hadnun" name="Is Slice Profile Instance has to be created" default="Flow_03gf14v">
+      <bpmn:incoming>Flow_0s31teg</bpmn:incoming>
+      <bpmn:outgoing>Flow_1pls2hu</bpmn:outgoing>
+      <bpmn:outgoing>Flow_03gf14v</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0s31teg" sourceRef="Activity_02skgkj" targetRef="Gateway_1hadnun" />
+    <bpmn:intermediateThrowEvent id="Event_1243wg1" name="Goto Slice Profile Instance has to be created">
+      <bpmn:incoming>Flow_1pls2hu</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_14qnw6y" name="SliceProfileInstanceHasToBeCreated" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_1pls2hu" name="yes" sourceRef="Gateway_1hadnun" targetRef="Event_1243wg1">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isCreateSliceProfileInstance" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="Event_1gjhrcq" name="Goto Slice profile instance has to be deleted">
+      <bpmn:incoming>Flow_03gf14v</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0ecwvhj" name="SliceProfileInstanceHasToBeDeleted" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_03gf14v" name="no" sourceRef="Gateway_1hadnun" targetRef="Event_1gjhrcq" />
+    <bpmn:scriptTask id="Activity_0oph5am" name="Update Service Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0l7hcnf</bpmn:incoming>
+      <bpmn:incoming>Flow_0lrenyo</bpmn:incoming>
+      <bpmn:outgoing>Flow_0yq24um</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoDeallocateCoreNSSI()
+        mcnssi.updateServiceOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:endEvent id="Event_1p0mogo" name="End">
+      <bpmn:incoming>Flow_0yq24um</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0yq24um" sourceRef="Activity_0oph5am" targetRef="Event_1p0mogo" />
+    <bpmn:intermediateCatchEvent id="Event_0z9mer1" name="Slice Profile Instance has to be created">
+      <bpmn:outgoing>Flow_1xysykm</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0fbskyk" name="SliceProfileInstanceHasToBeCreated" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateCatchEvent id="Event_0m2jn7c" name="Slice profile instance has to be deleted">
+      <bpmn:outgoing>Flow_11vf6ik</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1lptuqv" name="SliceProfileInstanceHasToBeDeleted" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_0ouov98" name="Calculate S-NSSAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1xysykm</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nxaeez</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.calculateSNSSAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1xysykm" sourceRef="Event_0z9mer1" targetRef="Activity_0ouov98" />
+    <bpmn:scriptTask id="Activity_00t4mmi" name="Invoke PUT Service Instance API" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1nxaeez</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ccqmju</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1nxaeez" sourceRef="Activity_0ouov98" targetRef="Activity_00t4mmi" />
+    <bpmn:scriptTask id="Activity_1q02wiz" name="Create a slice profile instance\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ccqmju</bpmn:incoming>
+      <bpmn:outgoing>Flow_1fdpbsx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        mcnssi.createSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0ccqmju" sourceRef="Activity_00t4mmi" targetRef="Activity_1q02wiz" />
+    <bpmn:scriptTask id="Activity_1josmor" name="Associate slice profile instance the same with the NSSI\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1fdpbsx</bpmn:incoming>
+      <bpmn:outgoing>Flow_0l7hcnf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        mcnssi.associateSliceProfileInstanceWithNSSI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1fdpbsx" sourceRef="Activity_1q02wiz" targetRef="Activity_1josmor" />
+    <bpmn:scriptTask id="Activity_0j4c22q" name="Calculate S-NSSAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_11vf6ik</bpmn:incoming>
+      <bpmn:outgoing>Flow_1oeokwy</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.calculateSNSSAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_11vf6ik" sourceRef="Event_0m2jn7c" targetRef="Activity_0j4c22q" />
+    <bpmn:scriptTask id="Activity_0c4wmiz" name="Invoke PUT Service Instance API" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1oeokwy</bpmn:incoming>
+      <bpmn:outgoing>Flow_15fi92t</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1oeokwy" sourceRef="Activity_0j4c22q" targetRef="Activity_0c4wmiz" />
+    <bpmn:scriptTask id="Activity_1iegufd" name="Remove the NSSI to slice instance association\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_15fi92t</bpmn:incoming>
+      <bpmn:outgoing>Flow_1wtv1zj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        mcnssi.removeNSSIToSliceInstanceAssociation(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_15fi92t" sourceRef="Activity_0c4wmiz" targetRef="Activity_1iegufd" />
+    <bpmn:scriptTask id="Activity_010nkjp" name="Delete the slice profile instance\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1wtv1zj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0lrenyo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        mcnssi.deleteSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1wtv1zj" sourceRef="Activity_1iegufd" targetRef="Activity_010nkjp" />
+    <bpmn:sequenceFlow id="Flow_0l7hcnf" sourceRef="Activity_1josmor" targetRef="Activity_0oph5am" />
+    <bpmn:sequenceFlow id="Flow_0lrenyo" sourceRef="Activity_010nkjp" targetRef="Activity_0oph5am" />
+    <bpmn:scriptTask id="Activity_0klj7y1" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0e007rx</bpmn:incoming>
+      <bpmn:outgoing>Flow_06j2avj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+        def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0e007rx" sourceRef="Event_0fbqt56" targetRef="Activity_0klj7y1" />
+    <bpmn:sequenceFlow id="Flow_06j2avj" sourceRef="Activity_0klj7y1" targetRef="Activity_0tf735w" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1nmtzzp">
+      <bpmndi:BPMNEdge id="Flow_0lrenyo_di" bpmnElement="Flow_0lrenyo">
+        <di:waypoint x="890" y="600" />
+        <di:waypoint x="930" y="600" />
+        <di:waypoint x="930" y="540" />
+        <di:waypoint x="970" y="540" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0l7hcnf_di" bpmnElement="Flow_0l7hcnf">
+        <di:waypoint x="890" y="430" />
+        <di:waypoint x="930" y="430" />
+        <di:waypoint x="930" y="500" />
+        <di:waypoint x="970" y="500" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1wtv1zj_di" bpmnElement="Flow_1wtv1zj">
+        <di:waypoint x="730" y="600" />
+        <di:waypoint x="790" y="600" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15fi92t_di" bpmnElement="Flow_15fi92t">
+        <di:waypoint x="560" y="600" />
+        <di:waypoint x="630" y="600" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1oeokwy_di" bpmnElement="Flow_1oeokwy">
+        <di:waypoint x="380" y="600" />
+        <di:waypoint x="460" y="600" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11vf6ik_di" bpmnElement="Flow_11vf6ik">
+        <di:waypoint x="218" y="600" />
+        <di:waypoint x="280" y="600" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1fdpbsx_di" bpmnElement="Flow_1fdpbsx">
+        <di:waypoint x="730" y="430" />
+        <di:waypoint x="790" y="430" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ccqmju_di" bpmnElement="Flow_0ccqmju">
+        <di:waypoint x="560" y="430" />
+        <di:waypoint x="630" y="430" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nxaeez_di" bpmnElement="Flow_1nxaeez">
+        <di:waypoint x="390" y="430" />
+        <di:waypoint x="460" y="430" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xysykm_di" bpmnElement="Flow_1xysykm">
+        <di:waypoint x="218" y="430" />
+        <di:waypoint x="290" y="430" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0yq24um_di" bpmnElement="Flow_0yq24um">
+        <di:waypoint x="1070" y="520" />
+        <di:waypoint x="1132" y="520" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_03gf14v_di" bpmnElement="Flow_03gf14v">
+        <di:waypoint x="1010" y="175" />
+        <di:waypoint x="1010" y="252" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1019" y="190" width="13" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pls2hu_di" bpmnElement="Flow_1pls2hu">
+        <di:waypoint x="1035" y="150" />
+        <di:waypoint x="1132" y="150" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1049" y="132" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0s31teg_di" bpmnElement="Flow_0s31teg">
+        <di:waypoint x="910" y="150" />
+        <di:waypoint x="985" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_184tfp7_di" bpmnElement="Flow_184tfp7">
+        <di:waypoint x="720" y="150" />
+        <di:waypoint x="810" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1mqjtfk_di" bpmnElement="Flow_1mqjtfk">
+        <di:waypoint x="540" y="150" />
+        <di:waypoint x="620" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0e007rx_di" bpmnElement="Flow_0e007rx">
+        <di:waypoint x="218" y="150" />
+        <di:waypoint x="280" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06j2avj_di" bpmnElement="Flow_06j2avj">
+        <di:waypoint x="380" y="150" />
+        <di:waypoint x="440" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0fbqt56_di" bpmnElement="Event_0fbqt56">
+        <dc:Bounds x="182" y="132" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="175" width="89" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0oph5am_di" bpmnElement="Activity_0oph5am">
+        <dc:Bounds x="970" y="480" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1p0mogo_di" bpmnElement="Event_1p0mogo">
+        <dc:Bounds x="1132" y="502" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1140" y="478" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0z9mer1_di" bpmnElement="Event_0z9mer1">
+        <dc:Bounds x="182" y="412" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="162" y="455" width="90" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0m2jn7c_di" bpmnElement="Event_0m2jn7c">
+        <dc:Bounds x="182" y="582" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="155" y="625" width="90" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ouov98_di" bpmnElement="Activity_0ouov98">
+        <dc:Bounds x="290" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_00t4mmi_di" bpmnElement="Activity_00t4mmi">
+        <dc:Bounds x="460" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1q02wiz_di" bpmnElement="Activity_1q02wiz">
+        <dc:Bounds x="630" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1josmor_di" bpmnElement="Activity_1josmor">
+        <dc:Bounds x="790" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0j4c22q_di" bpmnElement="Activity_0j4c22q">
+        <dc:Bounds x="280" y="560" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0c4wmiz_di" bpmnElement="Activity_0c4wmiz">
+        <dc:Bounds x="460" y="560" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1iegufd_di" bpmnElement="Activity_1iegufd">
+        <dc:Bounds x="630" y="560" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_010nkjp_di" bpmnElement="Activity_010nkjp">
+        <dc:Bounds x="790" y="560" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1243wg1_di" bpmnElement="Event_1243wg1">
+        <dc:Bounds x="1132" y="132" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1113" y="173" width="90" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true">
+        <dc:Bounds x="985" y="125" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="974" y="86" width="75" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq">
+        <dc:Bounds x="992" y="252" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="973" y="293" width="90" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_02skgkj_di" bpmnElement="Activity_02skgkj">
+        <dc:Bounds x="810" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ce41n6_di" bpmnElement="Activity_1ce41n6">
+        <dc:Bounds x="620" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tf735w_di" bpmnElement="Activity_0tf735w">
+        <dc:Bounds x="440" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1">
+        <dc:Bounds x="280" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyRanNfNssi.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyRanNfNssi.bpmn
new file mode 100644 (file)
index 0000000..1af4ff9
--- /dev/null
@@ -0,0 +1,91 @@
+<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0misy4e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoModifyRanNfNssi" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>Flow_0f9s9j7</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0bbh5uy" name="preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0f9s9j7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1kdh0gl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyRanNfNssi()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0f9s9j7" sourceRef="StartEvent_1" targetRef="Activity_0bbh5uy" />
+    <bpmn:sequenceFlow id="Flow_1kdh0gl" sourceRef="Activity_0bbh5uy" targetRef="Activity_1rs1l5c" />
+    <bpmn:scriptTask id="Activity_1rs1l5c" name="prepare SDNR request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1kdh0gl</bpmn:incoming>
+      <bpmn:outgoing>Flow_0n0zzp4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyRanNfNssi()
+nss.createSdnrRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1jpoqws" name="call sdnr for RAN NF NSSI creation" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="createNSSI_sdnrRequest" target="sdnrRequest" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_asyncCallbackResponse" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="createNSSI_correlator" target="correlator" />
+        <camunda:in source="createNSSI_messageType" target="messageType" />
+        <camunda:in source="createNSSI_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0n0zzp4</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b0cez1</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_03xcmka" name="process SDNR response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b0cez1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ngijid</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyRanNfNssi()
+nss.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0n0zzp4" sourceRef="Activity_1rs1l5c" targetRef="Activity_1jpoqws" />
+    <bpmn:sequenceFlow id="Flow_1b0cez1" sourceRef="Activity_1jpoqws" targetRef="Activity_03xcmka" />
+    <bpmn:sequenceFlow id="Flow_1ngijid" sourceRef="Activity_03xcmka" targetRef="Event_086qr2t" />
+    <bpmn:endEvent id="Event_086qr2t">
+      <bpmn:incoming>Flow_1ngijid</bpmn:incoming>
+    </bpmn:endEvent>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyRanNfNssi">
+      <bpmndi:BPMNEdge id="Flow_1ngijid_di" bpmnElement="Flow_1ngijid">
+        <di:waypoint x="730" y="100" />
+        <di:waypoint x="772" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b0cez1_di" bpmnElement="Flow_1b0cez1">
+        <di:waypoint x="590" y="100" />
+        <di:waypoint x="630" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0n0zzp4_di" bpmnElement="Flow_0n0zzp4">
+        <di:waypoint x="460" y="100" />
+        <di:waypoint x="490" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1kdh0gl_di" bpmnElement="Flow_1kdh0gl">
+        <di:waypoint x="320" y="100" />
+        <di:waypoint x="360" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0f9s9j7_di" bpmnElement="Flow_0f9s9j7">
+        <di:waypoint x="188" y="100" />
+        <di:waypoint x="220" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="82" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0bbh5uy_di" bpmnElement="Activity_0bbh5uy">
+        <dc:Bounds x="220" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1rs1l5c_di" bpmnElement="Activity_1rs1l5c">
+        <dc:Bounds x="360" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1jpoqws_di" bpmnElement="Activity_1jpoqws">
+        <dc:Bounds x="490" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03xcmka_di" bpmnElement="Activity_03xcmka">
+        <dc:Bounds x="630" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_086qr2t_di" bpmnElement="Event_086qr2t">
+        <dc:Bounds x="772" y="82" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..d70bed6
--- /dev/null
@@ -0,0 +1,222 @@
+<?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoModifyTransportNSSI" name="DoModifyTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Modify TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_1akxvak</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Modified TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0ziz3ti" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0h5rwlh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "modified")
+def runScript = new DoModifyTnNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_0phv8e5" name="Modify TN NSSI in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def runScript = new DoModifyTnNssi()
+runScript.updateTnNssiInAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_0h1vr2l" />
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoModifyTnNssi()
+runScript.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_0phv8e5" />
+    <bpmn:scriptTask id="Activity_0h1vr2l" name="PreProcess SDNC Modify  TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1dvo5ih</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoModifyTnNssi()
+runScript.preprocessSdncModifyTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1dvo5ih" sourceRef="Activity_0h1vr2l" targetRef="Activity_14ab476" />
+    <bpmn:callActivity id="Activity_14ab476" name="Call SDNC Adapter: Modify TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <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="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1dvo5ih</bpmn:incoming>
+      <bpmn:outgoing>Flow_139j3yd</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_139j3yd" sourceRef="Activity_14ab476" targetRef="Activity_1vtz33q" />
+    <bpmn:scriptTask id="Activity_1vtz33q" name="Postprocess SDNC Modify TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_139j3yd</bpmn:incoming>
+      <bpmn:outgoing>Flow_0h5rwlh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def runScript = new DoModifyTnNssi()
+runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0h5rwlh" sourceRef="Activity_1vtz33q" targetRef="ScriptTask_19uxoi8" />
+    <bpmn:serviceTask id="Activity_0ziz3ti" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1akxvak</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1akxvak" sourceRef="Activity_0ziz3ti" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_0h5rwlh_di" bpmnElement="Flow_0h5rwlh">
+        <di:waypoint x="1240" y="121" />
+        <di:waypoint x="1380" y="121" />
+        <di:waypoint x="1380" y="210" />
+        <di:waypoint x="335" y="210" />
+        <di:waypoint x="335" y="310" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_139j3yd_di" bpmnElement="Flow_139j3yd">
+        <di:waypoint x="1010" y="121" />
+        <di:waypoint x="1119" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1dvo5ih_di" bpmnElement="Flow_1dvo5ih">
+        <di:waypoint x="806" y="121" />
+        <di:waypoint x="889" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="479" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+        <di:waypoint x="600" y="121" />
+        <di:waypoint x="685" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="385" y="350" />
+        <di:waypoint x="530" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="630" y="350" />
+        <di:waypoint x="740" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1akxvak_di" bpmnElement="Flow_1akxvak">
+        <di:waypoint x="840" y="350" />
+        <di:waypoint x="1002" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="161" y="146" width="86" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ziz3ti_di" bpmnElement="Activity_0ziz3ti">
+        <dc:Bounds x="740" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1002" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1010" y="375" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="530" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="285" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="479" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0h1vr2l_di" bpmnElement="Activity_0h1vr2l">
+        <dc:Bounds x="685" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14ab476_di" bpmnElement="Activity_14ab476">
+        <dc:Bounds x="889" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vtz33q_di" bpmnElement="Activity_1vtz33q">
+        <dc:Bounds x="1119" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 8d45048..ed82500 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.so.beans.nsmf;
 
+import java.util.List;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
@@ -33,6 +34,10 @@ public class ActDeActNssi {
 
     private String nssiId;
 
+    private String sliceProfileId;
+
+    private List<String> snssaiList;
+
     public String getNsiId() {
         return nsiId;
     }
@@ -48,4 +53,20 @@ public class ActDeActNssi {
     public void setNssiId(String nssiId) {
         this.nssiId = nssiId;
     }
+
+    public String getSliceProfileId() {
+        return sliceProfileId;
+    }
+
+    public void setSliceProfileId(String sliceProfileId) {
+        this.sliceProfileId = sliceProfileId;
+    }
+
+    public List<String> getSnssaiList() {
+        return snssaiList;
+    }
+
+    public void setSnssaiList(List<String> snssaiList) {
+        this.snssaiList = snssaiList;
+    }
 }
index 1ee83c7..399d51e 100644 (file)
@@ -25,7 +25,6 @@ import java.util.List;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class DeAllocateNssi {
-
     @Deprecated
     public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
 
@@ -42,6 +41,16 @@ public class DeAllocateNssi {
 
     private String extension;
 
+    private String sliceProfileId;
+
+    public String getSliceProfileId() {
+        return sliceProfileId;
+    }
+
+    public void setSliceProfileId(String sliceProfileId) {
+        this.sliceProfileId = sliceProfileId;
+    }
+
     public String getNsiId() {
         return nsiId;
     }
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
new file mode 100644 (file)
index 0000000..dd1292e
--- /dev/null
@@ -0,0 +1,33 @@
+package org.onap.so.beans.nsmf;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.oof.TemplateInfo;
+import java.io.Serializable;
+
+@Data
+public class SliceTaskInfo<T> implements Serializable {
+    private static final long serialVersionUID = 7580056468353975320L;
+
+    private String suggestNssiId;
+
+    private String suggestNssiName;
+
+    private String progress;
+
+    private String status;
+
+    private String statusDescription;
+
+    private T sliceProfile;
+
+    private TemplateInfo NSSTInfo;
+
+    private String serviceInstanceId;
+
+    private String scriptName;
+
+    private String vendor;
+
+    private NetworkType networkType;
+
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
new file mode 100644 (file)
index 0000000..cab209e
--- /dev/null
@@ -0,0 +1,36 @@
+package org.onap.so.beans.nsmf;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.oof.TemplateInfo;
+
+
+@Data
+public class SliceTaskParamsAdapter {
+    private static final long serialVersionUID = -7785578865170503301L;
+
+    private String serviceId;
+
+    private String serviceName;
+
+    private String nstId;
+
+    private String nstName;
+
+    private ServiceProfile serviceProfile;
+
+    private String suggestNsiId;
+
+    private String suggestNsiName;
+
+    private TemplateInfo NSTInfo;
+
+    private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo;
+
+    private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo;
+
+    private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo;
+
+    private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo;
+
+    private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo;
+}
index c3548f1..be530bf 100644 (file)
@@ -25,11 +25,21 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class TnSliceProfile {
 
+    private String sliceProfileId;
+
     private String bandwidth;
 
     @JsonInclude(JsonInclude.Include.NON_DEFAULT)
     private int latency;
 
+    public String getSliceProfileId() {
+        return sliceProfileId;
+    }
+
+    public void setSliceProfileId(String sliceProfileId) {
+        this.sliceProfileId = sliceProfileId;
+    }
+
     public String getBandwidth() {
         return bandwidth;
     }
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/DomainType.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/DomainType.java
new file mode 100644 (file)
index 0000000..4af60cf
--- /dev/null
@@ -0,0 +1,27 @@
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Getter;
+import org.onap.so.beans.nsmf.NetworkType;
+
+@Getter
+public enum DomainType {
+
+    AN_NF("AN-NF", NetworkType.ACCESS),
+
+    CN("CN", NetworkType.CORE),
+
+    TN_FH("TN-FH", NetworkType.TRANSPORT),
+
+    TN_MH("TN-MH", NetworkType.TRANSPORT),
+
+    TN_BH("TN-BH", NetworkType.TRANSPORT),;
+
+    private NetworkType networkType;
+
+    private String domainType;
+
+    DomainType(String domainType, NetworkType networkType) {
+        this.domainType = domainType;
+        this.networkType = networkType;
+    }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/NsiReqBody.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/NsiReqBody.java
new file mode 100644 (file)
index 0000000..e1829eb
--- /dev/null
@@ -0,0 +1,23 @@
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.ServiceProfile;
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class NsiReqBody implements Serializable {
+    private static final long serialVersionUID = -1383112063216226985L;
+
+    private ServiceProfile serviceProfile;
+
+    private RequestInfo requestInfo;
+
+    private TemplateInfo NSTInfo;
+
+    private List<TemplateInfo> NSSTInfo;
+
+    private Boolean preferReuse;
+
+    private List<SubnetCapability> subnetCapabilities;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java
new file mode 100644 (file)
index 0000000..0632ab7
--- /dev/null
@@ -0,0 +1,17 @@
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.ServiceProfile;
+import java.io.Serializable;
+
+@Data
+public class NssiReqBody implements Serializable {
+
+    private static final long serialVersionUID = -76327522074333341L;
+
+    private ServiceProfile serviceProfile;
+
+    private RequestInfo requestInfo;
+
+    private TemplateInfo NSSTInfo;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java
new file mode 100644 (file)
index 0000000..f900c35
--- /dev/null
@@ -0,0 +1,27 @@
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Map;
+
+@Data
+public class RequestInfo implements Serializable {
+
+    private static final long serialVersionUID = -875589918188540922L;
+
+    private String transactionId;
+
+    private String requestId;
+
+    private String callbackUrl;
+
+    private Map<?, ?> callbackHeader;
+
+    private String sourceId;
+
+    private Integer numSolutions;
+
+    private Integer timeout;
+
+    private Map<?, ?> addtnlArgs;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetCapability.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetCapability.java
new file mode 100644 (file)
index 0000000..f21c1c3
--- /dev/null
@@ -0,0 +1,15 @@
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Map;
+
+@Data
+public class SubnetCapability implements Serializable {
+
+    private static final long serialVersionUID = -7671021271451538821L;
+
+    private String domainType;
+
+    private Map<?, ?> capabilityDetails;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/TemplateInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/TemplateInfo.java
new file mode 100644 (file)
index 0000000..3713bc7
--- /dev/null
@@ -0,0 +1,17 @@
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import java.io.Serializable;
+
+
+@Data
+public class TemplateInfo implements Serializable {
+
+    private static final long serialVersionUID = 4237411651259839093L;
+
+    private String UUID;
+
+    private String invariantUUID;
+
+    private String name;
+}
index dc9bf47..d95ef8d 100644 (file)
               <singularClass>org.onap.aaiclient.client.aai.AAIObjectType</singularClass>
               <pluralClass>org.onap.aaiclient.client.aai.AAIObjectPlurals</pluralClass>
               <nameClass>org.onap.aaiclient.client.aai.AAIObjectName</nameClass>
+              <singleFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAISingleFragment</singleFragmentClass>
+              <pluralFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAIPluralFragment</pluralFragmentClass>
             </configuration>
           </execution>
         </executions>
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java
new file mode 100644 (file)
index 0000000..4733c55
--- /dev/null
@@ -0,0 +1,20 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import java.io.Serializable;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment;
+
+public class AAIPluralFragment implements Serializable, GraphInventoryPluralFragment<AAIFluentPluralType> {
+
+    private static final long serialVersionUID = 1L;
+
+    private final AAIFluentPluralType type;
+
+    public AAIPluralFragment(AAIFluentPluralType type) {
+        this.type = type;
+    }
+
+    public AAIFluentPluralType get() {
+        return type;
+    }
+
+}
index 3d01258..3d7fc0e 100644 (file)
@@ -5,6 +5,6 @@ import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
 
 public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>,
-        GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> {
+        GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment> {
 
 }
index 40184b0..041c02f 100644 (file)
@@ -26,7 +26,8 @@ import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.graphinventory.entities.uri.SimpleUri;
 
-public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals>
+public class AAISimpleUri extends
+        SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment>
         implements AAIResourceUri {
 
     private static final long serialVersionUID = -6397024057188453229L;
@@ -70,4 +71,16 @@ public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri
         return new AAISimplePluralUri(this, plural);
     }
 
+    @Override
+    public AAISimpleUri relatedTo(AAISingleFragment fragment) {
+        this.internalURI.path(relatedTo);
+        return new AAISimpleUri(this, fragment.get().build(), fragment.get().values());
+    }
+
+    @Override
+    public AAISimplePluralUri relatedTo(AAIPluralFragment fragment) {
+        this.internalURI.path(relatedTo);
+        return new AAISimplePluralUri(this, fragment.get().build());
+    }
+
 }
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java
new file mode 100644 (file)
index 0000000..a988899
--- /dev/null
@@ -0,0 +1,19 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import java.io.Serializable;
+import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment;
+
+public class AAISingleFragment implements Serializable, GraphInventorySingleFragment<AAIFluentSingleType> {
+
+    private static final long serialVersionUID = 1L;
+
+    private final AAIFluentSingleType type;
+
+    public AAISingleFragment(AAIFluentSingleType type) {
+        this.type = type;
+    }
+
+    public AAIFluentSingleType get() {
+        return type;
+    }
+}
index 1a258fc..3970a36 100644 (file)
@@ -1,16 +1,25 @@
 package org.onap.aaiclient.client.graphinventory;
 
+import java.util.Collections;
 import java.util.List;
 
 public interface GraphInventoryFluentTypeBase {
 
     public interface Info {
-        String getPartialUri();
+        default String getPartialUri() {
+            return "";
+        }
 
-        List<String> getPaths();
+        default List<String> getPaths() {
+            return Collections.emptyList();
+        }
     }
 
-    Object[] values();
+    default Object[] values() {
+        return new Object[] {};
+    }
 
-    String uriTemplate();
+    default String uriTemplate() {
+        return "";
+    }
 }
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java
new file mode 100644 (file)
index 0000000..b8cb64d
--- /dev/null
@@ -0,0 +1,6 @@
+package org.onap.aaiclient.client.graphinventory;
+
+public interface GraphInventoryFragmentBase<T> {
+
+    T get();
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java
new file mode 100644 (file)
index 0000000..9fe3cda
--- /dev/null
@@ -0,0 +1,9 @@
+package org.onap.aaiclient.client.graphinventory;
+
+
+
+public interface GraphInventoryPluralFragment<T extends GraphInventoryFluentType<? extends GraphInventoryObjectPlurals>>
+        extends GraphInventoryFragmentBase<T> {
+
+
+}
index c564c5d..343e888 100644 (file)
@@ -33,8 +33,6 @@ import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.client.RestClient;
-import org.onap.so.client.RestProperties;
 import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel;
 import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper;
 import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
@@ -42,8 +40,10 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResou
 import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
 import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
 
-public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
+public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
 
     protected GraphInventoryClient client;
 
@@ -101,7 +101,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void connect(SingleUri uriA, SingleUri uriB) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
         RestClient giRC = client.createClient(uriAClone.relationshipAPI());
         giRC.put(this.buildRelationship(uriB));
     }
@@ -115,7 +115,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
         RestClient giRC = client.createClient(uriAClone.relationshipAPI());
         giRC.put(this.buildRelationship(uriB, label));
     }
@@ -128,7 +128,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void disconnect(SingleUri uriA, SingleUri uriB) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
         RestClient giRC = client.createClient(uriAClone.relationshipAPI());
         giRC.delete(this.buildRelationship(uriB));
     }
@@ -140,7 +140,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void delete(SingleUri uri) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> clone = (SingleUri) uri.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> clone = (SingleUri) uri.clone();
         RestClient giRC = client.createClient(clone);
         Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>() {}).orElseThrow(
                 () -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName()));
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java
new file mode 100644 (file)
index 0000000..711b93d
--- /dev/null
@@ -0,0 +1,7 @@
+package org.onap.aaiclient.client.graphinventory;
+
+public interface GraphInventorySingleFragment<T extends GraphInventoryFluentType<? extends GraphInventoryObjectType>>
+        extends GraphInventoryFragmentBase<T> {
+
+
+}
index 7f7822b..4390e7e 100644 (file)
@@ -34,7 +34,7 @@ import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> {
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> {
 
     protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
 
index 881b7e9..cc286a6 100644 (file)
@@ -36,7 +36,7 @@ import org.onap.so.jsonpath.JsonPathUtil;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, Type extends GraphInventoryObjectType> {
+public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, Type extends GraphInventoryObjectType> {
 
     protected final ObjectMapper mapper;
     protected Map<String, Object> map;
index ac0e4a0..fbd4130 100644 (file)
@@ -2,8 +2,10 @@ package org.onap.aaiclient.client.graphinventory.entities.uri;
 
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment;
+import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment;
 
-public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals>
+public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals, SingleFragment extends GraphInventorySingleFragment, PluralFragment extends GraphInventoryPluralFragment>
         extends GraphInventoryResourceUri<T, SingleObject> {
 
     public T resourceVersion(String version);
@@ -13,4 +15,8 @@ public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleR
     public P relatedTo(PluralObject plural);
 
     public T relatedTo(SingleObject type, String... values);
+
+    public P relatedTo(PluralFragment fragment);
+
+    public T relatedTo(SingleFragment fragment);
 }
index b668f46..d1e9e91 100644 (file)
@@ -22,7 +22,7 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParserSp
 import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
 import org.springframework.web.util.UriUtils;
 
-public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, S extends GraphInventoryObjectBase>
+public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, S extends GraphInventoryObjectBase>
         implements GraphInventoryResourceUri<T, S> {
 
     private static final long serialVersionUID = -1011069933894179423L;
index d766615..1a3b38a 100644 (file)
@@ -28,7 +28,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
 
-public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType>
+public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType>
         extends SimpleBaseUri<T, Parent, PT> implements GraphInventoryPluralResourceUri<T, PT>, Serializable {
 
     private static final long serialVersionUID = -337701171277616439L;
index e6a162b..570856d 100644 (file)
@@ -27,9 +27,11 @@ import java.net.URI;
 import javax.ws.rs.core.UriBuilder;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment;
+import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment;
 
-public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals>
-        extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P> {
+public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals, SF extends GraphInventorySingleFragment<?>, PF extends GraphInventoryPluralFragment<?>>
+        extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P, SF, PF> {
 
     private static final long serialVersionUID = -337701171277616439L;
     protected static final String relationshipAPI = "/relationship-list/relationship";
index f8dd172..92e7416 100644 (file)
@@ -32,6 +32,7 @@ import org.junit.Test;
 import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
 
 public class AAISimpleUriTest {
@@ -43,7 +44,14 @@ public class AAISimpleUriTest {
         AAIPluralResourceUri uri =
                 AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
         String uriOutput = uri.build().toString();
-        assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
+
+        String expected = "/network/generic-vnfs/generic-vnf/test1/related-to/pservers";
+        assertEquals(expected, uriOutput);
+
+        uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
+                .relatedTo(Types.PSERVERS.getFragment());
+        uriOutput = uri.build().toString();
+        assertEquals(expected, uriOutput);
     }
 
     @Test
@@ -51,7 +59,17 @@ public class AAISimpleUriTest {
         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
                 .relatedTo(AAIObjectType.PSERVER, "test2");
         String uriOutput = uri.build().toString();
-        assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
+
+        String expected = "/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2";
+        assertEquals(expected, uriOutput);
+
+        uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
+                .relatedTo(Types.PSERVER.getFragment("test2"));
+
+        uriOutput = uri.build().toString();
+
+        assertEquals(expected, uriOutput);
+
     }
 
     @Test
index 4a8b7d9..efbeba2 100644 (file)
@@ -39,11 +39,13 @@ public class FluentGenerator {
     private final String pluralClass;
     private final String builderName;
     private final String nameClass;
+    private final String singleFragmentClass;
+    private final String pluralFragmentClass;
 
     public FluentGenerator(Log log, String location, String destinationClasspath, String swaggerLocation,
             String builderName, String singularBuilderClass, String pluralBuilderClass, String topLevelBuilderClass,
-            String baseBuilderClass, String singularClass, String pluralClass, String nameClass)
-            throws JsonProcessingException {
+            String baseBuilderClass, String singularClass, String pluralClass, String nameClass,
+            String singleFragmentClass, String pluralFragmentClass) throws JsonProcessingException {
 
         this.location = location;
         this.CLASSPATH = destinationClasspath;
@@ -55,6 +57,8 @@ public class FluentGenerator {
         this.singularClass = singularClass;
         this.pluralClass = pluralClass;
         this.nameClass = nameClass;
+        this.singleFragmentClass = singleFragmentClass;
+        this.pluralFragmentClass = pluralFragmentClass;
         doc = new SwaggerConverter(log).getDoc(swaggerLocation);
     }
 
@@ -241,7 +245,8 @@ public class FluentGenerator {
     }
 
     protected TypeSpec createTypes() {
-        List<FieldSpec> params = doc.values().stream().filter(item -> item.getType().equals("singular"))
+        List<FieldSpec> params = doc.values().stream()
+                .filter(item -> item.getType().equals("singular") || item.getType().equals("plural"))
                 .sorted(Comparator.comparing(item -> item.getName())).map(item -> {
                     ClassName nameType =
                             ClassName.get(CLASSPATH, CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, item.getName()))
@@ -274,6 +279,18 @@ public class FluentGenerator {
                         "\"" + oType.getPaths().stream().collect(Collectors.joining("\", \"")) + "\"")
                 .build());
 
+        if (oType.getType().equals("plural")) {
+            Pair<String, String> path = splitClasspath(this.pluralFragmentClass);
+            ClassName fragmentClass = ClassName.get(path.getLeft(), path.getRight());
+            path = splitClasspath(this.baseBuilderClass);
+            ClassName baseClass = ClassName.get(path.getLeft(), path.getRight());
+
+            classFields.add(FieldSpec.builder(fragmentClass, "fragment")
+                    .addModifiers(Modifier.PRIVATE, Modifier.FINAL, Modifier.STATIC)
+                    .initializer("new $T(new $L(new $T(){}))", fragmentClass, upperCamel(oType.getName()), baseClass)
+                    .build());
+        }
+
         ClassName superInterface;
         String name;
         if (oType.getType().equals("plural")) {
@@ -294,6 +311,34 @@ public class FluentGenerator {
                 .addModifiers(Modifier.PUBLIC).addAnnotation(Override.class).addStatement("return Info.paths").build());
         methods.add(MethodSpec.methodBuilder("getPartialUri").returns(String.class).addModifiers(Modifier.PUBLIC)
                 .addAnnotation(Override.class).addStatement("return Info.partialUri").build());
+
+        if (oType.getType().equals("plural")) {
+            Pair<String, String> path = splitClasspath(this.pluralFragmentClass);
+            ClassName fragmentClass = ClassName.get(path.getLeft(), path.getRight());
+            methods.add(MethodSpec.methodBuilder("getFragment").returns(fragmentClass).addModifiers(Modifier.PUBLIC)
+                    .addStatement("return fragment").build());
+        } else if (oType.getType().equals("singular")) {
+            Pair<String, String> path = splitClasspath(this.singleFragmentClass);
+            ClassName fragmentClass = ClassName.get(path.getLeft(), path.getRight());
+            path = splitClasspath(this.baseBuilderClass);
+            ClassName baseClass = ClassName.get(path.getLeft(), path.getRight());
+            List<ParameterSpec> typeParams = new ArrayList<>();
+
+            for (ObjectField oF : oType.getFields()) {
+                if (oF.getType().equals("string")) {
+                    typeParams.add(ParameterSpec.builder(String.class, lowerCamel(makeValidJavaVariable(oF.getName())))
+                            .build());
+                } else if (oF.getType().equals("integer")) {
+                    typeParams.add(
+                            ParameterSpec.builder(int.class, lowerCamel(makeValidJavaVariable(oF.getName()))).build());
+                }
+            }
+            methods.add(MethodSpec.methodBuilder("getFragment").returns(fragmentClass).addParameters(typeParams)
+                    .addModifiers(Modifier.PUBLIC)
+                    .addStatement("return new $T(new $L(new $T(){}, $L))", fragmentClass, upperCamel(oType.getName()),
+                            baseClass, typeParams.stream().map(item -> item.name).collect(Collectors.joining(", ")))
+                    .build());
+        }
         if (!oType.getType().equals("top level")) {
             classFields.add(FieldSpec.builder(String.class, "name")
                     .addModifiers(Modifier.PRIVATE, Modifier.FINAL, Modifier.STATIC).initializer("$S", name).build());
index 9de249f..8c672e3 100644 (file)
@@ -34,13 +34,17 @@ public class FluentGeneratorMojo extends AbstractMojo {
     private String pluralClass;
     @Parameter
     private String nameClass;
+    @Parameter
+    private String singleFragmentClass;
+    @Parameter
+    private String pluralFragmentClass;
 
     public void execute() throws MojoExecutionException, MojoFailureException {
 
         try {
             new FluentGenerator(getLog(), destination, destinationClasspath, swaggerLocation, builderName,
                     singularBuilderClass, pluralBuilderClass, topLevelBuilderClass, baseBuilderClass, singularClass,
-                    pluralClass, nameClass).run();
+                    pluralClass, nameClass, singleFragmentClass, pluralFragmentClass).run();
         } catch (JsonProcessingException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
index f3c38e5..13cdc60 100644 (file)
@@ -209,13 +209,13 @@ public class JobExecutorService {
 
                 final NfvoJob nfvoJob = optional.get();
                 currentJobStatus = nfvoJob.getStatus();
-                logger.debug("Received job status response: \n ", nfvoJob);
+                logger.info("Received job status response: \n ", nfvoJob);
                 if (jobFinishedStates.contains(nfvoJob.getStatus())) {
                     logger.info("Job finished \n {}", currentJobStatus);
                     return ImmutablePair.of(nfvoJob.getProcessInstanceId(), currentJobStatus);
                 }
 
-                logger.debug("Haven't received one of finish state {} yet, will try again in {} seconds",
+                logger.info("Haven't received one of finish state {} yet, will try again in {} seconds",
                         jobFinishedStates, SLEEP_TIME_IN_SECONDS);
                 TimeUnit.SECONDS.sleep(SLEEP_TIME_IN_SECONDS);
 
index bfccddc..00e9433 100644 (file)
@@ -28,6 +28,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.onap.aaiclient.client.aai.AAIVersion.V19;
 import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NETWORK_SERVICE_DESCRIPTOR_PARAM_NAME;
 import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
 import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_REST_TEMPLATE_BEAN;
@@ -54,6 +55,8 @@ import org.hamcrest.text.MatchesPattern;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onap.aaiclient.client.aai.entities.Results;
+import org.onap.aaiclient.client.graphinventory.entities.Resource;
 import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
 import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStatusRetrievalStatusEnum;
 import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdInfo;
@@ -78,6 +81,8 @@ import org.springframework.http.MediaType;
 import org.springframework.http.converter.json.GsonHttpMessageConverter;
 import org.springframework.test.web.client.MockRestServiceServer;
 import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
 
 /**
@@ -286,8 +291,9 @@ public class InstantiateNsTaskTest extends BaseTest {
         return new File(path).getAbsolutePath();
     }
 
-    private void mockAAIEndpoints(final String nsdId) {
-        final String modelEndpoint = "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + UUID_REGEX;
+    private void mockAAIEndpoints(final String nsdId) throws JsonProcessingException {
+        final String modelEndpoint = "/aai/" + V19 + "/network/generic-vnfs/generic-vnf/" + UUID_REGEX;
+
         wireMockServer.stubFor(
                 get(urlMatching(modelEndpoint + "\\?resultIndex=0&resultSize=1&format=count")).willReturn(notFound()));
 
@@ -297,23 +303,25 @@ public class InstantiateNsTaskTest extends BaseTest {
         wireMockServer.stubFor(get(urlMatching(modelEndpoint)).willReturn(ok())
                 .willReturn(okJson("{\"orchestration-status\": \"Created\"}")));
 
-        final String resourceType = "service-instance";
-        final String resourceLink = "/aai/v20/business/customers/customer/" + GLOBAL_CUSTOMER_ID
-                + "/service-subscriptions/service-subscription/NetworkService/service-instances/service-instance/"
-                + nsdId;
-
-        final String body = "{\n" + "  \"results\": [{\n" + "    \"resource-type\": \"" + resourceType + "\",\n"
-                + "    \"resource-link\": \"" + resourceLink + "\"\n" + "  }]\n" + "}";
+        wireMockServer.stubFor(get(urlMatching("/aai/" + V19 + "/nodes/service-instances/service-instance/.*"))
+                .willReturn(okJson(getResourceResultsResponseAsJson(nsdId))));
 
         wireMockServer.stubFor(
-                get(urlMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/" + nsdId + "\\?format=pathed"))
-                        .willReturn(okJson(body)));
-
-        wireMockServer
-                .stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER
-                        + "/" + CLOUD_REGION + "/tenants/tenant/" + TENANT_ID + "/relationship-list/relationship"))
+                put(urlMatching("/aai/" + V19 + "/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/"
+                        + CLOUD_REGION + "/tenants/tenant/" + TENANT_ID + "/relationship-list/relationship"))
                                 .willReturn(ok()));
 
     }
 
+    private String getResourceResultsResponseAsJson(final String nsdId) throws JsonProcessingException {
+        final Resource resource = new Resource();
+        resource.setResourceType("service-instance");
+        resource.setResourceLink("/aai/" + V19 + "/business/customers/customer/" + GLOBAL_CUSTOMER_ID
+                + "/service-subscriptions/service-subscription/NetworkService/service-instances/service-instance/"
+                + nsdId);
+        final Results<Resource> results = new Results<>();
+        results.getResult().add(resource);
+        return new ObjectMapper().writeValueAsString(results);
+    }
+
 }
index b17a5f2..1fabfba 100644 (file)
@@ -42,7 +42,7 @@ etsi-catalog-manager:
       endpoint: http://modeling-etsicatalog.onap:8806/api
 so-etsi-ns-lcm-workflow-engine:
    requesttimeout:
-      timeoutInSeconds: 10
+      timeoutInSeconds: 60
 
 logging:
    level: