Merge "Implement RAN NSSMF Allocate workflow"
authorByung-Woo Jun <byung-woo.jun@est.tech>
Wed, 16 Sep 2020 14:16:15 +0000 (14:16 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 16 Sep 2020 14:16:15 +0000 (14:16 +0000)
46 files changed:
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/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-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn
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/DoCreateSliceServiceOptionV2.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo_aai.json [moved from bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Pnf_aai.json with 100% similarity]
bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Service_instance_aai.json
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevel.java [moved from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java with 80% similarity]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPostcheck.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelRequestDispatcher.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.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]
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 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();
         }
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")
+    }
+
+
+}
index 8b1b836..6a0b260 100644 (file)
@@ -1,10 +1,10 @@
 <?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_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
+<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_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
   <bpmn:process id="GenericPnfSWUPDownload" name="GenericPnfSWUPDownload" isExecutable="true">
     <bpmn:startEvent id="download_StartEvent" name="Start Flow">
       <bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
+    <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${GenericPnfDispatcher}">
       <bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0kusy70</bpmn:outgoing>
     </bpmn:serviceTask>
@@ -144,6 +144,88 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
   <bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPnfSWUPDownload">
+      <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia">
+        <di:waypoint x="455" y="481" />
+        <di:waypoint x="512" y="481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
+        <di:waypoint x="925" y="260" />
+        <di:waypoint x="970" y="260" />
+        <di:waypoint x="970" y="410" />
+        <di:waypoint x="160" y="410" />
+        <di:waypoint x="160" y="481" />
+        <di:waypoint x="202" y="481" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="938" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo">
+        <di:waypoint x="302" y="481" />
+        <di:waypoint x="355" y="481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70">
+        <di:waypoint x="370" y="121" />
+        <di:waypoint x="440" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
+        <di:waypoint x="665" y="260" />
+        <di:waypoint x="720" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="671" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
+        <di:waypoint x="900" y="285" />
+        <di:waypoint x="900" y="344" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="912" y="290" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
+        <di:waypoint x="820" y="260" />
+        <di:waypoint x="875" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
+        <di:waypoint x="380" y="285" />
+        <di:waypoint x="380" y="344" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="384" y="292" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
+        <di:waypoint x="405" y="260" />
+        <di:waypoint x="480" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="398" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
+        <di:waypoint x="300" y="260" />
+        <di:waypoint x="355" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
+        <di:waypoint x="640" y="285" />
+        <di:waypoint x="640" y="344" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="650" y="291" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
+        <di:waypoint x="580" y="260" />
+        <di:waypoint x="615" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
+        <di:waypoint x="540" y="121" />
+        <di:waypoint x="570" y="121" />
+        <di:waypoint x="570" y="190" />
+        <di:waypoint x="160" y="190" />
+        <di:waypoint x="160" y="260" />
+        <di:waypoint x="200" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
+        <di:waypoint x="208" y="121" />
+        <di:waypoint x="270" y="121" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent">
         <dc:Bounds x="172" y="103" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -186,68 +268,21 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao">
         <dc:Bounds x="200" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
-        <di:waypoint x="208" y="121" />
-        <di:waypoint x="270" y="121" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
-        <di:waypoint x="540" y="121" />
-        <di:waypoint x="570" y="121" />
-        <di:waypoint x="570" y="190" />
-        <di:waypoint x="160" y="190" />
-        <di:waypoint x="160" y="260" />
-        <di:waypoint x="200" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
-        <di:waypoint x="580" y="260" />
-        <di:waypoint x="615" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
-        <di:waypoint x="640" y="285" />
-        <di:waypoint x="640" y="344" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="650" y="291" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
-        <di:waypoint x="300" y="260" />
-        <di:waypoint x="355" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
-        <di:waypoint x="405" y="260" />
-        <di:waypoint x="480" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="398" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
-        <di:waypoint x="380" y="285" />
-        <di:waypoint x="380" y="344" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="384" y="292" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
-        <di:waypoint x="820" y="260" />
-        <di:waypoint x="875" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
-        <di:waypoint x="900" y="285" />
-        <di:waypoint x="900" y="344" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="912" y="290" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
-        <di:waypoint x="665" y="260" />
-        <di:waypoint x="720" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="671" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="SubProcess_02e59i3_di" bpmnElement="SubProcess_02e59i3" isExpanded="true">
         <dc:Bounds x="190" y="580" width="650" height="190" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u">
+        <di:waypoint x="298" y="680" />
+        <di:waypoint x="360" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8">
+        <di:waypoint x="460" y="680" />
+        <di:waypoint x="530" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun">
+        <di:waypoint x="630" y="680" />
+        <di:waypoint x="702" y="680" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_0uftj43_di" bpmnElement="StartEvent_0uftj43">
         <dc:Bounds x="262" y="662" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -266,50 +301,15 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
           <dc:Bounds x="712" y="705" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun">
-        <di:waypoint x="630" y="680" />
-        <di:waypoint x="702" y="680" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8">
-        <di:waypoint x="460" y="680" />
-        <di:waypoint x="530" y="680" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u">
-        <di:waypoint x="298" y="680" />
-        <di:waypoint x="360" y="680" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1ankfw8_di" bpmnElement="ScriptTask_1ankfw8">
         <dc:Bounds x="440" y="81" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70">
-        <di:waypoint x="370" y="121" />
-        <di:waypoint x="440" y="121" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_17f7m2t_di" bpmnElement="ScriptTask_17f7m2t">
         <dc:Bounds x="202" y="441" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0tq2dug_di" bpmnElement="CallActivity_0tq2dug">
         <dc:Bounds x="355" y="441" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo">
-        <di:waypoint x="302" y="481" />
-        <di:waypoint x="355" y="481" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
-        <di:waypoint x="925" y="260" />
-        <di:waypoint x="970" y="260" />
-        <di:waypoint x="970" y="410" />
-        <di:waypoint x="160" y="410" />
-        <di:waypoint x="160" y="481" />
-        <di:waypoint x="202" y="481" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="938" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia">
-        <di:waypoint x="455" y="481" />
-        <di:waypoint x="512" y="481" />
-      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index f4a6196..9b8ce4a 100644 (file)
@@ -1,10 +1,10 @@
 <?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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
+<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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
   <bpmn:process id="GenericPnfSoftwareUpgrade" name="GenericPnfSoftwareUpgrade" isExecutable="true">
     <bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow">
       <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:serviceTask id="ServiceTask_042uz7n" name="NF Upgrade Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
+    <bpmn:serviceTask id="ServiceTask_042uz7n" name="NF Upgrade Dispatcher" camunda:delegateExpression="${GenericPnfDispatcher}">
       <bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing>
     </bpmn:serviceTask>
@@ -174,6 +174,110 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
   <bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPnfSoftwareUpgrade">
+      <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
+        <di:waypoint x="480" y="480" />
+        <di:waypoint x="532" y="480" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
+        <di:waypoint x="320" y="480" />
+        <di:waypoint x="380" y="480" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41">
+        <di:waypoint x="540" y="120" />
+        <di:waypoint x="570" y="120" />
+        <di:waypoint x="570" y="190" />
+        <di:waypoint x="180" y="190" />
+        <di:waypoint x="180" y="260" />
+        <di:waypoint x="220" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
+        <di:waypoint x="1050" y="260" />
+        <di:waypoint x="1090" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
+        <di:waypoint x="320" y="260" />
+        <di:waypoint x="355" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
+        <di:waypoint x="1190" y="260" />
+        <di:waypoint x="1225" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
+        <di:waypoint x="820" y="260" />
+        <di:waypoint x="845" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
+        <di:waypoint x="560" y="260" />
+        <di:waypoint x="615" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
+        <di:waypoint x="895" y="260" />
+        <di:waypoint x="950" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="898" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
+        <di:waypoint x="1275" y="260" />
+        <di:waypoint x="1320" y="260" />
+        <di:waypoint x="1320" y="410" />
+        <di:waypoint x="180" y="410" />
+        <di:waypoint x="180" y="480" />
+        <di:waypoint x="220" y="480" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1277" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
+        <di:waypoint x="665" y="260" />
+        <di:waypoint x="720" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="668" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
+        <di:waypoint x="1250" y="285" />
+        <di:waypoint x="1250" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1254" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
+        <di:waypoint x="870" y="285" />
+        <di:waypoint x="870" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="874" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
+        <di:waypoint x="640" y="285" />
+        <di:waypoint x="640" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="644" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
+        <di:waypoint x="380" y="285" />
+        <di:waypoint x="380" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="384" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
+        <di:waypoint x="405" y="260" />
+        <di:waypoint x="460" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="408" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
+        <di:waypoint x="198" y="120" />
+        <di:waypoint x="270" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
+        <di:waypoint x="370" y="120" />
+        <di:waypoint x="440" y="120" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent">
         <dc:Bounds x="162" y="102" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -183,20 +287,12 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n">
         <dc:Bounds x="270" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
-        <di:waypoint x="370" y="120" />
-        <di:waypoint x="440" y="120" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent">
         <dc:Bounds x="532" y="462" width="36" height="36" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="542" y="505" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
-        <di:waypoint x="198" y="120" />
-        <di:waypoint x="270" y="120" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true">
         <dc:Bounds x="615" y="235" width="50" height="50" />
         <bpmndi:BPMNLabel>
@@ -212,160 +308,59 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true">
         <dc:Bounds x="355" y="235" width="50" height="50" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
-        <di:waypoint x="405" y="260" />
-        <di:waypoint x="460" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="408" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y">
         <dc:Bounds x="362" y="342" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
-        <di:waypoint x="380" y="285" />
-        <di:waypoint x="380" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="384" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
-        <di:waypoint x="640" y="285" />
-        <di:waypoint x="640" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="644" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true">
         <dc:Bounds x="845" y="235" width="50" height="50" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz">
         <dc:Bounds x="852" y="342" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
-        <di:waypoint x="870" y="285" />
-        <di:waypoint x="870" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="874" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true">
         <dc:Bounds x="1225" y="235" width="50" height="50" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5">
         <dc:Bounds x="1232" y="342" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
-        <di:waypoint x="1250" y="285" />
-        <di:waypoint x="1250" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1254" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
-        <di:waypoint x="665" y="260" />
-        <di:waypoint x="720" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="668" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
-        <di:waypoint x="1275" y="260" />
-        <di:waypoint x="1320" y="260" />
-        <di:waypoint x="1320" y="410" />
-        <di:waypoint x="180" y="410" />
-        <di:waypoint x="180" y="480" />
-        <di:waypoint x="220" y="480" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1277" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
-        <di:waypoint x="895" y="260" />
-        <di:waypoint x="950" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="898" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8">
         <dc:Bounds x="460" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
-        <di:waypoint x="560" y="260" />
-        <di:waypoint x="615" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48">
         <dc:Bounds x="720" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
-        <di:waypoint x="820" y="260" />
-        <di:waypoint x="845" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu">
         <dc:Bounds x="1090" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
-        <di:waypoint x="1190" y="260" />
-        <di:waypoint x="1225" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe">
         <dc:Bounds x="220" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
-        <di:waypoint x="320" y="260" />
-        <di:waypoint x="355" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7">
         <dc:Bounds x="950" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
-        <di:waypoint x="1050" y="260" />
-        <di:waypoint x="1090" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg8">
         <dc:Bounds x="440" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41">
-        <di:waypoint x="540" y="120" />
-        <di:waypoint x="570" y="120" />
-        <di:waypoint x="570" y="190" />
-        <di:waypoint x="180" y="190" />
-        <di:waypoint x="180" y="260" />
-        <di:waypoint x="220" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83">
         <dc:Bounds x="220" y="440" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
-        <di:waypoint x="320" y="480" />
-        <di:waypoint x="380" y="480" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u">
         <dc:Bounds x="380" y="440" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
-        <di:waypoint x="480" y="480" />
-        <di:waypoint x="532" y="480" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
-        <dc:Bounds x="540" y="630" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
-        <dc:Bounds x="710" y="630" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
-        <dc:Bounds x="882" y="652" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="892" y="695" width="18" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
+        <dc:Bounds x="370" y="570" width="650" height="190" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
+        <di:waypoint x="810" y="670" />
+        <di:waypoint x="882" y="670" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc">
         <di:waypoint x="640" y="670" />
         <di:waypoint x="710" y="670" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
-        <di:waypoint x="810" y="670" />
-        <di:waypoint x="882" y="670" />
+      <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
+        <di:waypoint x="478" y="670" />
+        <di:waypoint x="540" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm">
         <dc:Bounds x="442" y="652" width="36" height="36" />
@@ -373,13 +368,18 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
           <dc:Bounds x="422" y="693" width="76" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
-        <dc:Bounds x="370" y="570" width="650" height="190" />
+      <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
+        <dc:Bounds x="540" y="630" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
+        <dc:Bounds x="710" y="630" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
+        <dc:Bounds x="882" y="652" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="892" y="695" width="18" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
-        <di:waypoint x="478" y="670" />
-        <di:waypoint x="540" y="670" />
-      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 3d37430..8ff1a1e 100644 (file)
       <bpmn:incoming>Flow_10jgbxm</bpmn:incoming>
       <bpmn:terminateEventDefinition id="TerminateEventDefinition_1pnutu7" />
     </bpmn:endEvent>
-    <bpmn:exclusiveGateway id="Gateway_02fectw" default="Flow_0y1ebox">
+    <bpmn:exclusiveGateway id="Gateway_02fectw">
       <bpmn:incoming>Flow_1y3cptr</bpmn:incoming>
       <bpmn:outgoing>Flow_0y1ebox</bpmn:outgoing>
       <bpmn:outgoing>Flow_0mbp7mv</bpmn:outgoing>
+      <bpmn:outgoing>Flow_19tmp99</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:endEvent id="Event_0ldlupa">
       <bpmn:incoming>Flow_0y1ebox</bpmn:incoming>
       <bpmn:errorEventDefinition id="ErrorEventDefinition_1dih7c9" errorRef="Error_01a8p43" />
     </bpmn:endEvent>
-    <bpmn:exclusiveGateway id="Gateway_1nr51kr" default="Flow_0mxq0qe">
-      <bpmn:incoming>Flow_0trmo7s</bpmn:incoming>
-      <bpmn:outgoing>Flow_1z06yyv</bpmn:outgoing>
+    <bpmn:exclusiveGateway id="Gateway_1nr51kr">
+      <bpmn:incoming>Flow_0zjsp5x</bpmn:incoming>
       <bpmn:outgoing>Flow_0mxq0qe</bpmn:outgoing>
+      <bpmn:outgoing>Flow_05x2cqc</bpmn:outgoing>
+      <bpmn:outgoing>Flow_02elm5b</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:endEvent id="Event_16k9r1c">
       <bpmn:incoming>Flow_0mxq0qe</bpmn:incoming>
@@ -40,7 +42,7 @@
       <bpmn:errorEventDefinition id="ErrorEventDefinition_16r0jc3" errorRef="Error_04y00c4" />
     </bpmn:endEvent>
     <bpmn:serviceTask id="Activity_0snmatn" name="Service Level Upgrade" camunda:delegateExpression="${ServiceLevelUpgrade}">
-      <bpmn:incoming>Flow_1z06yyv</bpmn:incoming>
+      <bpmn:incoming>Flow_02elm5b</bpmn:incoming>
       <bpmn:outgoing>Flow_01gwzx9</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:serviceTask id="Activity_0ft7fa2" name="Service Level Postcheck" camunda:delegateExpression="${ServiceLevelPostcheck}">
       <bpmn:outgoing>Flow_1ru18s3</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:serviceTask id="Activity_09bqns0" name="Service Level Preparation" camunda:delegateExpression="${ServiceLevelPreparation}">
-      <bpmn:incoming>Flow_1v0mxe7</bpmn:incoming>
-      <bpmn:outgoing>Flow_1p4xkdj</bpmn:outgoing>
-    </bpmn:serviceTask>
-    <bpmn:scriptTask id="Activity_0qgmx7a" name="Send Response" scriptFormat="groovy">
       <bpmn:incoming>Flow_1b392qs</bpmn:incoming>
-      <bpmn:outgoing>Flow_1v0mxe7</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def pnfSwUpgrade = new GenericPnfSoftwareUpgrade()
-pnfSwUpgrade.sendResponse(execution)</bpmn:script>
-    </bpmn:scriptTask>
+      <bpmn:outgoing>Flow_1ptk2a3</bpmn:outgoing>
+    </bpmn:serviceTask>
     <bpmn:scriptTask id="Activity_1n4rk7m" name="Prepare Completion" scriptFormat="groovy">
       <bpmn:incoming>Flow_0l67uzl</bpmn:incoming>
       <bpmn:outgoing>Flow_0frhsd0</bpmn:outgoing>
@@ -94,24 +89,23 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmn:sequenceFlow id="Flow_0iayg6u" sourceRef="Event_08f3m9h" targetRef="Activity_1k2f3ha" />
     </bpmn:subProcess>
     <bpmn:sequenceFlow id="Flow_0nrz340" sourceRef="Event_02mc8tr" targetRef="Activity_18vue7u" />
-    <bpmn:sequenceFlow id="Flow_1b392qs" sourceRef="Activity_18vue7u" targetRef="Activity_0qgmx7a" />
+    <bpmn:sequenceFlow id="Flow_1b392qs" sourceRef="Activity_18vue7u" targetRef="Activity_09bqns0" />
     <bpmn:sequenceFlow id="Flow_10jgbxm" sourceRef="Activity_1lz38px" targetRef="Event_12983th" />
-    <bpmn:sequenceFlow id="Flow_01gwzx9" sourceRef="Activity_0snmatn" targetRef="Activity_1q4o9fx" />
-    <bpmn:sequenceFlow id="Flow_0y1ebox" name="Failure" sourceRef="Gateway_02fectw" targetRef="Event_0ldlupa" />
-    <bpmn:sequenceFlow id="Flow_1p4xkdj" sourceRef="Activity_09bqns0" targetRef="Activity_0n17xou" />
-    <bpmn:sequenceFlow id="Flow_1z06yyv" name="Success" sourceRef="Gateway_1nr51kr" targetRef="Activity_0snmatn">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+    <bpmn:sequenceFlow id="Flow_01gwzx9" sourceRef="Activity_0snmatn" targetRef="Activity_0e6w886" />
+    <bpmn:sequenceFlow id="Flow_0y1ebox" name="Failure" sourceRef="Gateway_02fectw" targetRef="Event_0ldlupa">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0mxq0qe" name="Failure" sourceRef="Gateway_1nr51kr" targetRef="Event_16k9r1c">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="Flow_0mxq0qe" name="Failure" sourceRef="Gateway_1nr51kr" targetRef="Event_16k9r1c" />
     <bpmn:sequenceFlow id="Flow_1ru18s3" sourceRef="Activity_0ft7fa2" targetRef="Gateway_1vq11i7" />
     <bpmn:sequenceFlow id="Flow_1tcnzdx" name="Failure" sourceRef="Gateway_1vq11i7" targetRef="Event_03tpudy" />
     <bpmn:sequenceFlow id="Flow_0l67uzl" name="Success" sourceRef="Gateway_1vq11i7" targetRef="Activity_1n4rk7m">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="Flow_1v0mxe7" sourceRef="Activity_0qgmx7a" targetRef="Activity_09bqns0" />
     <bpmn:sequenceFlow id="Flow_0frhsd0" sourceRef="Activity_1n4rk7m" targetRef="Activity_1lz38px" />
     <bpmn:sequenceFlow id="Flow_0mbp7mv" name="Success" sourceRef="Gateway_02fectw" targetRef="Activity_1hp67qz">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &gt;= execution.getVariable("pnfSize")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:callActivity id="Activity_0n17xou" name="BPMN to Execute" calledElement="${healthCheckWorkflow}">
       <bpmn:extensionElements>
@@ -123,10 +117,9 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
         <camunda:in source="isRollback" target="isRollback" />
         <camunda:in source="pnfName" target="pnfName" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_1p4xkdj</bpmn:incoming>
-      <bpmn:outgoing>Flow_0trmo7s</bpmn:outgoing>
+      <bpmn:incoming>Flow_0rpnl02</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zjsp5x</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="Flow_0trmo7s" sourceRef="Activity_0n17xou" targetRef="Gateway_1nr51kr" />
     <bpmn:callActivity id="Activity_1q4o9fx" name="BPMN to Execute" calledElement="${softwareUpgradeWorkflow}">
       <bpmn:extensionElements>
         <camunda:in source="bpmnRequest" target="bpmnRequest" />
@@ -137,7 +130,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
         <camunda:in source="isRollback" target="isRollback" />
         <camunda:in source="pnfName" target="pnfName" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_01gwzx9</bpmn:incoming>
+      <bpmn:incoming>Flow_0g6gkgx</bpmn:incoming>
       <bpmn:outgoing>Flow_1y3cptr</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="Flow_1y3cptr" sourceRef="Activity_1q4o9fx" targetRef="Gateway_02fectw" />
@@ -151,7 +144,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmn:outgoing>Flow_05ohtnj</bpmn:outgoing>
       <bpmn:outgoing>Flow_0ny61qm</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="Flow_05ohtnj" name="Success&#10;&#10;" sourceRef="Gateway_18ch73t" targetRef="Activity_0ft7fa2">
+    <bpmn:sequenceFlow id="Flow_05ohtnj" name="Success&#10;" sourceRef="Gateway_18ch73t" targetRef="Activity_0ft7fa2">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:endEvent id="Event_1fhov6x">
@@ -159,6 +152,29 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmn:errorEventDefinition id="ErrorEventDefinition_0od3xnw" errorRef="Error_01a8p43" />
     </bpmn:endEvent>
     <bpmn:sequenceFlow id="Flow_0ny61qm" name="Failure&#10;" sourceRef="Gateway_18ch73t" targetRef="Event_1fhov6x" />
+    <bpmn:sequenceFlow id="Flow_1ptk2a3" sourceRef="Activity_09bqns0" targetRef="Activity_02vp5np" />
+    <bpmn:sequenceFlow id="Flow_0rpnl02" sourceRef="Activity_02vp5np" targetRef="Activity_0n17xou" />
+    <bpmn:sequenceFlow id="Flow_0g6gkgx" sourceRef="Activity_0e6w886" targetRef="Activity_1q4o9fx" />
+    <bpmn:sequenceFlow id="Flow_0zjsp5x" sourceRef="Activity_0n17xou" targetRef="Gateway_1nr51kr" />
+    <bpmn:sequenceFlow id="Flow_19tmp99" name="pick next pnf" sourceRef="Gateway_02fectw" targetRef="Activity_0e6w886">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &lt; execution.getVariable("pnfSize")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_05x2cqc" name="pick next pnf" sourceRef="Gateway_1nr51kr" targetRef="Activity_02vp5np">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &lt; execution.getVariable("pnfSize")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_02elm5b" name="Success" sourceRef="Gateway_1nr51kr" targetRef="Activity_0snmatn">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &gt;= execution.getVariable("pnfSize")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:serviceTask id="Activity_02vp5np" name="Pnf Counter Execution for HC" camunda:expression="${ServiceLevelPreparation.pnfCounterExecution(execution)}">
+      <bpmn:incoming>Flow_1ptk2a3</bpmn:incoming>
+      <bpmn:incoming>Flow_05x2cqc</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rpnl02</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="Activity_0e6w886" name="Pnf Counter Execution for SWU" camunda:expression="${ServiceLevelUpgrade.pnfCounterExecution(execution)}">
+      <bpmn:incoming>Flow_01gwzx9</bpmn:incoming>
+      <bpmn:incoming>Flow_19tmp99</bpmn:incoming>
+      <bpmn:outgoing>Flow_0g6gkgx</bpmn:outgoing>
+    </bpmn:serviceTask>
   </bpmn:process>
   <bpmn:error id="Error_01a8p43" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn:error id="Error_0e5owqi" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
@@ -166,212 +182,237 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
   <bpmn:error id="Error_04y00c4" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ServiceLevelUpgrade">
+      <bpmndi:BPMNEdge id="Flow_02elm5b_di" bpmnElement="Flow_02elm5b">
+        <di:waypoint x="1140" y="198" />
+        <di:waypoint x="1140" y="240" />
+        <di:waypoint x="210" y="240" />
+        <di:waypoint x="210" y="330" />
+        <di:waypoint x="262" y="330" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1148" y="222" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05x2cqc_di" bpmnElement="Flow_05x2cqc">
+        <di:waypoint x="1140" y="166" />
+        <di:waypoint x="1140" y="100" />
+        <di:waypoint x="810" y="100" />
+        <di:waypoint x="810" y="142" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="944" y="82" width="63" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_19tmp99_di" bpmnElement="Flow_19tmp99">
+        <di:waypoint x="804" y="314" />
+        <di:waypoint x="804" y="260" />
+        <di:waypoint x="488" y="260" />
+        <di:waypoint x="488" y="290" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="616" y="242" width="63" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zjsp5x_di" bpmnElement="Flow_0zjsp5x">
+        <di:waypoint x="1030" y="182" />
+        <di:waypoint x="1124" y="182" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0g6gkgx_di" bpmnElement="Flow_0g6gkgx">
+        <di:waypoint x="538" y="330" />
+        <di:waypoint x="590" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rpnl02_di" bpmnElement="Flow_0rpnl02">
+        <di:waypoint x="860" y="182" />
+        <di:waypoint x="930" y="182" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ptk2a3_di" bpmnElement="Flow_1ptk2a3">
+        <di:waypoint x="600" y="182" />
+        <di:waypoint x="760" y="182" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0ny61qm_di" bpmnElement="Flow_0ny61qm">
-        <di:waypoint x="1190" y="278" />
-        <di:waypoint x="1190" y="334" />
+        <di:waypoint x="1140" y="346" />
+        <di:waypoint x="1140" y="404" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1152" y="290" width="35" height="27" />
+          <dc:Bounds x="1102" y="362" width="35" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_05ohtnj_di" bpmnElement="Flow_05ohtnj">
-        <di:waypoint x="1206" y="262" />
-        <di:waypoint x="1300" y="262" />
-        <di:waypoint x="1300" y="372" />
+        <di:waypoint x="1156" y="330" />
+        <di:waypoint x="1310" y="330" />
+        <di:waypoint x="1310" y="490" />
+        <di:waypoint x="1190" y="490" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1232" y="244" width="43" height="40" />
+          <dc:Bounds x="1318" y="406" width="43" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0dyc3kv_di" bpmnElement="Flow_0dyc3kv">
-        <di:waypoint x="1120" y="262" />
-        <di:waypoint x="1174" y="262" />
+        <di:waypoint x="1030" y="330" />
+        <di:waypoint x="1124" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1y3cptr_di" bpmnElement="Flow_1y3cptr">
-        <di:waypoint x="860" y="262" />
-        <di:waypoint x="904" y="262" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0trmo7s_di" bpmnElement="Flow_0trmo7s">
-        <di:waypoint x="450" y="262" />
-        <di:waypoint x="501" y="262" />
+        <di:waypoint x="690" y="330" />
+        <di:waypoint x="788" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0mbp7mv_di" bpmnElement="Flow_0mbp7mv">
-        <di:waypoint x="936" y="262" />
-        <di:waypoint x="1020" y="262" />
+        <di:waypoint x="820" y="330" />
+        <di:waypoint x="930" y="330" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="948" y="248" width="43" height="14" />
+          <dc:Bounds x="845" y="316" width="43" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0frhsd0_di" bpmnElement="Flow_0frhsd0">
-        <di:waypoint x="312" y="482" />
-        <di:waypoint x="372" y="482" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1v0mxe7_di" bpmnElement="Flow_1v0mxe7">
-        <di:waypoint x="532" y="122" />
-        <di:waypoint x="562" y="122" />
-        <di:waypoint x="562" y="192" />
-        <di:waypoint x="172" y="192" />
-        <di:waypoint x="172" y="262" />
-        <di:waypoint x="212" y="262" />
+        <di:waypoint x="362" y="579" />
+        <di:waypoint x="450" y="579" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0l67uzl_di" bpmnElement="Flow_0l67uzl">
-        <di:waypoint x="1054" y="412" />
-        <di:waypoint x="172" y="412" />
-        <di:waypoint x="172" y="482" />
-        <di:waypoint x="212" y="482" />
+        <di:waypoint x="964" y="490" />
+        <di:waypoint x="210" y="490" />
+        <di:waypoint x="210" y="579" />
+        <di:waypoint x="262" y="579" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="663" y="398" width="43" height="14" />
+          <dc:Bounds x="612" y="476" width="43" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1tcnzdx_di" bpmnElement="Flow_1tcnzdx">
-        <di:waypoint x="1070" y="428" />
-        <di:waypoint x="1070" y="494" />
+        <di:waypoint x="980" y="506" />
+        <di:waypoint x="980" y="554" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1032" y="451" width="35" height="14" />
+          <dc:Bounds x="942" y="526" width="35" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1ru18s3_di" bpmnElement="Flow_1ru18s3">
-        <di:waypoint x="1250" y="412" />
-        <di:waypoint x="1086" y="412" />
+        <di:waypoint x="1090" y="490" />
+        <di:waypoint x="996" y="490" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0mxq0qe_di" bpmnElement="Flow_0mxq0qe">
-        <di:waypoint x="517" y="278" />
-        <di:waypoint x="517" y="334" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="472" y="296" width="35" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1z06yyv_di" bpmnElement="Flow_1z06yyv">
-        <di:waypoint x="533" y="262" />
-        <di:waypoint x="590" y="262" />
+        <di:waypoint x="1156" y="182" />
+        <di:waypoint x="1284" y="182" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="540" y="248" width="43" height="14" />
+          <dc:Bounds x="1192" y="163" width="35" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1p4xkdj_di" bpmnElement="Flow_1p4xkdj">
-        <di:waypoint x="312" y="262" />
-        <di:waypoint x="350" y="262" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0y1ebox_di" bpmnElement="Flow_0y1ebox">
-        <di:waypoint x="920" y="278" />
-        <di:waypoint x="918" y="335" />
+        <di:waypoint x="804" y="346" />
+        <di:waypoint x="804" y="414" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="879" y="296" width="35" height="14" />
+          <dc:Bounds x="813" y="374" width="35" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_01gwzx9_di" bpmnElement="Flow_01gwzx9">
-        <di:waypoint x="690" y="262" />
-        <di:waypoint x="760" y="262" />
+        <di:waypoint x="362" y="330" />
+        <di:waypoint x="438" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_10jgbxm_di" bpmnElement="Flow_10jgbxm">
-        <di:waypoint x="472" y="482" />
-        <di:waypoint x="524" y="480" />
+        <di:waypoint x="550" y="580" />
+        <di:waypoint x="624" y="580" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1b392qs_di" bpmnElement="Flow_1b392qs">
-        <di:waypoint x="362" y="122" />
-        <di:waypoint x="432" y="122" />
+        <di:waypoint x="362" y="182" />
+        <di:waypoint x="500" y="182" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0nrz340_di" bpmnElement="Flow_0nrz340">
-        <di:waypoint x="186" y="120" />
-        <di:waypoint x="262" y="122" />
+        <di:waypoint x="186" y="180" />
+        <di:waypoint x="262" y="182" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="Event_02mc8tr_di" bpmnElement="Event_02mc8tr">
-        <dc:Bounds x="154" y="104" width="32" height="32" />
+        <dc:Bounds x="154" y="164" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-6" y="-188" width="51" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_18vue7u_di" bpmnElement="Activity_18vue7u">
-        <dc:Bounds x="262" y="82" width="100" height="80" />
+        <dc:Bounds x="262" y="142" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_02fectw_di" bpmnElement="Gateway_02fectw" isMarkerVisible="true">
+        <dc:Bounds x="788" y="314" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1nr51kr_di" bpmnElement="Gateway_1nr51kr" isMarkerVisible="true">
+        <dc:Bounds x="1124" y="166" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_16k9r1c_di" bpmnElement="Event_16k9r1c">
+        <dc:Bounds x="1284" y="166" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0snmatn_di" bpmnElement="Activity_0snmatn">
+        <dc:Bounds x="262" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_09bqns0_di" bpmnElement="Activity_09bqns0">
+        <dc:Bounds x="500" y="142" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ldlupa_di" bpmnElement="Event_0ldlupa">
+        <dc:Bounds x="788" y="414" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1lz38px_di" bpmnElement="Activity_1lz38px">
+        <dc:Bounds x="450" y="539" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1n4rk7m_di" bpmnElement="Activity_1n4rk7m">
+        <dc:Bounds x="262" y="539" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_12983th_di" bpmnElement="Event_12983th">
-        <dc:Bounds x="524" y="464" width="32" height="32" />
+        <dc:Bounds x="624" y="565" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-132" y="-188" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_02fectw_di" bpmnElement="Gateway_02fectw" isMarkerVisible="true">
-        <dc:Bounds x="904" y="246" width="32" height="32" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_0ldlupa_di" bpmnElement="Event_0ldlupa">
-        <dc:Bounds x="905" y="334" width="32" height="32" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1nr51kr_di" bpmnElement="Gateway_1nr51kr" isMarkerVisible="true">
-        <dc:Bounds x="501" y="246" width="32" height="32" />
+      <bpmndi:BPMNShape id="Activity_0n17xou_di" bpmnElement="Activity_0n17xou">
+        <dc:Bounds x="930" y="142" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_16k9r1c_di" bpmnElement="Event_16k9r1c">
-        <dc:Bounds x="501" y="334" width="32" height="32" />
+      <bpmndi:BPMNShape id="Activity_1q4o9fx_di" bpmnElement="Activity_1q4o9fx">
+        <dc:Bounds x="590" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1vq11i7_di" bpmnElement="Gateway_1vq11i7" isMarkerVisible="true">
-        <dc:Bounds x="1054" y="396" width="32" height="32" />
+      <bpmndi:BPMNShape id="Activity_1hp67qz_di" bpmnElement="Activity_1hp67qz">
+        <dc:Bounds x="930" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_03tpudy_di" bpmnElement="Event_03tpudy">
-        <dc:Bounds x="1054" y="494" width="32" height="32" />
+      <bpmndi:BPMNShape id="Gateway_18ch73t_di" bpmnElement="Gateway_18ch73t" isMarkerVisible="true">
+        <dc:Bounds x="1124" y="314" width="32" height="32" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0snmatn_di" bpmnElement="Activity_0snmatn">
-        <dc:Bounds x="590" y="222" width="100" height="80" />
+      <bpmndi:BPMNShape id="Event_1fhov6x_di" bpmnElement="Event_1fhov6x">
+        <dc:Bounds x="1124" y="404" width="32" height="32" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0ft7fa2_di" bpmnElement="Activity_0ft7fa2">
-        <dc:Bounds x="1250" y="372" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1bjlebw_di" bpmnElement="Activity_02vp5np">
+        <dc:Bounds x="760" y="142" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_09bqns0_di" bpmnElement="Activity_09bqns0">
-        <dc:Bounds x="212" y="222" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1knf0nl_di" bpmnElement="Activity_0e6w886">
+        <dc:Bounds x="438" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0qgmx7a_di" bpmnElement="Activity_0qgmx7a">
-        <dc:Bounds x="432" y="82" width="100" height="80" />
+      <bpmndi:BPMNShape id="Event_03tpudy_di" bpmnElement="Event_03tpudy">
+        <dc:Bounds x="964" y="554" width="32" height="32" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1n4rk7m_di" bpmnElement="Activity_1n4rk7m">
-        <dc:Bounds x="212" y="442" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_0ft7fa2_di" bpmnElement="Activity_0ft7fa2">
+        <dc:Bounds x="1090" y="450" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1lz38px_di" bpmnElement="Activity_1lz38px">
-        <dc:Bounds x="372" y="442" width="100" height="80" />
+      <bpmndi:BPMNShape id="Gateway_1vq11i7_di" bpmnElement="Gateway_1vq11i7" isMarkerVisible="true">
+        <dc:Bounds x="964" y="474" width="32" height="32" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0ui6tp1_di" bpmnElement="Activity_0ui6tp1" isExpanded="true">
-        <dc:Bounds x="362" y="572" width="650" height="190" />
+        <dc:Bounds x="362" y="810" width="650" height="190" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="Flow_0iayg6u_di" bpmnElement="Flow_0iayg6u">
-        <di:waypoint x="466" y="670" />
-        <di:waypoint x="532" y="672" />
+        <di:waypoint x="466" y="908" />
+        <di:waypoint x="532" y="910" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0lb7zv5_di" bpmnElement="Flow_0lb7zv5">
-        <di:waypoint x="632" y="672" />
-        <di:waypoint x="702" y="672" />
+        <di:waypoint x="632" y="910" />
+        <di:waypoint x="702" y="910" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1peoyur_di" bpmnElement="Flow_1peoyur">
-        <di:waypoint x="802" y="672" />
-        <di:waypoint x="874" y="670" />
+        <di:waypoint x="802" y="910" />
+        <di:waypoint x="874" y="908" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="Event_08f3m9h_di" bpmnElement="Event_08f3m9h">
-        <dc:Bounds x="434" y="654" width="32" height="32" />
+        <dc:Bounds x="434" y="892" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-161" y="-188" width="78" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1k2f3ha_di" bpmnElement="Activity_1k2f3ha">
-        <dc:Bounds x="532" y="632" width="100" height="80" />
+        <dc:Bounds x="532" y="870" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0ai3z2q_di" bpmnElement="Activity_0ai3z2q">
-        <dc:Bounds x="702" y="632" width="100" height="80" />
+        <dc:Bounds x="702" y="870" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_0ngb9wx_di" bpmnElement="Event_0ngb9wx">
-        <dc:Bounds x="874" y="654" width="32" height="32" />
+        <dc:Bounds x="874" y="892" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-132" y="-188" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0n17xou_di" bpmnElement="Activity_0n17xou">
-        <dc:Bounds x="350" y="222" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1q4o9fx_di" bpmnElement="Activity_1q4o9fx">
-        <dc:Bounds x="760" y="222" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1hp67qz_di" bpmnElement="Activity_1hp67qz">
-        <dc:Bounds x="1020" y="222" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_18ch73t_di" bpmnElement="Gateway_18ch73t" isMarkerVisible="true">
-        <dc:Bounds x="1174" y="246" width="32" height="32" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1fhov6x_di" bpmnElement="Event_1fhov6x">
-        <dc:Bounds x="1174" y="334" width="32" height="32" />
-      </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/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>
index bdad46f..4322ff5 100644 (file)
@@ -62,7 +62,8 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
     private static final Map<String, Object> executionVariables = new HashMap();
     private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5";
     private static final String SERVICE_INSTANCE_ID = "5df8b6de-2083-11e7-93ae-92361f002676";
-    private final String[] actionNames = new String[5];
+    private final String[] actionNames = new String[10];
+    private final String[] pnfNames = new String[10];
     private final String CLASSNAME = getClass().getSimpleName();
     private String requestObject;
     private String responseObject;
@@ -73,10 +74,26 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
     @Before
     public void setUp() throws IOException {
         actionNames[0] = "healthCheck";
-        actionNames[1] = "preCheck";
-        actionNames[2] = "downloadNESw";
-        actionNames[3] = "activateNESw";
-        actionNames[4] = "postCheck";
+        actionNames[1] = "healthCheck";
+        actionNames[2] = "preCheck";
+        actionNames[3] = "downloadNESw";
+        actionNames[4] = "activateNESw";
+        actionNames[5] = "postCheck";
+        actionNames[6] = "preCheck";
+        actionNames[7] = "downloadNESw";
+        actionNames[8] = "activateNESw";
+        actionNames[9] = "postCheck";
+
+        pnfNames[0] = "PNFDemo";
+        pnfNames[1] = "PNFDemo1";
+        pnfNames[2] = "PNFDemo";
+        pnfNames[3] = "PNFDemo";
+        pnfNames[4] = "PNFDemo";
+        pnfNames[5] = "PNFDemo";
+        pnfNames[6] = "PNFDemo1";
+        pnfNames[7] = "PNFDemo1";
+        pnfNames[8] = "PNFDemo1";
+        pnfNames[9] = "PNFDemo1";
 
         executionVariables.clear();
 
@@ -125,22 +142,22 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
         }
 
         // Layout is to reflect the bpmn visual layout
-        assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_0qgmx7a",
-                "Activity_09bqns0", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_1q4o9fx",
-                "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2", "Gateway_1vq11i7",
-                "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th");
+        assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_09bqns0",
+                "Activity_02vp5np", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_0e6w886",
+                "Activity_1q4o9fx", "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2",
+                "Gateway_1vq11i7", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th");
 
         List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
         assertThat(detailedMessages.size() == 5);
         int count = 0;
+        String action = "";
         try {
             for (ExecutionServiceInput eSI : detailedMessages) {
-                for (String action : actionNames) {
-                    if (action.equals(eSI.getActionIdentifiers().getActionName())
-                            && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
-                        checkWithActionName(eSI, action);
-                        count++;
-                    }
+                action = actionNames[count];
+                if (action.equals(eSI.getActionIdentifiers().getActionName())
+                        && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
+                    checkWithActionName(eSI, action, pnfNames[count]);
+                    count++;
                 }
             }
         } catch (Exception e) {
@@ -155,7 +172,8 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
                 .singleResult() == null;
     }
 
-    private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action) {
+    private void checkWithActionName(final ExecutionServiceInput executionServiceInput, final String action,
+            final String pnfName) {
 
         logger.info("Checking the " + action + " request");
         ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
@@ -174,10 +192,10 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
         Struct payload = executionServiceInput.getPayload();
         Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
 
-        assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
+        assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(pnfName);
         Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
 
-        assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
+        assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(pnfName);
         assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
                 .isEqualTo("d88da85c-d9e8-4f73-b837-3a72a431622b");
         assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
@@ -188,25 +206,42 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
 
         final String sIUrl =
                 "/business/customers/customer/5df8b6de-2083-11e7-93ae-92361f002676/service-subscriptions/service-subscription/pNF/service-instances/service-instance/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce";
-        final String aaiPnfEntry = FileUtil.readResourceFile("response/Pnf_aai.json");
+        final String aaiPnfDemoEntry = FileUtil.readResourceFile("response/PnfDemo_aai.json");
+        final String aaiPnfDemo1Entry = FileUtil.readResourceFile("response/PnfDemo1_aai.json");
         final String aaiServiceInstanceEntry = FileUtil.readResourceFile("response/Service_instance_aai.json");
 
         /**
-         * PUT the PNF correlation ID to AAI.
+         * PUT the PNF correlation ID PnfDemo to AAI.
          */
         wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
 
         /**
-         * Get the PNF entry from AAI.
+         * PUT the PNF correlation ID PnfDemo1 to AAI.
+         */
+        wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")));
+
+        /**
+         * Get the PNF entry PnfDemo from AAI.
+         */
+        wireMockServer.stubFor(
+                get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfDemoEntry)));
+
+        /**
+         * Get the PNF entry PnfDemo1 from AAI.
          */
         wireMockServer.stubFor(
-                get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry)));
+                get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")).willReturn(okJson(aaiPnfDemo1Entry)));
 
         /**
-         * Post the pnf to AAI
+         * Post the pnf PnfDemo to AAI
          */
         wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
 
+        /**
+         * Post the pnf PnfDemo1 to AAI
+         */
+        wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")));
+
         /**
          * Get the Service Instance to AAI.
          */
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json
new file mode 100644 (file)
index 0000000..189d2c5
--- /dev/null
@@ -0,0 +1,42 @@
+{
+  "pnf-name": "PNFDemo1",
+  "pnf-id": "37c6e19d-6d9f-4085-98a9-d3fcbaf3a616",
+  "equip-type": "val8",
+  "equip-vendor": "Ericsson",
+  "equip-model": "val6",
+  "ipaddress-v4-oam": "10.10.10.44",
+  "sw-version": "5gDUv18.05.201",
+  "in-maint": false,
+  "serial-number": "7061ZW3",
+  "ipaddress-v6-oam": "2001:0db8:0:0:0:0:1428:57ab",
+  "resource-version": "1595010038094",
+  "nf-role": "gNB",
+  "relationship-list": {
+    "relationship": [
+      {
+        "related-to": "service-instance",
+        "related-link": "/aai/v11/business/customers/customer/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/5df8b6de-2083-11e7-93ae-92361f002676",
+        "relationship-data": [
+          {
+            "relationship-key": "customer.global-customer-id",
+            "relationship-value": "ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce"
+          },
+          {
+            "relationship-key": "service-subscription.service-type",
+            "relationship-value": "pNF"
+          },
+          {
+            "relationship-key": "service-instance.service-instance-id",
+            "relationship-value": "5df8b6de-2083-11e7-93ae-92361f002676"
+          }
+        ],
+        "related-to-property": [
+          {
+            "property-key": "service-instance.service-instance-name",
+            "property-value": "Service_Ete_Name123452c4-3d7f-42ce-8188-818fab951269"
+          }
+        ]
+      }
+    ]
+  }
+},
\ No newline at end of file
index 53fb210..8ea4263 100644 (file)
             "relationship-value": "PNFDemo"
           }
         ]
+      },
+      {
+        "related-to": "pnf",
+        "related-link": "/aai/v11/network/pnfs/pnf/PNFDemo1",
+        "relationship-data": [
+          {
+            "relationship-key": "pnf.pnf-name",
+            "relationship-value": "PNFDemo1"
+          }
+        ]
       }
     ]
   }
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.service.level;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import jline.internal.Log;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
 import org.onap.so.client.exception.ExceptionBuilder;
@@ -35,9 +36,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 /**
  * Parent class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
  */
-public class ServiceLevelPreparable {
+public class ServiceLevel {
 
-    protected static final Logger LOG = LoggerFactory.getLogger(ServiceLevelPreparable.class);
+    protected static final Logger LOG = LoggerFactory.getLogger(ServiceLevel.class);
 
     @Autowired
     protected ExceptionBuilder exceptionBuilder;
@@ -45,6 +46,10 @@ public class ServiceLevelPreparable {
     @Autowired
     protected CatalogDbClient catalogDbClient;
 
+    private static final String PNF_NAME_LIST = "pnfNameList";
+
+    private static final String PNF_COUNTER = "pnfCounter";
+
     /**
      * Fetches workflow names based on the controller scope and operation name.
      *
@@ -95,4 +100,20 @@ public class ServiceLevelPreparable {
 
     }
 
+    /**
+     * This method set correct value of pnf name for health check and software upgrade workflow.
+     *
+     * @param delegateExecution Delegate execution obj
+     */
+    public void pnfCounterExecution(DelegateExecution delegateExecution) {
+        LOG.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(),
+                delegateExecution.getCurrentActivityName());
+
+        final List<String> pnfNameList = (List<String>) delegateExecution.getVariable(PNF_NAME_LIST);
+        final int pnfCounter = (int) delegateExecution.getVariable(PNF_COUNTER);
+
+        delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME, pnfNameList.get(pnfCounter));
+        delegateExecution.setVariable(PNF_COUNTER, pnfCounter + 1);
+    }
+
 }
index 7b73fff..b0b12b5 100644 (file)
@@ -38,6 +38,10 @@ public class ServiceLevelConstants {
     public static final String SW_UP_OPERATION = "ResourceSoftwareUpgrade";
     public static final String CONTROLLER_STATUS = "ControllerStatus";
     public static final int ERROR_CODE = 601;
+    public static final String PNF_COUNTER = "pnfCounter";
+    public static final int COUNT_ZERO = 0;
+    public static final String PNF_NAME_LIST = "pnfNameList";
+    public static final String PNF_SIZE = "pnfSize";
 
     // TODO GenericVNFHealthCheck and GenericVnfSoftwareUpgrade workflow names should be updated once the workflow is
     // implemented.
index fad28e3..8e720c3 100644 (file)
@@ -8,6 +8,6 @@ import org.springframework.stereotype.Component;
 public class ServiceLevelPostcheck implements JavaDelegate {
     @Override
     public void execute(DelegateExecution delegateExecution) throws Exception {
-        // TODO : Set serviceInstance to aai
+        // Write your postcheck operations here, if any
     }
 }
index 59884ec..6cb3461 100644 (file)
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Map;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevel;
 import org.springframework.stereotype.Component;
 
 
@@ -35,10 +35,10 @@ import org.springframework.stereotype.Component;
  * validation.
  */
 @Component("ServiceLevelPreparation")
-public class ServiceLevelPreparation extends ServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelPreparation extends ServiceLevel implements JavaDelegate {
 
     private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
-            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST);
 
     // TODO Update the list with vnf health check parameters if any validation needed
     private static final List<String> VNF_HEALTH_CHECK_PARAMS = Collections.emptyList();
@@ -48,6 +48,9 @@ public class ServiceLevelPreparation extends ServiceLevelPreparable implements J
 
     @Override
     public void execute(DelegateExecution execution) throws Exception {
+        LOG.debug("Running execute block for activity id: {}, name: {}", execution.getCurrentActivityId(),
+                execution.getCurrentActivityName());
+
         if (execution.hasVariable(ServiceLevelConstants.RESOURCE_TYPE)
                 && execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
             final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
@@ -60,6 +63,7 @@ public class ServiceLevelPreparation extends ServiceLevelPreparable implements J
                 LOG.info("Parameters validated successfully for {}", wflName);
                 execution.setVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE, wflName);
                 execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
+                execution.setVariable(ServiceLevelConstants.PNF_COUNTER, ServiceLevelConstants.COUNT_ZERO);
             } else {
                 exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
                         "Invalid Controller scope to prepare resource level health check");
index 5b20a86..5d9295d 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.service.level.impl;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Relationship;
 import org.onap.aai.domain.yang.ServiceInstance;
 import org.onap.aaiclient.client.aai.AAIRestClientI;
 import org.onap.aaiclient.client.aai.AAIRestClientImpl;
@@ -34,7 +35,11 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
 
 /**
@@ -83,21 +88,18 @@ public class ServiceLevelRequestDispatcher implements JavaDelegate {
         Optional<ServiceInstance> optionalSi =
                 restClient.getServiceInstanceById(serviceInstanceId, serviceType, globalSubscriberId);
 
-        if (!optionalSi.isPresent()) {
-
-        }
-
         optionalSi.ifPresentOrElse(serviceInstance -> {
-            final String pnfName = serviceInstance.getRelationshipList().getRelationship().stream()
-                    .filter(x -> x.getRelatedTo().contains("pnf")).findFirst().get().getRelationshipData().stream()
-                    .filter(data -> data.getRelationshipKey().contains("pnf.pnf-name")).findFirst().get()
-                    .getRelationshipValue();
-            if (pnfName == null || pnfName.isEmpty()) {
+            final List<String> pnfNameList = serviceInstance.getRelationshipList().getRelationship().stream()
+                    .filter(x -> x.getRelatedTo().contains("pnf")).flatMap(x -> x.getRelationshipData().stream())
+                    .filter(data -> data.getRelationshipKey().contains("pnf.pnf-name"))
+                    .map(x -> x.getRelationshipValue()).collect(Collectors.toList());
+            if (pnfNameList == null || pnfNameList.size() == 0) {
                 logger.warn(
                         "Unable to find the PNF for service instance id: " + serviceInstance.getServiceInstanceId());
                 return;
             }
-            delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME, pnfName);
+            delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME_LIST, pnfNameList);
+            delegateExecution.setVariable(ServiceLevelConstants.PNF_SIZE, pnfNameList.size());
             delegateExecution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.PNF);
         }, () -> {
             throwExceptionWithWarn(delegateExecution, "Unable to find the service instance: " + serviceInstanceId);
index 9d7d8ef..a3a8f6e 100644 (file)
@@ -26,14 +26,14 @@ import java.util.List;
 import java.util.Map;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevel;
 import org.springframework.stereotype.Component;
 
 @Component
-public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelUpgrade extends ServiceLevel implements JavaDelegate {
 
     private static final List<String> PNF_SOFTWARE_UP_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
-            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST);
 
     // TODO Update the list with vnf software upgrade parameters if any validation needed
     private static final List<String> VNF_SOFTWARE_UP_PARAMS = Collections.emptyList();
@@ -44,6 +44,9 @@ public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaD
 
     @Override
     public void execute(DelegateExecution execution) throws Exception {
+        LOG.debug("Running execute block for activity id: {}, name: {}", execution.getCurrentActivityId(),
+                execution.getCurrentActivityName());
+
         if (execution.hasVariable(ServiceLevelConstants.RESOURCE_TYPE)
                 && execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
             final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
@@ -54,7 +57,8 @@ public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaD
                 validateParamsWithScope(execution, controllerScope, SOFTWARE_UP_PARAMS_MAP.get(controllerScope));
                 LOG.info("Parameters validated successfully for {}", wflName);
                 execution.setVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE, wflName);
-                execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, "");
+                execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
+                execution.setVariable(ServiceLevelConstants.PNF_COUNTER, ServiceLevelConstants.COUNT_ZERO);
             } else {
                 exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
                         "Invalid Controller scope for resource level software upgrade");
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 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: