Merge branch 'recursive-orch' 90/130190/1
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Fri, 5 Aug 2022 12:19:19 +0000 (14:19 +0200)
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Fri, 5 Aug 2022 12:19:57 +0000 (14:19 +0200)
Issue-ID: SO-3980
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: Ie0cd0f973800196d5cb1e038db4a49208a6c4a3b

111 files changed:
INFO.yaml
adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java
adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java
adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java
adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
bpmn/pom.xml
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HealthCheckBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/pom.xml
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceRequest.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceResponse.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoaderTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
common/src/test/java/org/onap/so/client/HttpClientTest.java
common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java [new file with mode: 0644]
docs/architecture/SO Internal Arc.pptx
docs/architecture/architecture.rst
docs/developer_info/BPMN-INFRA_Workflow_Understanding.rst
docs/developer_info/CSIT_Macroflow_developer_info.rst [new file with mode: 0644]
docs/developer_info/Docker-Config_Understanding.rst
docs/developer_info/E2E_Network_Slicing_Understanding.rst [new file with mode: 0644]
docs/developer_info/ETSI_CSIT_NFVO_VNFM.rst [new file with mode: 0644]
docs/developer_info/developer_information.rst
docs/images/Architecture_flow.png [new file with mode: 0644]
docs/images/SO-NFVO-Architecture-1.png [new file with mode: 0644]
docs/images/SO-SOL003-Adapter-Architecture-1.png [new file with mode: 0644]
docs/images/SO_Architecture_2.png [new file with mode: 0644]
docs/images/architecture-choices-e2e-slicing.png [new file with mode: 0644]
docs/images/e2e-network-slicing-architecture.png [new file with mode: 0644]
docs/images/lifecycle-of-network-slice-instance.png [new file with mode: 0644]
docs/images/slicing-option1.png [new file with mode: 0644]
docs/images/slicing-option2.png [new file with mode: 0644]
docs/release-notes.rst
docs/requirements-docs.txt
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIObjectTypeTest.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockRollback.java
mso-catalog-db/src/test/resources/schema.sql
releases/1.10.0.yaml [new file with mode: 0644]
so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroValidator.java
so-optimization-clients/src/test/java/org/onap/so/client/oof/OofValidatorTest.java
so-optimization-clients/src/test/java/org/onap/so/client/sniro/SniroValidatorTest.java [new file with mode: 0644]
version.properties

index bc297f9..b0acad1 100644 (file)
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -1,29 +1,66 @@
-
-    - name: 'Chuanyu Chen'
-      email: 'chenchuanyu@huawei.com'
-      company: 'Huawei'
-      id: 'boychuanyu'
-      timezone: 'Asia/Shanghai'
+---
+project: 'so'
+project_creation_date: '2017-06-15'
+lifecycle_state: 'Mature'
+project_category: ''
+project_lead: &onap_releng_ptl
+    name: 'Seshu Kumar M'
+    email: 'seshu.kumar.m@huawei.com'
+    id: 'seshukm'
+    company: 'Huawei Technologies India Pvt Ltd'
+    timezone: 'India/Bangalore'
+primary_contact: *onap_releng_ptl
+issue_tracking:
+    type: 'jira'
+    url: 'https://jira.onap.org/projects/SO'
+    key: 'SO'
+mailing_list:
+    type: 'groups.io'
+    url: 'lists.onap.org'
+    tag: '<[sub-project_name]>'
+realtime_discussion: ''
+meetings:
+    - type: 'zoom'
+      agenda: 'https://wiki.onap.org/display/DW/Service+Orchestrator+Project'
+      url: 'https://wiki.onap.org/display/DW/Service+Orchestrator+Project'
+      server: 'n/a'
+      channel: 'n/a'
+      repeats: 'weekly'
+      time: '12:30 UTC'
+repositories:
+    - 'so'
+committers:
+    - <<: *onap_releng_ptl
     - name: 'Byung-Woo Jun'
       email: 'byung-woo.jun@ericsson.com'
       company: 'Ericsson'
       id: 'byungwoojun'
       timezone: 'America/New_York'
-    - name: 'Steve Smokowski'
-      email: 'ss835w@att.com'
-      company: 'ATT'
-      id: 'stevesmokowski'
-      timezone: 'America/New_York'
-    - name: 'Lukasz Muszkieta'
-      email: 'lukasz.muszkieta@nokia.com'
-      company: 'Nokia'
-      id: 'lukaszM'
-      timezone: 'Europe/Warsaw'
-    - name: 'Ramesh Parthasarathy'
-      email: 'ramesh.parthasarathy@att.com'
-      company: 'ATT'
-      id: 'parthasram'
-      timezone: 'PST'
+    - name: 'Waqas Ikram'
+      email: 'waqas.ikram@est.tech'
+      company: 'Ericsson'
+      id: 'waqas.ikram'
+      timezone: 'Ireland/Dublin'
+    - name: 'Lukasz Rajewski'
+      email: 'lukasz.rajewski@orange.com'
+      company: 'Orange'
+      id: 'rajewluk'
+      timezone: 'Poland/Warsaw'
+    - name: 'Shashikanth VH'
+      email: 'shashikanth.vh@huawei.com'
+      company: 'Huawei Technologies India  Pvt Ltd'
+      id: 'shashikanth.vh'
+      timezone: 'India/Bangalore'
+    - name: 'Jozsef Csongvai'
+      email: 'jozsef.csongvai@bell.ca'
+      company: 'Bell Canada'
+      id: 'jozsef'
+      timezone: 'Canada/Ontario'
+    - name: 'Md Irshad Sheikh'
+      email: 'md.irshad.sheikh@huawei.com'
+      company: 'Huawei Technologies India  Pvt Ltd'
+      id: 'irshad97'
+      timezone: 'India/Bangalore'
 tsc:
     approval: 'https://lists.onap.org/pipermail/onap-tsc'
     changes:
@@ -77,7 +114,7 @@ tsc:
           link: 'https://lists.onap.org/g/onap-tsc/message/4320'
         - type: 'removal'
           name: 'Rob Daugherty'
-          link: 'https://lists.onap.org/g/onap-tsc/message/4320'          
+          link: 'https://lists.onap.org/g/onap-tsc/message/4320'
         - type: 'addition'
           name: 'Max Benjamin'
           link: 'https://lists.onap.org/g/onap-tsc/message/4320'
@@ -102,3 +139,6 @@ tsc:
         - type: 'removal'
           name: 'Max Benjamin'
           link: 'https://wiki.onap.org/display/DW/2021+TSC+Decisions'
+        - type: 'removal'
+          name: 'Steve'
+          link: 'https://wiki.onap.org/display/Meetings/TSC+2022-03-03'
index 41aac00..78b5c8e 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2022 Samsung Electronics.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@ package org.onap.so.cloud.authentication;
 
 import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -61,7 +62,7 @@ public class AuthenticationMethodTest {
         ci.setMsoId("test");
 
         Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
-        assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
+        assertEquals(RackspaceAuthentication.class, auth.getClass());
 
     }
 
@@ -73,7 +74,7 @@ public class AuthenticationMethodTest {
         ci.setMsoId("someuser");
 
         Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
-        assertTrue(UsernamePassword.class.equals(auth.getClass()));
+        assertEquals(UsernamePassword.class, auth.getClass());
 
     }
 
@@ -85,7 +86,7 @@ public class AuthenticationMethodTest {
         ci.setMsoId("test");
 
         Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
-        assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
+        assertEquals(RackspaceAuthentication.class, auth.getClass());
     }
 
     @Test
@@ -96,7 +97,7 @@ public class AuthenticationMethodTest {
         ci.setMsoId("someuser");
 
         Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
-        assertTrue(UsernamePassword.class.equals(auth.getClass()));
+        assertEquals(UsernamePassword.class, auth.getClass());
 
     }
 
index 622ad4f..160201f 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2022 - Samsung Electronics. 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.
@@ -100,19 +101,19 @@ public class MsoCommonUtilsTest extends BaseTest {
         MsoException me = commonUtils.keystoneErrorToMsoException(openStackConnectException, "ContextError");
 
         assertTrue(me instanceof MsoIOException);
-        assertTrue("connect".equals(me.getMessage()));
+        assertEquals("connect", me.getMessage());
 
 
         MsoException me2 = commonUtils.keystoneErrorToMsoException(openStackResponseException, "ContextError");
         assertTrue(me2 instanceof MsoOpenstackException);
-        assertTrue("ContextError".equals(me2.getContext()));
-        assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+        assertEquals("ContextError", me2.getContext());
+        assertEquals(MsoExceptionCategory.OPENSTACK, me2.getCategory());
 
 
         OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class);
         Error error = mapper.readValue(new File(RESOURCE_PATH + "Error.json"), Error.class);
 
-        doReturn(error).when(openStackResponse).getErrorEntity(eq(Error.class));
+        doReturn(error).when(openStackResponse).getErrorEntity(Error.class);
 
         openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse);
 
@@ -131,19 +132,19 @@ public class MsoCommonUtilsTest extends BaseTest {
         MsoException me = commonUtils.heatExceptionToMsoException(openStackConnectException, "ContextError");
 
         assertTrue(me instanceof MsoIOException);
-        assertTrue("connect".equals(me.getMessage()));
+        assertEquals("connect", me.getMessage());
 
 
         MsoException me2 = commonUtils.heatExceptionToMsoException(openStackResponseException, "ContextError");
         assertTrue(me2 instanceof MsoOpenstackException);
-        assertTrue("ContextError".equals(me2.getContext()));
-        assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+        assertEquals("ContextError", me2.getContext());
+        assertEquals(MsoExceptionCategory.OPENSTACK, me2.getCategory());
 
 
         OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class);
         Explanation explanation = mapper.readValue(new File(RESOURCE_PATH + "Explanation.json"), Explanation.class);
 
-        doReturn(explanation).when(openStackResponse).getErrorEntity(eq(Explanation.class));
+        doReturn(explanation).when(openStackResponse).getErrorEntity(Explanation.class);
 
         openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse);
 
@@ -163,18 +164,18 @@ public class MsoCommonUtilsTest extends BaseTest {
         MsoException me = commonUtils.neutronExceptionToMsoException(openStackConnectException, "ContextError");
 
         assertTrue(me instanceof MsoIOException);
-        assertTrue("connect".equals(me.getMessage()));
+        assertEquals("connect", me.getMessage());
 
         MsoException me2 = commonUtils.neutronExceptionToMsoException(openStackResponseException, "ContextError");
         assertTrue(me2 instanceof MsoOpenstackException);
-        assertTrue("ContextError".equals(me2.getContext()));
-        assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+        assertEquals("ContextError", me2.getContext());
+        assertEquals(MsoExceptionCategory.OPENSTACK, me2.getCategory());
 
 
         OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class);
         NeutronError explanation = mapper.readValue(new File(RESOURCE_PATH + "NeutronError.json"), NeutronError.class);
 
-        doReturn(explanation).when(openStackResponse).getErrorEntity(eq(NeutronError.class));
+        doReturn(explanation).when(openStackResponse).getErrorEntity(NeutronError.class);
 
         openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse);
 
@@ -190,8 +191,8 @@ public class MsoCommonUtilsTest extends BaseTest {
         MsoException me = commonUtils.runtimeExceptionToMsoException(re, "ContextError");
 
         assertTrue(me instanceof MsoAdapterException);
-        assertTrue("ContextError".equals(me.getContext()));
-        assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory()));
+        assertEquals("ContextError", me.getContext());
+        assertEquals(MsoExceptionCategory.INTERNAL, me.getCategory());
     }
 
     @Test
@@ -202,6 +203,7 @@ public class MsoCommonUtilsTest extends BaseTest {
 
         assertTrue(msoException instanceof MsoAdapterException);
         assertEquals("ContextError", msoException.getContext());
-        assertTrue(MsoExceptionCategory.INTERNAL.equals(msoException.getCategory()));
+        assertEquals(MsoExceptionCategory.INTERNAL, msoException.getCategory());
     }
 }
+
index 2c67dfd..18372bb 100644 (file)
@@ -16,8 +16,7 @@
 package org.onap.so.openstack.utils;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotEquals;
 import org.junit.Test;
 
 public class MsoHeatEnvironmentResourceTest {
@@ -36,8 +35,8 @@ public class MsoHeatEnvironmentResourceTest {
         assertEquals("maeValue", mae.getValue());
         assertEquals("\"msoHERName\": msoHERValue", msoHER.toString());
         assertEquals("\"name\": maeValue", mae.toString());
-        assertFalse(mae.equals(op));
-        assertTrue(mae.equals(mre));
+        assertNotEquals(mae, op);
+        assertEquals(mae, mre);
         assertEquals("name".hashCode(), mae.hashCode());
     }
 }
index 5ee4987..85219c3 100644 (file)
@@ -447,7 +447,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
 
         heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
         Mockito.verify(stackResource, times(1)).create(createStackParam);
-        Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), eq(requestId), eq("stackName"));
+        Mockito.verify(heatUtils, times(1)).saveStackRequest(createStackParam, requestId, "stackName");
         Mockito.verify(heatClient, times(1)).getStacks();
         Mockito.verify(stackResource, times(1)).create(createStackParam);
     }
index 7adfe09..d197550 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
- * Copyright (C) 2019 Samsung Intellectual Property. All rights reserved.
+ * Copyright (C) 2022 Samsung Intellectual Property. 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.
@@ -28,7 +28,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.when;
 import static org.onap.so.openstack.utils.MsoMulticloudUtils.MULTICLOUD_QUERY_BODY_NULL;
@@ -113,13 +113,13 @@ public class MsoMulticloudUtilsTest extends BaseTest {
         StackInfo result =
                 multicloudUtils.deleteStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack/TEST-workload");
         assertNotNull(result);
-        assertTrue(HeatStatus.NOTFOUND == result.getStatus());
+        assertSame(HeatStatus.NOTFOUND, result.getStatus());
     }
 
     @Test
     public void queryStack() throws MsoException {
         StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
-        assertTrue(HeatStatus.NOTFOUND == result.getStatus());
+        assertSame(HeatStatus.NOTFOUND, result.getStatus());
     }
 
     @Test
@@ -129,7 +129,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
                         .withStatus(HttpStatus.SC_OK)));
 
         StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceName/instanceId");
-        assertTrue(HeatStatus.FAILED == result.getStatus());
+        assertSame(HeatStatus.FAILED, result.getStatus());
         assertEquals(MULTICLOUD_QUERY_BODY_NULL, result.getStatusMessage());
     }
 
@@ -143,7 +143,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
         CloudInfo cloudInfo = new CloudInfo("cloudSiteId", "cloudOwner", "tenantId", "tenantName");
         VduInstance vduInstance = multicloudUtils.deleteVdu(cloudInfo, "instanceId", 3);
         assertNotNull(vduInstance);
-        assertTrue(VduStateType.DELETED == vduInstance.getStatus().getState());
+        assertSame(VduStateType.DELETED, vduInstance.getStatus().getState());
     }
 
     @Ignore
index 9b21dcd..c1a67a5 100644 (file)
@@ -26,7 +26,7 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
 ('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'DEFAULT', '*'),
 ('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'DEFAULT', '*'),
 ('VNF-Macro-Delete', 'deleteInstance', 'Vnf', false,true, '7', '7', 'DEFAULT', '*'),
-('VNF-Macro-Modify', 'updateInstance', 'Vnf', false,true, '7', '7','k8scloudowner4', '*'),
+('VNF-Macro-Modify', 'updateInstance', 'Vnf', false,true, '7', '7','DEFAULT', '*'),
 ('VNF-Macro-HealthCheck', 'healthCheck', 'Vnf', false,true, '7', '7','DEFAULT', '*'),
 ('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'DEFAULT', '*'),
 ('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'DEFAULT', '*'),
@@ -39,7 +39,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
 ('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
 ('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'DEFAULT', '*'),
 ('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
-('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
+('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
+('CNF-Macro-Upgrade', 'upgradeCnf', 'Vnf', false,true, '7', '7','DEFAULT', '*');
 
 
 INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, SCOPE, ACTION, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
@@ -255,9 +256,22 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, SC
 ('VNF-Config-Update', '7', 'VNFHealthCheckActivity', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Config-Update', '8', 'VNFUnsetInMaintFlagActivity', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Config-Update', '9', 'VNFUnsetClosedLoopDisabledFlagActivity', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
-('VNF-Macro-Modify', '1', 'ControllerExecutionBB', 'vnf', 'config-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'k8scloudowner4')),
-('VNF-Macro-Modify', '2', 'ControllerExecutionBB', 'vnf', 'config-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'k8scloudowner4')),
-('VNF-Macro-HealthCheck', '1', 'HealthCheckBB', 'vnf', 'status-check', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-HealthCheck' and CLOUD_OWNER = 'DEFAULT'));
+('VNF-Macro-Modify', '1', 'ControllerExecutionBB', 'vnf', 'config-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Modify', '2', 'ControllerExecutionBB', 'vnf', 'config-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-HealthCheck', '1', 'HealthCheckBB', 'vnf', 'status-check', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-HealthCheck' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-HealthCheck', '2', 'HealthCheckBB', 'vnf', 'health-check', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-HealthCheck' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '1', 'AAICheckVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '2', 'AAISetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '3', 'DeactivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '4', 'DeactivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '5', 'ChangeModelVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '6', 'ControllerExecutionBB', 'vnf', 'config-upgrade-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '7', 'UpgradeVfModuleBB', NULL , NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '8', 'ControllerExecutionBB', 'vnf', 'config-upgrade-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '9', 'ActivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '10', 'ChangeModelVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '11', 'ActivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '12', 'AAIUnsetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT'));
 
 INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
 VALUES
@@ -416,7 +430,11 @@ VALUES
 ('VNFConfigModifyActivity', 'NO_VALIDATE', 'CUSTOM'),
 ('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'),
 ('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM'),
-('ControllerExecutionBB', 'NO_VALIDATE', 'CUSTOM');
+('ControllerExecutionBB', 'NO_VALIDATE', 'CUSTOM'),
+('StatusCheckBB', 'NO_VALIDATE', 'CUSTOM'),
+('HealthCheckBB', 'NO_VALIDATE', 'CUSTOM'),
+('UpgradeVfModuleBB', 'NO_VALIDATE', 'CUSTOM');
+
 
 INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive)
 VALUES
@@ -866,3 +884,28 @@ DELETE FROM service_recipe where ACTION = 'upgradeInstance';
 INSERT INTO service_recipe (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID)
 VALUES
 ('upgradeInstance', '1.0', 'Gr api recipe to upgrade service-instance', '/mso/async/services/WorkflowActionBB', 180, 'd88da85c-d9e8-4f73-b837-3a72a431622b');
+
+INSERT INTO building_block_rollback(BUILDING_BLOCK_NAME,ACTION,ROLLBACK_BUILDING_BLOCK_NAME,ROLLBACK_ACTION)
+VALUES
+('ActivateNetworkBB',NULL,'DeactivateNetworkBB',NULL),
+('ActivatePnfBB',NULL,'DeactivatePnfBB',NULL),
+('ActivateServiceInstanceBB',NULL,'DeactivateServiceInstanceBB',NULL),
+('ActivateVfModuleBB',NULL,'DeactivateVfModuleBB',NULL),
+('ActivateVnfBB',NULL,'DeactivateVnfBB',NULL),
+('ActivateVolumeGroupBB',NULL,'DeactivateVolumeGroupBB',NULL),
+('AssignNetworkBB',NULL,'UnassignNetworkBB',NULL),
+('AssignServiceInstanceBB',NULL,'UnassignServiceInstanceBB',NULL),
+('AssignVfModuleBB',NULL,'UnassignVfModuleBB',NULL),
+('AssignVnfBB',NULL,'UnassignVnfBB',NULL),
+('AssignVolumeGroupBB',NULL,'UnassignVolumeGroupBB',NULL),
+('CreateNetworkBB',NULL,'DeleteNetworkBB',NULL),
+('CreateNetworkCollectionBB',NULL,'DeleteNetworkCollectionBB',NULL),
+('CreateVfModuleBB',NULL,'DeleteVfModuleBB',NULL),
+('CreateVolumeGroupBB',NULL,'DeleteVolumeGroupBB',NULL),
+('VNFSetInMaintFlagActivity',NULL,'VNFUnsetInMaintFlagActivity',NULL),
+('VNFSetClosedLoopDisabledFlagActivity',NULL,'VNFUnsetClosedLoopDisabledFlagActivity',NULL),
+('VNFLockActivity',NULL,'VNFUnlockActivity',NULL),
+('VNFStopActivity',NULL,'VNFStartActivity',NULL),
+('VNFQuiesceTrafficActivity',NULL,'VNFResumeTrafficActivity',NULL),
+('EtsiVnfInstantiateBB',NULL,'EtsiVnfDeleteBB',NULL),
+('AddFabricConfigurationBB',NULL,'DeleteFabricConfigurationBB',NULL);
index e4a2d66..6dfc863 100644 (file)
@@ -35,6 +35,7 @@ INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORC
 INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (4,'deleteInstance','1','DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc3acd-a9fe-11e7-8b4b-0242ac120002');
 insert into `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) values (500,'updateInstance','1.0','Gr api recipe to update service-instance', '/mso/async/services/WorkflowActionBB', NULL, 180, NULL, '2017-10-05 18:52:03', 'd88da85c-d9e8-4f73-b837-3a72a431622b');
 insert into `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) values (501,'healthCheck','1.0','Gr api recipe to do CNF health check', '/mso/async/services/WorkflowActionBB', NULL, 180, NULL, '2021-08-20 18:52:03', 'd88da85c-d9e8-4f73-b837-3a72a431622b');
+insert into `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) values (525,'upgradeCnf','1.0','Gr api recipe to do CNF upgrade', '/mso/async/services/WorkflowActionBB', NULL, 180, NULL, '2022-01-20 18:52:03', 'd88da85c-d9e8-4f73-b837-3a72a431622b');
 
 --
 -- Custom Reciepe for the VoLTE service added temporarily
@@ -106,4 +107,6 @@ INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSI
 INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (12,NULL,'deleteInstance',NULL,'1','NS_DEFAULT','default custom E2E recipe to delete NS if no custom BPMN flow is found','/mso/async/services/DeleteVFCNSResource',NULL,180,'2018-04-18 18:52:03');
 INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (13,NULL,'inPlaceSoftwareUpdate',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to update VNF software if no custom BPMN flow is found','/mso/async/services/VnfInPlaceUpdate',NULL,180,'2018-05-23 11:00:00');
 INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (14,NULL,'applyUpdatedConfig',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to apply updated VNF config if no custom BPMN flow is found','/mso/async/services/VnfConfigUpdate',NULL,180,'2018-05-23 11:00:00');
-SET FOREIGN_KEY_CHECKS=1;
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10030,NULL,'upgradeCnf',NULL,'1','GR-API-DEFAULT','Gr api recipe to do CNF-Upgrade','/mso/async/services/WorkflowActionBB',NULL,180,'2022-01-23 10:00:00');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10032,NULL,'healthCheck',NULL,'1','GR-API-DEFAULT','Gr api recipe to do CNF health check','/mso/async/services/WorkflowActionBB',NULL,180,'2022-01-05 18:52:03');
+SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
index 48ef132..74ea27c 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2022 Samsung Electronics Intellectual Property. 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.
@@ -813,7 +814,7 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
                 restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
 
         assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
-        JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+        JSONAssert.assertEquals(badQueryParamResponse, response.getBody(), false);
     }
 
     @Test
@@ -850,10 +851,10 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
         ObjectMapper mapper = new ObjectMapper();
         ProcessingFlags processingFlagsResponse = mapper.readValue(response.getBody(), ProcessingFlags.class);
 
-        assertEquals(processingFlagsResponse.getFlag(), "TESTFLAG");
-        assertEquals(processingFlagsResponse.getValue(), "NO");
-        assertEquals(processingFlagsResponse.getEndpoint(), "TESTENDPOINT");
-        assertEquals(processingFlagsResponse.getDescription(), "TEST FLAG");
+        assertEquals("TESTFLAG", processingFlagsResponse.getFlag());
+        assertEquals("NO", processingFlagsResponse.getValue());
+        assertEquals("TESTENDPOINT", processingFlagsResponse.getEndpoint());
+        assertEquals("TEST FLAG", processingFlagsResponse.getDescription());
     }
 
     @Test
@@ -876,8 +877,8 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
         boolean testFlagFound = false;
         for (int i = 0; i < processingFlagsResponse.size(); i++) {
             if (processingFlagsResponse.get(i).getFlag().equals("TESTFLAG")) {
-                assertEquals(processingFlagsResponse.get(i).getEndpoint(), "TESTENDPOINT");
-                assertEquals(processingFlagsResponse.get(i).getDescription(), "TEST FLAG");
+                assertEquals("TESTENDPOINT", processingFlagsResponse.get(i).getEndpoint());
+                assertEquals("TEST FLAG", processingFlagsResponse.get(i).getDescription());
                 testFlagFound = true;
             }
         }
index 2266eaf..d7852cf 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * Copyright (c) 2022, Samsung Electronics. 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.
@@ -35,7 +36,7 @@ public class QueryServiceArtifactTest {
         QueryServiceArtifact queryServiceArtifact = new QueryServiceArtifact(createList());
         String jsonResult = queryServiceArtifact.JSON2(true, false);
         Assertions.assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.serviceArtifact[0].name").get())
-                .isEqualTo("eMBB.zip");
+                .contains("eMBB.zip");
     }
 
     private List<ServiceArtifact> createList() {
index e948141..37fd464 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * Copyright (c) 2022, Samsung Electronics. 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.
@@ -35,7 +36,7 @@ public class QueryServiceInfoTest {
         QueryServiceInfo queryServiceInfo = new QueryServiceInfo(createList());
         String jsonResult = queryServiceInfo.JSON2(true, false);
         String serviceInfo = jsonResult.substring(jsonResult.indexOf("{"), jsonResult.length());
-        Assertions.assertThat(JsonPathUtil.getInstance().locateResult(serviceInfo, "$.id").get()).isEqualTo("1");
+        Assertions.assertThat(JsonPathUtil.getInstance().locateResult(serviceInfo, "$.id").get()).contains("1");
     }
 
     private List<ServiceInfo> createList() {
index 8ce4051..4e273d5 100644 (file)
@@ -34,6 +34,7 @@ import org.junit.Test;
 import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
 import org.onap.so.db.catalog.beans.AuthenticationType;
 import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.onap.so.db.catalog.beans.BuildingBlockRollback;
 import org.onap.so.db.catalog.beans.CloudIdentity;
 import org.onap.so.db.catalog.beans.CloudSite;
 import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -780,5 +781,11 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
         assertEquals(processingFlags.getEndpoint(), "TESTENDPOINT");
     }
 
+    @Test
+    public void testGetBuildingBlocksList() {
+        List<BuildingBlockRollback> rollbackEntries = client.getBuildingBlockRollbackEntries();
+        assertTrue(rollbackEntries.size() > 1);
+    }
+
 
 }
index c281dbd..17fd994 100644 (file)
@@ -35,6 +35,7 @@ package org.onap.so.heatbridge.utils;
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -71,6 +72,9 @@ public final class HeatBridgeUtils {
     }
 
     public static List<String> extractPciIdsFromVServer(Vserver vserver) {
+        if (vserver.getLInterfaces() == null) {
+            return Collections.emptyList();
+        }
         return vserver.getLInterfaces().getLInterface().stream()
                 .filter(lInterface -> lInterface.getSriovVfs() != null
                         && CollectionUtils.isNotEmpty(lInterface.getSriovVfs().getSriovVf()))
index 33805f9..59919c6 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2022, Samsung Electronics. 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.
@@ -26,7 +27,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 import java.sql.Timestamp;
 import java.time.Instant;
 import java.time.temporal.ChronoUnit;
@@ -339,7 +339,8 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
                 requestsDbClient.getRequestProcessingDataBySoRequestIdAndNameAndTagOrderByCreateTimeDesc(
                         "00032ab7-na18-42e5-965d-8ea592502018", "requestAction", "pincFabricConfigRequest");
         assertNotNull(requestProcessingData);
-        assertTrue(requestProcessingData.size() == 1);
+        assertEquals(1, requestProcessingData.size());
         assertEquals("assign", requestProcessingData.get(0).getValue());
     }
 }
+
index 77821bf..3cf9314 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2018 TechMahindra
+ * Copyright (c) 2022, Samsung Electronics. 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.
@@ -37,7 +38,8 @@ public class MsoRequestsDbExceptionBeanTest {
     public void testGetMessage() {
         soRequestsDbExceptionBean.setMessage("message");
         Assert.assertNotNull(soRequestsDbExceptionBean.getMessage());
-        Assert.assertEquals(soRequestsDbExceptionBean.getMessage(), "message");
+        Assert.assertEquals("message", soRequestsDbExceptionBean.getMessage());
     }
 
 }
+
index 04f597f..94c6d26 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2018 TechMahindra
+ * Copyright (c) 2022, Samsung Electronics. 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.
@@ -27,7 +28,7 @@ public class MsoRequestsDbExceptionTest {
     public void testConstructorWithMessaqge() throws Exception {
         String message = "testing message";
         MsoRequestsDbException msoRequestsDbException = new MsoRequestsDbException(message);
-        Assert.assertTrue(msoRequestsDbException.getCause() == null);
+        Assert.assertNull(msoRequestsDbException.getCause());
         Assert.assertEquals(message, msoRequestsDbException.getLocalizedMessage());
         Assert.assertEquals(message, msoRequestsDbException.getMessage());
     }
@@ -64,3 +65,4 @@ public class MsoRequestsDbExceptionTest {
     }
 
 }
+
index c1bbb9a..557a67b 100644 (file)
@@ -24,6 +24,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
 import static com.github.tomakehurst.wiremock.client.WireMock.post;
 import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNotNull;
 import org.apache.http.HttpStatus;
 import org.junit.Test;
@@ -48,7 +49,6 @@ public class BPRestCallbackTest extends BaseTest {
                         .withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES)));
 
         boolean responseCommon = bpRestCallback.send("http://localhost:" + wireMockPort + "/sdnc", "Test");
-        assertNotNull(responseCommon);
-        assertEquals(true, responseCommon);
+        assertTrue(responseCommon);
     }
 }
index a38eb8c..b29b95a 100644 (file)
@@ -1252,7 +1252,7 @@ public class BBInputSetup implements JavaDelegate {
                 || requestAction.equalsIgnoreCase("activateFabricConfiguration")
                 || requestAction.equalsIgnoreCase("recreateInstance")
                 || requestAction.equalsIgnoreCase("replaceInstance")
-                || requestAction.equalsIgnoreCase("upgradeInstance")) {
+                || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck")) {
             return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
                     requestDetails.getCloudConfiguration());
         }
@@ -1566,6 +1566,9 @@ public class BBInputSetup implements JavaDelegate {
                     break;
                 }
             }
+        } else if (bbName.equals("HealthCheckBB")
+                && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope())) {
+            this.setisHelmforHealthCheckBB(service, serviceInstance, gBB);
         }
         if (executeBB.getWorkflowResourceIds() != null) {
             parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
@@ -1586,9 +1589,10 @@ public class BBInputSetup implements JavaDelegate {
         Vnfs vnfs = null;
         VfModules vfModules = null;
         Networks networks = null;
+
         CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration();
-        CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources);
-        gBB.setCloudRegion(cloudRegion);
+        CloudRegion cloudRegion = setCloudConfiguration(gBB, cloudConfiguration);
+
         BBInputSetupParameter parameter =
                 new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setService(service)
                         .setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build();
@@ -1601,6 +1605,11 @@ public class BBInputSetup implements JavaDelegate {
                 vnfs = findVnfsByKey(key, resources);
             }
 
+            // Vnf level cloud configuration takes precedence over service level cloud configuration.
+            if (vnfs.getCloudConfiguration() != null) {
+                setCloudConfiguration(gBB, vnfs.getCloudConfiguration());
+            }
+
             String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
             // This stores the vnf id in request db to be retrieved later when
             // working on a vf module or volume group
@@ -1637,6 +1646,21 @@ public class BBInputSetup implements JavaDelegate {
                 vfModules = getVfModulesByKey(key, resources);
             }
 
+            String vfModulesName = vfModules.getInstanceName();
+            String vfModulesModelCustId = vfModules.getModelInfo().getModelCustomizationId();
+            // Get the Vnf associated with vfModule
+            Optional<org.onap.so.serviceinstancebeans.Vnfs> parentVnf = resources.getVnfs().stream()
+                    .filter(aVnf -> aVnf.getCloudConfiguration() != null)
+                    .filter(aVnf -> aVnf.getVfModules().stream()
+                            .anyMatch(aVfModules -> aVfModules.getInstanceName().equals(vfModulesName) && aVfModules
+                                    .getModelInfo().getModelCustomizationId().equals(vfModulesModelCustId)))
+                    .findAny();
+
+            // Get the cloud configuration from this Vnf
+            if (parentVnf.isPresent()) {
+                cloudRegion = setCloudConfiguration(gBB, parentVnf.get().getCloudConfiguration());
+            }
+
             lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
 
             parameter.setModelInfo(vfModules.getModelInfo());
@@ -1667,6 +1691,16 @@ public class BBInputSetup implements JavaDelegate {
             networks = findNetworksByKey(key, resources);
             String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
             if (networks != null) {
+                // If service level cloud configuration is not provided then get it from networks.
+                if (cloudConfiguration == null) {
+                    Optional<org.onap.so.serviceinstancebeans.Networks> netWithCloudConfig = resources.getNetworks()
+                            .stream().filter(aNetwork -> aNetwork.getCloudConfiguration() != null).findAny();
+                    if (netWithCloudConfig.isPresent()) {
+                        setCloudConfiguration(gBB, netWithCloudConfig.get().getCloudConfiguration());
+                    } else {
+                        logger.debug("Could not find any cloud configuration for this request.");
+                    }
+                }
                 parameter.setInstanceName(networks.getInstanceName());
                 parameter.setModelInfo(networks.getModelInfo());
                 parameter.setInstanceParams(networks.getInstanceParams());
@@ -1692,6 +1726,24 @@ public class BBInputSetup implements JavaDelegate {
         return gBB;
     }
 
+    /**
+     * setCloudConfiguration - set cloud info on a building block.
+     * 
+     * @param gBB
+     * @param cloudConfiguration
+     * @return CloudRegion
+     * @throws Exception
+     */
+    private CloudRegion setCloudConfiguration(GeneralBuildingBlock gBB, CloudConfiguration cloudConfiguration)
+            throws Exception {
+        org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
+        Tenant tenant = getTenant(cloudConfiguration, aaiCloudRegion);
+        gBB.setTenant(tenant);
+        CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
+        gBB.setCloudRegion(cloudRegion);
+        return cloudRegion;
+    }
+
     protected Networks findNetworksByKey(String key, Resources resources) {
         for (Networks networks : resources.getNetworks()) {
             if (networks.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) {
@@ -1742,39 +1794,6 @@ public class BBInputSetup implements JavaDelegate {
         throw new ResourceNotFoundException("Could not find vnf with key: " + key + " in userparams");
     }
 
-    protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) {
-        if (cloudConfiguration == null) {
-            for (Vnfs vnfs : resources.getVnfs()) {
-                if (cloudConfiguration == null) {
-                    cloudConfiguration = vnfs.getCloudConfiguration();
-                } else {
-                    break;
-                }
-                for (VfModules vfModules : vnfs.getVfModules()) {
-                    if (cloudConfiguration == null) {
-                        cloudConfiguration = vfModules.getCloudConfiguration();
-                    } else {
-                        break;
-                    }
-                }
-            }
-            for (Networks networks : resources.getNetworks()) {
-                if (cloudConfiguration == null) {
-                    cloudConfiguration = networks.getCloudConfiguration();
-                } else {
-                    break;
-                }
-            }
-        }
-        if (cloudConfiguration != null) {
-            org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
-            return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
-        } else {
-            logger.debug("Could not find any cloud configuration for this request.");
-            return null;
-        }
-    }
-
     protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap) {
         String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
         if (vnfId == null) {
@@ -2114,6 +2133,28 @@ public class BBInputSetup implements JavaDelegate {
         return collection;
     }
 
+    private void setisHelmforHealthCheckBB(Service service, ServiceInstance serviceInstance, GeneralBuildingBlock gBB) {
+        for (GenericVnf vnf : serviceInstance.getVnfs()) {
+            for (VfModule vfModule : vnf.getVfModules()) {
+                String vnfModelCustomizationUUID =
+                        this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
+                ModelInfo vnfModelInfo = new ModelInfo();
+                vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+                this.mapCatalogVnf(vnf, vnfModelInfo, service);
+                String vfModuleCustomizationUUID = this.bbInputSetupUtils
+                        .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
+                ModelInfo vfModuleModelInfo = new ModelInfo();
+                vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
+                this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
+                if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null
+                        && vfModule.getModelInfoVfModule().getModelName().contains("helm")) {
+                    gBB.getRequestContext().setIsHelm(true);
+                    break;
+                }
+            }
+        }
+    }
+
     protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) {
         for (AAIResourceUri aaiResourceUri : list) {
             l3Networks.add(this.mapL3Network(aaiResourceUri));
index e8c88e0..4148a60 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.onap.so.client.cds;
 
-import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyJsonParamsToObject;
 import com.google.gson.JsonObject;
 import java.util.List;
 import java.util.Map;
@@ -49,7 +49,7 @@ public class ConfigureInstanceParamsForService {
             Optional<Service> service =
                     extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
 
-            service.map(Service::getInstanceParams).ifPresent(p -> applyParamsToObject(p, jsonObject));
+            service.map(Service::getInstanceParams).ifPresent(p -> applyJsonParamsToObject(p, jsonObject));
         } catch (Exception e) {
             throw new PayloadGenerationException("Failed to resolve instance parameters", e);
         }
index 117fd74..7e9c885 100644 (file)
 
 package org.onap.so.client.cds;
 
+import com.google.gson.Gson;
 import com.google.gson.JsonObject;
 import java.util.List;
 import java.util.Map;
 
 public final class ConfigureInstanceParamsUtil {
 
+    private static final Gson gson = new Gson();
+
     public static void applyParamsToObject(List<Map<String, String>> instanceParamsList, JsonObject jsonObject) {
         instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
                 .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
     }
 
+    public static void applyJsonParamsToObject(List<Map<String, Object>> instanceParamsList, JsonObject jsonObject) {
+        instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+                .forEachOrdered(entry -> jsonObject.add(entry.getKey(), gson.toJsonTree(entry.getValue())));
+    }
+
 }
index 61a920e..7f066af 100644 (file)
@@ -2287,45 +2287,6 @@ public class BBInputSetupTest {
         assertThat(actual, sameBeanAs(expected));
     }
 
-    @Test
-    public void testgetGBBMacroCloudConfiguration() throws Exception {
-        org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
-                new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
-        CloudConfiguration cloudConfig = null;
-        org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion();
-        aaiCloudRegion.setCloudOwner("test-owner-name");
-        Resources resources = serviceMacro.getResources();
-        doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class));
-        CloudRegion expected = new CloudRegion();
-        expected.setLcpCloudRegionId("mdt1");
-        expected.setCloudOwner("test-owner-name");
-        expected.setTenantId("88a6ca3ee0394ade9403f075db23167e");
-
-        CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertThat(actual, sameBeanAs(expected));
-
-        serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVnfs.json"),
-                org.onap.so.serviceinstancebeans.Service.class);
-        resources = serviceMacro.getResources();
-
-        actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertThat(actual, sameBeanAs(expected));
-
-        serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNetworks.json"),
-                org.onap.so.serviceinstancebeans.Service.class);
-        resources = serviceMacro.getResources();
-
-        actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertThat(actual, sameBeanAs(expected));
-
-        serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNoCloudConfig.json"),
-                org.onap.so.serviceinstancebeans.Service.class);
-        resources = serviceMacro.getResources();
-
-        actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertNull(actual);
-    }
-
     @Test
     public void testgetGBBMacroWithEmptyUserParams() throws Exception {
         String resourceId = "123";
index 6a61ed1..806dc1c 100644 (file)
@@ -20,6 +20,7 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <sdnc.northbound.version>1.5.2</sdnc.northbound.version>
+    <logback-core.version>1.2.10</logback-core.version>
   </properties>
   <modules>
     <module>MSOCoreBPMN</module>
index 8272bd3..fad2e55 100755 (executable)
@@ -1,30 +1,29 @@
 <?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_1bvx7yi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.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" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0gwymqy" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.14.0">
   <bpmn:process id="HealthCheckBB" name="HealthCheckBB" isExecutable="true">
-    <bpmn:startEvent id="StartEvent_1" name="HealthCheckBB_start">
-      <bpmn:outgoing>Flow_0gd6hy6</bpmn:outgoing>
+    <bpmn:startEvent id="Event_0rgusxn" name="HealthCheckBB_start">
+      <bpmn:outgoing>Flow_0udh4cd</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:endEvent id="Event_1dklvvk" name="HealthCheckBB_end">
-      <bpmn:incoming>Flow_0xiyno7</bpmn:incoming>
+    <bpmn:endEvent id="Event_0o1nl3y" name="HealthCheckBB_end">
+      <bpmn:incoming>Flow_0n17e0q</bpmn:incoming>
+      <bpmn:incoming>Flow_131rwms</bpmn:incoming>
     </bpmn:endEvent>
-    <bpmn:sequenceFlow id="Flow_0gd6hy6" sourceRef="StartEvent_1" targetRef="Activity_11hkwkn" />
-    <bpmn:subProcess id="Activity_1pto2qh" name="Error Handling&#10;&#10;" triggeredByEvent="true">
-      <bpmn:startEvent id="Event_0929aqj">
-        <bpmn:outgoing>Flow_05rbrsm</bpmn:outgoing>
-        <bpmn:errorEventDefinition id="ErrorEventDefinition_0k0ly65" />
+    <bpmn:subProcess id="Activity_0tw4ak3" name="Error Handling&#10;&#10;" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_1v6jbfd">
+        <bpmn:outgoing>Flow_03ogqmx</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1xw7dq4" />
       </bpmn:startEvent>
-      <bpmn:endEvent id="Event_1s698ql">
-        <bpmn:incoming>Flow_05rbrsm</bpmn:incoming>
-        <bpmn:terminateEventDefinition id="TerminateEventDefinition_0mn6xgi" />
+      <bpmn:endEvent id="Event_0wwzune">
+        <bpmn:incoming>Flow_03ogqmx</bpmn:incoming>
+        <bpmn:terminateEventDefinition id="TerminateEventDefinition_0c07ott" />
       </bpmn:endEvent>
-      <bpmn:sequenceFlow id="Flow_05rbrsm" sourceRef="Event_0929aqj" targetRef="Event_1s698ql" />
+      <bpmn:sequenceFlow id="Flow_03ogqmx" sourceRef="Event_1v6jbfd" targetRef="Event_0wwzune" />
     </bpmn:subProcess>
-    <bpmn:serviceTask id="Activity_11hkwkn" name="Prepare Cnf Adapter request" camunda:expression="${CnfHealthCheckTasks.prepareCnfAdaperRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
-      <bpmn:incoming>Flow_0gd6hy6</bpmn:incoming>
-      <bpmn:outgoing>Flow_1aqdd5k</bpmn:outgoing>
+    <bpmn:serviceTask id="Activity_0pnb21p" name="Prepare Cnf Adapter request" camunda:expression="${CnfHealthCheckTasks.prepareCnfAdaperRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>Flow_0jxw1lb</bpmn:incoming>
+      <bpmn:outgoing>Flow_0uoe9ga</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="Flow_1aqdd5k" sourceRef="Activity_11hkwkn" targetRef="Activity_08mgs1k" />
-    <bpmn:callActivity id="Activity_08mgs1k" name="Call CNFAdapterAsyncCall" calledElement="CNFAdapterAsyncCall">
+    <bpmn:callActivity id="Activity_07txikn" name="Call CNFAdapterAsyncCall" calledElement="CNFAdapterAsyncCall">
       <bpmn:extensionElements>
         <camunda:in source="apiPath" target="apiPath" />
         <camunda:in source="cnfRequestPayload" target="cnfRequestPayload" />
         <camunda:in source="messageType" target="messageType" />
         <camunda:in source="true" target="isDebugLogEnabled" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_1aqdd5k</bpmn:incoming>
-      <bpmn:outgoing>Flow_1jeui7e</bpmn:outgoing>
+      <bpmn:incoming>Flow_0uoe9ga</bpmn:incoming>
+      <bpmn:outgoing>Flow_0t6f6l8</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:serviceTask id="Activity_0w4hy3d" name="Process Response" camunda:expression="${CnfHealthCheckTasks.processAsyncResponse(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
-      <bpmn:incoming>Flow_1jeui7e</bpmn:incoming>
-      <bpmn:outgoing>Flow_0xiyno7</bpmn:outgoing>
+    <bpmn:serviceTask id="Activity_1qd7k3z" name="Process Response" camunda:expression="${CnfHealthCheckTasks.processAsyncResponse(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>Flow_0t6f6l8</bpmn:incoming>
+      <bpmn:outgoing>Flow_0n17e0q</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="Flow_0xiyno7" sourceRef="Activity_0w4hy3d" targetRef="Event_1dklvvk" />
-    <bpmn:sequenceFlow id="Flow_1jeui7e" sourceRef="Activity_08mgs1k" targetRef="Activity_0w4hy3d" />
+    <bpmn:exclusiveGateway id="Gateway_07e5xls" name="Check If Is Helm" default="Flow_131rwms">
+      <bpmn:incoming>Flow_0udh4cd</bpmn:incoming>
+      <bpmn:outgoing>Flow_131rwms</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0jxw1lb</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0udh4cd" sourceRef="Event_0rgusxn" targetRef="Gateway_07e5xls" />
+    <bpmn:sequenceFlow id="Flow_0n17e0q" sourceRef="Activity_1qd7k3z" targetRef="Event_0o1nl3y" />
+    <bpmn:sequenceFlow id="Flow_131rwms" name="No Helm" sourceRef="Gateway_07e5xls" targetRef="Event_0o1nl3y" />
+    <bpmn:sequenceFlow id="Flow_0jxw1lb" name="Yes Helm" sourceRef="Gateway_07e5xls" targetRef="Activity_0pnb21p">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isHelm")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0uoe9ga" sourceRef="Activity_0pnb21p" targetRef="Activity_07txikn" />
+    <bpmn:sequenceFlow id="Flow_0t6f6l8" sourceRef="Activity_07txikn" targetRef="Activity_1qd7k3z" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HealthCheckBB">
-      <bpmndi:BPMNEdge id="Flow_1jeui7e_di" bpmnElement="Flow_1jeui7e">
-        <di:waypoint x="600" y="120" />
-        <di:waypoint x="680" y="120" />
+      <bpmndi:BPMNEdge id="Flow_0udh4cd_di" bpmnElement="Flow_0udh4cd">
+        <di:waypoint x="218" y="150" />
+        <di:waypoint x="245" y="150" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0xiyno7_di" bpmnElement="Flow_0xiyno7">
-        <di:waypoint x="780" y="120" />
-        <di:waypoint x="842" y="120" />
+      <bpmndi:BPMNEdge id="Flow_0n17e0q_di" bpmnElement="Flow_0n17e0q">
+        <di:waypoint x="780" y="150" />
+        <di:waypoint x="870" y="150" />
+        <di:waypoint x="870" y="202" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1aqdd5k_di" bpmnElement="Flow_1aqdd5k">
-        <di:waypoint x="400" y="120" />
-        <di:waypoint x="500" y="120" />
+      <bpmndi:BPMNEdge id="Flow_131rwms_di" bpmnElement="Flow_131rwms">
+        <di:waypoint x="270" y="175" />
+        <di:waypoint x="270" y="220" />
+        <di:waypoint x="852" y="220" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="264" y="195" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jxw1lb_di" bpmnElement="Flow_0jxw1lb">
+        <di:waypoint x="295" y="150" />
+        <di:waypoint x="350" y="150" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="299" y="132" width="47" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0gd6hy6_di" bpmnElement="Flow_0gd6hy6">
-        <di:waypoint x="218" y="120" />
-        <di:waypoint x="300" y="120" />
+      <bpmndi:BPMNEdge id="Flow_0uoe9ga_di" bpmnElement="Flow_0uoe9ga">
+        <di:waypoint x="450" y="150" />
+        <di:waypoint x="500" y="150" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="Event_1dklvvk_di" bpmnElement="Event_1dklvvk">
-        <dc:Bounds x="842" y="102" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_0t6f6l8_di" bpmnElement="Flow_0t6f6l8">
+        <di:waypoint x="600" y="150" />
+        <di:waypoint x="680" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0rgusxn_di" bpmnElement="Event_0rgusxn">
+        <dc:Bounds x="182" y="132" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="820" y="145" width="85" height="27" />
+          <dc:Bounds x="156" y="175" width="90" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="182" y="102" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_0o1nl3y_di" bpmnElement="Event_0o1nl3y">
+        <dc:Bounds x="852" y="202" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="156" y="145" width="90" height="27" />
+          <dc:Bounds x="831" y="245" width="84" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_11hkwkn_di" bpmnElement="Activity_11hkwkn">
-        <dc:Bounds x="300" y="80" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_0pnb21p_di" bpmnElement="Activity_0pnb21p">
+        <dc:Bounds x="350" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07txikn_di" bpmnElement="Activity_07txikn">
+        <dc:Bounds x="500" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0f7poou_di" bpmnElement="Activity_08mgs1k">
-        <dc:Bounds x="500" y="80" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1qd7k3z_di" bpmnElement="Activity_1qd7k3z">
+        <dc:Bounds x="680" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0w4hy3d_di" bpmnElement="Activity_0w4hy3d">
-        <dc:Bounds x="680" y="80" width="100" height="80" />
+      <bpmndi:BPMNShape id="Gateway_07e5xls_di" bpmnElement="Gateway_07e5xls" isMarkerVisible="true">
+        <dc:Bounds x="245" y="125" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="230" y="95" width="81" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1pto2qh_di" bpmnElement="Activity_1pto2qh" isExpanded="true">
-        <dc:Bounds x="280" y="250" width="460" height="135" />
+      <bpmndi:BPMNShape id="Activity_0tw4ak3_di" bpmnElement="Activity_0tw4ak3" isExpanded="true">
+        <dc:Bounds x="280" y="280" width="460" height="135" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="Flow_05rbrsm_di" bpmnElement="Flow_05rbrsm">
-        <di:waypoint x="398" y="324" />
-        <di:waypoint x="632" y="324" />
+      <bpmndi:BPMNEdge id="Flow_03ogqmx_di" bpmnElement="Flow_03ogqmx">
+        <di:waypoint x="398" y="354" />
+        <di:waypoint x="632" y="354" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="Event_0929aqj_di" bpmnElement="Event_0929aqj">
-        <dc:Bounds x="362" y="306" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_1v6jbfd_di" bpmnElement="Event_1v6jbfd">
+        <dc:Bounds x="362" y="336" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1s698ql_di" bpmnElement="Event_1s698ql">
-        <dc:Bounds x="632" y="306" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_0wwzune_di" bpmnElement="Event_0wwzune">
+        <dc:Bounds x="632" y="336" width="36" height="36" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn
new file mode 100644 (file)
index 0000000..59bb404
--- /dev/null
@@ -0,0 +1,215 @@
+<?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:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jxlg2g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
+  <bpmn:process id="UpgradeVfModuleBB" name="UpgradeVfModuleBB" isExecutable="true">
+    <bpmn:startEvent id="UpgradeVfModuleBB_Start">
+      <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:serviceTask id="QueryVfModule" name="&#10;SDNC&#10;Get&#10;(vf module)&#10;" camunda:expression="${SDNCQueryTasks.queryVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_1s4rpyp</bpmn:incoming>
+      <bpmn:outgoing>Flow_0gbxjjk</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:endEvent id="UpgradeVfModuleBB_End">
+      <bpmn:incoming>SequenceFlow_1vbwdaw</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="QueryVnf" name="&#10;SDNC&#10;Get&#10;(vnf)&#10;" camunda:expression="${SDNCQueryTasks.queryVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="UpdateVfModuleStatus" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_0rds4rj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1vbwdaw</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_15do1tu</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0rds4rj</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="CreateNetworkPolicies" name="AAI Create (network policies)" camunda:expression="${AAICreateTasks.createNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>Flow_1c9ox62</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0xqhep5</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF) " camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_0xqhep5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1yo6mvv</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_1yo6mvv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1i03uy2</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_1i03uy2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_15do1tu</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="CnfAdapter" name="Cnf Adapter" camunda:expression="${CnfAdapterUpgradeTasks.upgradeInstance(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>Flow_0gbxjjk</bpmn:incoming>
+      <bpmn:outgoing>Flow_1il4743</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:subProcess id="Activity_10eqhmz" name="Inventory Error Handling" triggeredByEvent="true">
+      <bpmn:endEvent id="Event_108oetk">
+        <bpmn:incoming>Flow_03q6ty9</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:serviceTask id="Activity_1p8hxyt" name="Process Error" camunda:expression="${ExceptionBuilder.processInventoryException(execution)}">
+        <bpmn:incoming>Flow_1sqy91r</bpmn:incoming>
+        <bpmn:outgoing>Flow_03q6ty9</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_03q6ty9" sourceRef="Activity_1p8hxyt" targetRef="Event_108oetk" />
+      <bpmn:sequenceFlow id="Flow_1sqy91r" sourceRef="Event_1pengt4" targetRef="Activity_1p8hxyt" />
+      <bpmn:startEvent id="Event_1pengt4">
+        <bpmn:outgoing>Flow_1sqy91r</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0sq3chy" errorRef="Error_0t7oivz" />
+      </bpmn:startEvent>
+    </bpmn:subProcess>
+    <bpmn:callActivity id="UpdateCnfAai" name="Update Cnf Data in AAI" calledElement="UpdateCnfAai">
+      <bpmn:extensionElements>
+        <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="heatStackId" target="heatStackId" />
+        <camunda:out source="heatStackId" target="heatStackId" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1il4743</bpmn:incoming>
+      <bpmn:outgoing>Flow_0piytnn</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="UpgradeVfModuleBB_Start" targetRef="QueryVnf" />
+    <bpmn:sequenceFlow id="SequenceFlow_1s4rpyp" sourceRef="QueryVnf" targetRef="QueryVfModule" />
+    <bpmn:sequenceFlow id="SequenceFlow_1vbwdaw" sourceRef="UpdateVfModuleStatus" targetRef="UpgradeVfModuleBB_End" />
+    <bpmn:sequenceFlow id="SequenceFlow_0rds4rj" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" />
+    <bpmn:sequenceFlow id="SequenceFlow_15do1tu" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" />
+    <bpmn:sequenceFlow id="SequenceFlow_0xqhep5" sourceRef="CreateNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
+    <bpmn:sequenceFlow id="SequenceFlow_1yo6mvv" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" />
+    <bpmn:sequenceFlow id="SequenceFlow_1i03uy2" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" />
+    <bpmn:sequenceFlow id="Flow_1il4743" sourceRef="CnfAdapter" targetRef="UpdateCnfAai" />
+    <bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI">
+      <bpmn:incoming>Flow_0piytnn</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1c2sbij" name="AAI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0gbxjjk" sourceRef="QueryVfModule" targetRef="CnfAdapter" />
+    <bpmn:sequenceFlow id="Flow_0piytnn" sourceRef="UpdateCnfAai" targetRef="aaiThrow" />
+    <bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI">
+      <bpmn:outgoing>Flow_1c9ox62</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0dycelb" name="AAI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_1c9ox62" sourceRef="aaiCatch" targetRef="CreateNetworkPolicies" />
+  </bpmn:process>
+  <bpmn:error id="Error_0t7oivz" name="AAIInventoryFailure" errorCode="AAIInventoryFailure" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UpgradeVfModuleBB">
+      <bpmndi:BPMNEdge id="Flow_1c9ox62_di" bpmnElement="Flow_1c9ox62">
+        <di:waypoint x="208" y="372" />
+        <di:waypoint x="300" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0piytnn_di" bpmnElement="Flow_0piytnn">
+        <di:waypoint x="970" y="120" />
+        <di:waypoint x="1062" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0gbxjjk_di" bpmnElement="Flow_0gbxjjk">
+        <di:waypoint x="570" y="120" />
+        <di:waypoint x="680" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1il4743_di" bpmnElement="Flow_1il4743">
+        <di:waypoint x="780" y="120" />
+        <di:waypoint x="870" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1i03uy2_di" bpmnElement="SequenceFlow_1i03uy2">
+        <di:waypoint x="722" y="372" />
+        <di:waypoint x="770" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1yo6mvv_di" bpmnElement="SequenceFlow_1yo6mvv">
+        <di:waypoint x="553" y="372" />
+        <di:waypoint x="622" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xqhep5_di" bpmnElement="SequenceFlow_0xqhep5">
+        <di:waypoint x="400" y="372" />
+        <di:waypoint x="453" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_15do1tu_di" bpmnElement="SequenceFlow_15do1tu">
+        <di:waypoint x="870" y="372" />
+        <di:waypoint x="935" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0rds4rj_di" bpmnElement="SequenceFlow_0rds4rj">
+        <di:waypoint x="1035" y="372" />
+        <di:waypoint x="1100" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1vbwdaw_di" bpmnElement="SequenceFlow_1vbwdaw">
+        <di:waypoint x="1200" y="372" />
+        <di:waypoint x="1241" y="372" />
+        <di:waypoint x="1241" y="372" />
+        <di:waypoint x="1276" y="372" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1s4rpyp_di" bpmnElement="SequenceFlow_1s4rpyp">
+        <di:waypoint x="389" y="120" />
+        <di:waypoint x="470" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl">
+        <di:waypoint x="188" y="120" />
+        <di:waypoint x="289" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CreateVfModuleBB_Start_di" bpmnElement="UpgradeVfModuleBB_Start">
+        <dc:Bounds x="152" y="102" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="QueryVfModule_di" bpmnElement="QueryVfModule">
+        <dc:Bounds x="470" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CreateVfModuleBB_End_di" bpmnElement="UpgradeVfModuleBB_End">
+        <dc:Bounds x="1276" y="354" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="QueryVnf_di" bpmnElement="QueryVnf">
+        <dc:Bounds x="289" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="UpdateVfModuleStatus_di" bpmnElement="UpdateVfModuleStatus">
+        <dc:Bounds x="1100" y="332" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="UpdateVfModuleHeatStackId_di" bpmnElement="UpdateVfModuleHeatStackId">
+        <dc:Bounds x="935" y="332" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CreateNetworkPolicies_di" bpmnElement="CreateNetworkPolicies">
+        <dc:Bounds x="300" y="332" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="UpdateVnfIpv4OamAddress_di" bpmnElement="UpdateVnfIpv4OamAddress">
+        <dc:Bounds x="453" y="332" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="UpdateVnfManagementV6Address_di" bpmnElement="UpdateVnfManagementV6Address">
+        <dc:Bounds x="622" y="332" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="UpdateVfModuleContrailServiceInstanceFqdn_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn">
+        <dc:Bounds x="770" y="332" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CnfAdapter_di" bpmnElement="CnfAdapter">
+        <dc:Bounds x="680" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10eqhmz_di" bpmnElement="Activity_10eqhmz" isExpanded="true">
+        <dc:Bounds x="216" y="494" width="340" height="180" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1sqy91r_di" bpmnElement="Flow_1sqy91r">
+        <di:waypoint x="292" y="584" />
+        <di:waypoint x="336" y="584" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_03q6ty9_di" bpmnElement="Flow_03q6ty9">
+        <di:waypoint x="436" y="584" />
+        <di:waypoint x="488" y="584" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_108oetk_di" bpmnElement="Event_108oetk">
+        <dc:Bounds x="488" y="566" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1p8hxyt_di" bpmnElement="Activity_1p8hxyt">
+        <dc:Bounds x="336" y="544" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="UpdateCnfAai_di" bpmnElement="UpdateCnfAai">
+        <dc:Bounds x="870" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="aaiThrow_di" bpmnElement="aaiThrow">
+        <dc:Bounds x="1062" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1051" y="148" width="57" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="aaiCatch_di" bpmnElement="aaiCatch">
+        <dc:Bounds x="172" y="354" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="162" y="394" width="57" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_13ssqoq_di" bpmnElement="Event_1pengt4">
+        <dc:Bounds x="256" y="566" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 846af27..b287594 100644 (file)
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-core</artifactId>
+      <version>${logback-core.version}</version>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
index f17bfc2..eb7e89c 100644 (file)
@@ -254,7 +254,7 @@ else{
        
        //TNFH slice profile instance creation
        TNFH_sliceProfileInstance.setServiceInstanceId(TNFH_sliceProfileInstanceId)
-       sliceInstanceName = "sliceprofile _ "+TNFH_sliceProfileId
+       sliceInstanceName = "sliceprofile_"+TNFH_sliceProfileId
        TNFH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
        serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST")
        TNFH_sliceProfileInstance.setServiceType(serviceType)
@@ -271,7 +271,7 @@ else{
        
        //TNMH slice profile instance creation
        TNMH_sliceProfileInstance.setServiceInstanceId(TNMH_sliceProfileInstanceId)
-       sliceInstanceName = "sliceprofile _ "+TNMH_sliceProfileId
+       sliceInstanceName = "sliceprofile_"+TNMH_sliceProfileId
        TNMH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
        serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST")
        TNMH_sliceProfileInstance.setServiceType(serviceType)
@@ -327,7 +327,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
                        result.setExpDataRateDL(profile.get("expDataRateDL"))
                        result.setExpDataRateUL(profile.get("expDataRateUL"))
                        result.setSurvivalTime(profile.get("survivalTime"))
-                       result.setMaxNumberOfPDUSession(profile.get("maxNumberOfPDUSession")) 
+                       result.setMaxNumberOfPDUSession(profile.get("maxNumberofPDUSession"))
                        result.setAreaTrafficCapDL(profile.get("areaTrafficCapDL"))
                        result.setAreaTrafficCapUL(profile.get("areaTrafficCapUL"))
                        result.setOverallUserDensity(profile.get("overallUserDensity")) 
index d0fe1e9..e541934 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.apache.commons.lang3.StringUtils.isBlank
 import com.fasterxml.jackson.databind.ObjectMapper
 import com.google.gson.Gson
 import com.google.gson.reflect.TypeToken
@@ -27,6 +28,15 @@ import org.apache.commons.lang3.StringUtils
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.logging.filter.base.ErrorCode
+import javax.ws.rs.NotFoundException
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+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.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.so.beans.nsmf.*
 import org.onap.so.beans.nsmf.oof.SubnetType
 import org.onap.so.bpmn.common.scripts.*
@@ -160,8 +170,10 @@ class DoActivateSliceService extends AbstractServiceTaskProcessor {
             actDeActNssi.setNssiId(nssInstance.nssiId)
             actDeActNssi.setSnssaiList(Arrays.asList(customerInfo.snssai))
 
+            String sliceProfileId = getRelatedSliceProfileId(execution, customerInfo.globalSubscriberId, customerInfo.subscriptionServiceType, nssInstance.nssiId, customerInfo.snssai, "slice-profile")
+            actDeActNssi.setSliceProfileId(sliceProfileId)
 
-                       nbiRequest.setEsrInfo(esrInfo)
+            nbiRequest.setEsrInfo(esrInfo)
             nbiRequest.setServiceInfo(serviceInfo)
             nbiRequest.setActDeActNssi(actDeActNssi)
             execution.setVariable("nbiRequest", nbiRequest)
@@ -176,6 +188,48 @@ class DoActivateSliceService extends AbstractServiceTaskProcessor {
                logger.debug("***** Exit processDecomposition *****")
        }
 
+        private String getRelatedSliceProfileId(DelegateExecution execution, String globalSubscriberId, String subscriptionServiceType, String instanceId, String snssai, String role) {
+                logger.debug("${Prefix} - Get Related Slice Profile")
+               if( isBlank(role) || isBlank(instanceId)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Role and instanceId are mandatory")
+               }
+
+                String nssiId;
+               AAIResourcesClient client = getAAIClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId))
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                               uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+                               if (!client.exists(uri)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole()) && snssai.equalsIgnoreCase(instance.getEnvironmentContext())) {
+                        nssiId = instance.getServiceInstanceId()
+                                       }
+                               }
+                       }
+               }
+               }
+               return nssiId
+               logger.debug("${Prefix} - Exit Get Related Slice Profile instances")
+    }
+
     /**
      * send Create Request NSSMF
      * @param execution
index ed1c2b2..54fa2ab 100644 (file)
@@ -369,7 +369,6 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                modifySliceParams.addProperty("snssaiList", snssaiList)
                modifySliceParams.addProperty("sliceProfileId", sliceProfileId)
                modifySliceParams.addProperty("nsiInfo", nsiInfo)
-               modifySliceParams.addProperty("scriptName", scriptName)
                
                execution.setVariable("modifySliceParams", modifySliceParams.toString())
                //create operation status in request db
@@ -576,7 +575,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                ANServiceInstance.setServiceRole(serviceRole)
                 List<String> snssaiList = execution.getVariable("snssaiList")
                String snssai = snssaiList.get(0)
-               //ANServiceInstance.setEnvironmentContext(snssai)
+                //ANServiceInstance.setEnvironmentContext(snssai)
+               String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+               String modelUuid = execution.getVariable("modelUuid") as String
+               ANServiceInstance.setModelInvariantId(modelInvariantUuid)
+               ANServiceInstance.setModelVersionId(modelUuid)
                 ANServiceInstance.setEnvironmentContext(execution.getVariable("networkType")) //Network Type
                ANServiceInstance.setWorkloadContext("AN") //domain Type
                
@@ -639,22 +642,23 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                ANServiceInstance.setServiceType(execution.getVariable("sst") as String)
                ANServiceInstance.setOrchestrationStatus(serviceStatus)
                String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList") as String
-               ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+                ANServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))           
                ANServiceInstance.setServiceRole(serviceRole)
                List<String> snssaiList = jsonUtil.StringArrayToList(execution.getVariable("snssaiList") as String)
                String snssai = snssaiList.get(0)
-               ANServiceInstance.setEnvironmentContext(snssai)
                String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
                String modelUuid = execution.getVariable("modelUuid") as String
                ANServiceInstance.setModelInvariantId(modelInvariantUuid)
                ANServiceInstance.setModelVersionId(modelUuid)
+                ANServiceInstance.setEnvironmentContext(execution.getVariable("networkType")) //Network Type
                ANServiceInstance.setWorkloadContext("AN")
                String serviceFunctionAn = jsonUtil.getJsonValue(execution.getVariable("sliceProfile") as String, "resourceSharingLevel")
                ANServiceInstance.setServiceFunction(serviceFunctionAn)
                logger.debug("completed AN service instance build " + ANServiceInstance.toString())
                //create RAN NF NSSI
                ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId") as String)
-               sliceInstanceName = "nssi_"+execution.getVariable("ANNF_modelName")
+                String ANNF_nssiInstanceId = UUID.randomUUID().toString()
+               sliceInstanceName = "nssi_an_nf_" + ANNF_nssiInstanceId
                ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
                ANNFServiceInstance.setServiceType(execution.getVariable("sst") as String)
                ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
@@ -663,7 +667,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                ANNFServiceInstance.setServiceRole(serviceRole)
                snssaiList = jsonUtil.StringArrayToList(execution.getVariable("snssaiList") as String)
                snssai = snssaiList.get(0)
-               ANNFServiceInstance.setEnvironmentContext(snssai)
+               ANNFServiceInstance.setEnvironmentContext(execution.getVariable("networkType") as String)
                 ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid"))
                 ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid"))
                ANNFServiceInstance.setWorkloadContext("AN_NF")
@@ -1032,7 +1036,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                RU_ep.setType(type)
                RU_ep.setIpAddress("192.168.100.4")
                RU_ep.setLogicalInterfaceId("1234")
-               RU_ep.setNextHop("Host1")
+               RU_ep.setNextHop("networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.1-ltpId-512")
                RU_ep.setPrefixLength(prefixLength)
                RU_ep.setAddressFamily(addressFamily)
                //DU Ingress
@@ -1046,7 +1050,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                DU_ep.setType(type)
                DU_ep.setIpAddress("192.168.100.5")
                DU_ep.setLogicalInterfaceId("1234")
-               DU_ep.setNextHop("Host2")
+               DU_ep.setNextHop("networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512")
                DU_ep.setPrefixLength(prefixLength)
                DU_ep.setAddressFamily(addressFamily)
                //MH RAN end point update
@@ -1062,7 +1066,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                 DUEG_ep.setLogicalInterfaceId("1234")
                 DUEG_ep.setPrefixLength(prefixLength)
                 DUEG_ep.setAddressFamily(addressFamily)
-               DUEG_ep.setNextHop("Host3")
+               DUEG_ep.setNextHop("networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.1-ltpId-512")
                //CUIN
                String CUIN_routeId = UUID.randomUUID().toString()
                execution.setVariable("tranportEp_ID_CUIN", CUIN_routeId)
@@ -1073,7 +1077,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                CUIN_ep.setType(type)
                CUIN_ep.setIpAddress("192.168.100.6")
                CUIN_ep.setLogicalInterfaceId("1234")
-               CUIN_ep.setNextHop("Host4")
+               CUIN_ep.setNextHop("networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512")
                CUIN_ep.setPrefixLength(prefixLength)
                CUIN_ep.setAddressFamily(addressFamily)
                try {
index bc155c5..a22819f 100644 (file)
@@ -444,6 +444,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
                 .sST(sliceTaskInfo.getSliceProfile().getSST() ?: sliceParams.getServiceProfile().get("sST") as String)
                 .nssiName(sliceTaskInfo.getSuggestNssiId() ? sliceTaskInfo.getNSSTInfo().getName() : allocateAnNssi.getNssiName())
                 .nssiId(sliceTaskInfo.getSuggestNssiId())
+                .resourceSharingLevel(sliceParams.serviceProfile.get("resourceSharingLevel") as String)
                 .build()
 
         nbiRequest.setServiceInfo(serviceInfo)
@@ -590,6 +591,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared
         serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST")
         serviceInfo.nssiName = allocateCnNssi.nssiName
+        serviceInfo.resourceSharingLevel = sliceParams.serviceProfile.get("resourceSharingLevel")
 
         nbiRequest.setServiceInfo(serviceInfo)
         nbiRequest.setEsrInfo(esrInfo)
@@ -727,6 +729,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         serviceInfo.nssiId = sliceTaskInfo.suggestNssiId
         serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST")
         serviceInfo.nssiName = "nssi_tn" + execution.getVariable("sliceServiceInstanceName")
+        serviceInfo.resourceSharingLevel = sliceParams.serviceProfile.get("resourceSharingLevel")
 
         nbiRequest.setServiceInfo(serviceInfo)
         nbiRequest.setEsrInfo(esrInfo)
index a784cbe..6981d94 100644 (file)
@@ -110,6 +110,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
 
             execution.setVariable("nssiAllocateStatus", jobStatusResponse)
             if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+                nssiAllocateResult.setNssiId(jobStatusResponse.getResponseDescriptor().getNssiId())
                 execution.setVariable("jobFinished", true)
             }
         }
index 2e0f3cf..4681713 100644 (file)
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory
 import org.springframework.web.util.UriUtils
 
 import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isNotBlank
 
 class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
 
@@ -333,6 +334,7 @@ class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
 
                 String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
                 String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+                String epBProtect = jsonUtil.getJsonValue(linkStr, "transportEndpointBProtection")
                 String modelInvariantId = execution.getVariable("modelInvariantUuid")
                 String modelVersionId = execution.getVariable("modelUuid")
 
@@ -340,6 +342,9 @@ class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
                 resource.setLinkId(linkId)
                 resource.setLinkName(epA)
                 resource.setLinkName2(epB)
+                if (isNotBlank(epBProtect)) {
+                    resource.setSegmentId(epBProtect)
+                }
                 resource.setLinkType("TsciConnectionLink")
                 resource.setInMaint(false)
 
index 5c98778..bfd5ac8 100644 (file)
@@ -109,6 +109,14 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
                     "transportNetworks", "transportNetworks", true)
             logger.debug("transportNetworks: " + execution.getVariable("transportNetworks"))
 
+            serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
+                    "modifyAction", "modifyAction");
+            if (isNotBlank(execution.getVariable("modifyAction"))) {
+                logger.debug("modifyAction: " + execution.getVariable("modifyAction"))
+            } else {
+                logger.debug("modifyAction is not set")
+            }
+
             if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
                     "enableSdnc", "enableSdnc"))) {
                 serviceIntentUtils.setEnableSdncConfig(execution)
@@ -266,12 +274,16 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
 
     void updateTsciNetworks(DelegateExecution execution) {
         try {
+            if (modifyBandwidthGlobal(execution)) {
+                String netStr = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks")).get(0)
+                int maxBw = getMaxBwFromNetworkJsonStr(execution, netStr)
+                updateNetworkPolicyGlobal(execution, maxBw)
+                return
+            }
             List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks"))
             for (String networkStr : networkStrList) {
-                updateLogicalLinksInNetwork(execution, networkStr)
-                updateNetworkPolicy(execution, networkStr)
+                updateTsciNetwork(execution, networkStr)
             }
-
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
@@ -280,6 +292,20 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
         }
     }
 
+    boolean modifyBandwidthGlobal(DelegateExecution execution) {
+        String modifyAction = execution.getVariable("modifyAction")
+        if (isNotBlank(modifyAction) && modifyAction.equals("bandwidth")) {
+            return true
+        }
+
+        return false
+    }
+
+    void updateTsciNetwork(DelegateExecution execution, String networkStr) {
+        updateLogicalLinksInNetwork(execution, networkStr)
+        updateNetworkPolicy(execution, networkStr)
+    }
+
     int getMaxBwFromNetworkJsonStr(DelegateExecution execution, String networkJsonStr) {
         int maxBw = 0
         try {
@@ -327,6 +353,28 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
         }
     }
 
+    void updateNetworkPolicyGlobal(DelegateExecution execution, int maxBw) {
+        try {
+            List<String> arIdList = execution.getVariable("arIdList")
+            for (String arId : arIdList) {
+                Map<String, String> policyMap = execution.getVariable("arPolicyMap")
+                String policyId = policyMap.get(arId)
+                if (isBlank(policyId)) {
+                    String msg = String.format("ERROR: updateNetworkPolicy: policyId not found. arId=%s", arId)
+                    logger.error(msg)
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+                }
+                updatePolicyMaxBandwidthInAAI(execution, policyId, maxBw)
+            }
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage())
+            logger.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+        }
+    }
+
     void updateNetworkPolicy(DelegateExecution execution, String networkJsonStr) {
         try {
             int maxBw = getMaxBwFromNetworkJsonStr(execution, networkJsonStr)
index b07f5c9..a28dbbf 100644 (file)
@@ -742,7 +742,11 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
         Map<String, Object> instanceParamsMap = new HashMap<>()
 
         // Supported S-NSSAI
-        List<String> snssais = (List<String>) currentNSSI['S-NSSAIs']
+        def snssaisList = currentNSSI['S-NSSAIs']
+        List<String> snssais = new ArrayList<>()
+        if(snssaisList != null) {
+            snssais = new ArrayList<String>((List<String>)snssaisList)
+        }
 
         LOGGER.debug("prepareInstanceParams: snssais size = " + snssais.size())
 
index 2588d07..7571f07 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.so.bpmn.infrastructure.scripts
 
 import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.core.type.TypeReference
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.ServiceInstance
 import org.onap.so.beans.nsmf.EsrInfo
@@ -271,24 +272,22 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
      * @return
      */
     private SubnetType convertServiceCategory(String serviceCategory){
-        if("CN NSST".equals(serviceCategory)){
+        if(serviceCategory ==~ /CN.*/){
             return SubnetType.CN
         }
-        if ("AN NF NSST".equals(serviceCategory)){
-            return SubnetType.AN_NF
-        }
-        if ("AN NSST".equals(serviceCategory)){
+        if (serviceCategory ==~ /AN.*/){
             return SubnetType.AN
         }
-        if ("TN BH NSST".equals(serviceCategory)){
+        if (serviceCategory ==~ /TN.*BH.*/){
             return SubnetType.TN_BH
         }
-        if("TN MH NSST".equals(serviceCategory)){
+        if(serviceCategory ==~ /TN.*MH.*/){
             return SubnetType.TN_MH
         }
-        if("TN FH NSST".equals(serviceCategory)){
+        if(serviceCategory ==~ /TN.*FH.*/){
             return SubnetType.TN_FH
         }
+
         return null
     }
 
@@ -475,7 +474,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
      */
     void getNSSISelectionCap4AN(DelegateExecution execution) {
 
-        def vendor = execution.getVariable("vendor") as String
+       SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        def vendor = sliceParams.anSliceTaskInfo.vendor
 
         String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS)
 
@@ -497,7 +499,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
      */
     void getNSSISelectionCap4TN(DelegateExecution execution) {
 
-        def vendor = execution.getVariable("vendor") as String
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        def vendor = sliceParams.tnBHSliceTaskInfo.vendor
 
         String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT)
 
@@ -518,7 +523,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
      */
     void getNSSISelectionCap4CN(DelegateExecution execution) {
 
-        def vendor = execution.getVariable("vendor") as String
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        def vendor = sliceParams.cnSliceTaskInfo.vendor
 
         String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE)
 
@@ -626,8 +634,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
         Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map
 
         TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo
-        Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map
-        //profileInfo.remove("profileId")
+        SliceProfileAdapter sliceProfileInfo = nssiNeedHandlerInfo.get("sliceProfile") as SliceProfileAdapter
+
+        Map profileInfo = objectMapper.convertValue(sliceProfileInfo, new TypeReference<Map<String, Object>>() {});
+        while (profileInfo.values().remove(null));
 
         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
         logger.debug( "get NSI option OOF Url: " + urlString)
@@ -641,8 +651,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
         String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
         execution.setVariable("nssiSelection_timeout", timeout)
 
-        String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType,
-                profileInfo, 600)
+        String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, nsstInfo.UUID,
+                nsstInfo.invariantUUID, nsstInfo.name, profileInfo)
 
         execution.setVariable("nssiSelection_oofRequest", oofRequest)
         logger.debug("Sending request to OOF: " + oofRequest)
@@ -672,13 +682,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
         Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
         List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
-        Map<String, Object> solution = nsiSolutions.get(0)
-
-        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
-        Boolean isSharable = resourceSharingLevel == "shared"   //todo
 
-        if (isSharable && solution != null) {
-            processNssiResult(sliceTaskParams, subnetType, solution)
+        if(nsiSolutions.size()>=1) {
+        Map<String,Object> solution = nsiSolutions.get(0) as Map
+        processNssiResult(sliceTaskParams, subnetType, solution)
         }
 
         execution.setVariable("sliceTaskParams", sliceTaskParams)
index dd16851..d2ba282 100644 (file)
@@ -146,6 +146,11 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
                 ss.setWorkloadContext(domainTypeStr)
             }
 
+            String resourceSharingLevel = jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel")
+            if (isNotBlank(resourceSharingLevel)) {
+                ss.setServiceFunction(resourceSharingLevel)
+            }
+
             AAIResourcesClient client = getAAIClient()
             AAIResourceUri uri =
                     AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
index 6fd8080..74a2d98 100644 (file)
@@ -40,6 +40,7 @@ import org.onap.so.beans.nsmf.DeAllocateNssi
 import org.onap.so.beans.nsmf.EsrInfo
 import org.onap.so.beans.nsmf.NetworkType
 import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.beans.nsmf.oof.SubnetType
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
@@ -333,9 +334,9 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " operationId:" + modificationJobId)
 
                ResourceOperationStatus initStatus = new ResourceOperationStatus()
-               initStatus.setServiceId(serviceId)
+               initStatus.setServiceId(nsiId)
                initStatus.setOperationId(modificationJobId)
-               initStatus.setResourceTemplateUUID(nsiId)
+               initStatus.setResourceTemplateUUID(serviceId)
                initStatus.setOperType("Modify-Deallocate")
                requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
 
@@ -347,13 +348,18 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                String responseId = "1"
                String globalSubscriberId = execution.getVariable("globalSubscriberId")
                String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String anNssiId = execution.getVariable("anNssiId")
 
                 JsonObject esrInfo = new JsonObject()
                 esrInfo.addProperty("networkType", networkType)
                 esrInfo.addProperty("vendor", "ONAP_internal")
 
                 JsonObject serviceInfo = new JsonObject()
-                serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+                if (networkType.equals(SubnetType.AN.getSubnetType())) {
+                    serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+                } else {
+                    serviceInfo.addProperty("nsiId", anNssiId)
+                }
                serviceInfo.addProperty("nssiId", instanceId)
                 serviceInfo.addProperty("globalSubscriberId", globalSubscriberId)
                serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType)
@@ -526,7 +532,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs")
 
                DeAllocateNssi deallocateNssi = new DeAllocateNssi()
-               deallocateNssi.setNsiId(execution.getVariable("nsiId"))
+               deallocateNssi.setNsiId(anNssiId)
                ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
                String nssiId = tnNssi.getServiceInstanceId()
 
index 1105874..e563471 100644 (file)
 package org.onap.so.bpmn.infrastructure.scripts
 
 import com.fasterxml.jackson.databind.ObjectMapper
-import com.google.gson.JsonObject
+import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.v19.AllottedResource
-import org.onap.aai.domain.yang.v19.GenericVnf
+import org.json.JSONArray
+import org.json.JSONObject
+import org.onap.aai.domain.yang.v19.ModelVer
 import org.onap.aai.domain.yang.v19.ServiceInstance
 import org.onap.aai.domain.yang.v19.SliceProfile
-import org.onap.aai.domain.yang.v19.SliceProfiles
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.Relationships
@@ -37,22 +37,19 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.logging.filter.base.ONAPComponents
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.OofUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
-import org.onap.so.client.HttpClientFactory
-import org.onap.so.client.oof.adapter.beans.payload.OofRequest
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
 import javax.ws.rs.core.Response
 
-import static org.apache.commons.lang3.StringUtils.isBlank
-import static org.apache.commons.lang3.StringUtils.isBlank
-import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank
 import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank
 
 class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
@@ -88,7 +85,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
         LOGGER.debug("${PREFIX} Start executeTerminateNSSIQuery")
 
         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
-       // String urlString = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
 
         //API Path
         String apiPath =  "/api/oof/terminate/nxi/v1"
@@ -102,20 +98,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
         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 Adapter: " + basicAuthValue)
-            try {
-                authHeader = utils.getBasicAuth(basicAuthValue, msokey)
-                execution.setVariable("BasicAuthHeaderValue", authHeader)
-            } catch (Exception ex) {
-                LOGGER.error( "Unable to encode username and password string: " + ex)
-                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string")
-            }
-        } else {
-            LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null")
-            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null")
-        } */
-
 
         try {
             authHeader = utils.getBasicAuth(basicAuthValue, msokey)
@@ -177,7 +159,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
                         " \"errorCode\": \"${errorCode}\",\n" +
                         " \"errorMessage\": \"${errorMessage}\"\n" +
                         "}"
-                //exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
             }
 
             if (httpResponse.hasEntity()) {
@@ -282,71 +263,124 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
     }
 
 
-
     /**
-     * Invokes deleteServiceOrder external API
+     * Prepares ServiceOrderRequest
      * @param execution
      */
-    void deleteServiceOrder(DelegateExecution execution) {
-        LOGGER.debug("${PREFIX} Start deleteServiceOrder")
+    private void prepareServiceOrderRequest(DelegateExecution execution) {
+        LOGGER.debug("${PREFIX} Start prepareServiceOrderRequest")
 
         def currentNSSI = execution.getVariable("currentNSSI")
 
-        try {
-            //url:/nbi/api/v4/serviceOrder/"
-            def nsmfЕndPoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
-
-            ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
-
-            //String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId())
-
-            GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf']
-
-            // http://so.onap:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances/de6a0aa2-19f2-41fe-b313-a5a9f159acd7/vnfs/3abbb373-8d33-4977-aa4b-2bfee496b6d5
-            String url = String.format("${nsmfЕndPoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+        //extAPI path hardcoded for testing purposes, will be updated in next patch
+        String extAPIPath = "https://nbi.onap:8443/nbi/api/v4" + "/serviceOrder"
+        execution.setVariable("ExternalAPIURL", extAPIPath)
+        ObjectMapper objectMapper = new ObjectMapper();
+        Map<String, Object> serviceOrder = new LinkedHashMap()
+        //ExternalId
+        serviceOrder.put("externalId", "ONAP001")
+
+        //Requested Start Date
+        String requestedStartDate = utils.generateCurrentTimeInUtc()
+        String requestedCompletionDate = utils.generateCurrentTimeInUtc()
+        serviceOrder.put("requestedStartDate", requestedStartDate)
+        serviceOrder.put("requestedCompletionDate", requestedCompletionDate)
+
+        //RelatedParty Fields
+        String relatedPartyId = execution.getVariable("globalSubscriberId")
+        String relatedPartyRole = "ONAPcustomer"
+        Map<String, String> relatedParty = new LinkedHashMap()
+        relatedParty.put("id", relatedPartyId)
+        relatedParty.put("role", relatedPartyRole)
+        List<Map<String, String>> relatedPartyList = new ArrayList()
+        relatedPartyList.add(relatedParty)
+        serviceOrder.put("relatedParty", relatedPartyList)
+
+        Map<String, Object> orderItem = new LinkedHashMap()
+        //orderItem id
+        String orderItemId = "1"
+        orderItem.put("id", orderItemId)
+
+        //order item action will always be delete as we are triggering request for deletion
+        String orderItemAction = "delete"
+        orderItem.put("action", orderItemAction)
+
+        // service Details
+        AAIResourcesClient client = getAAIClient()
+        ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] //(ServiceInstance) currentNSSI['nssi']
+        AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId()))
+
+        Map<String, Object> service = new LinkedHashMap()
+        // Service id
+        service.put("id",  networkServiceInstance.getServiceInstanceId())
+
+        //ServiceName
+        String serviceName = networkServiceInstance.getServiceInstanceName()
+        service.put("name",  serviceName)
+
+        // Service Type
+        service.put("serviceType", networkServiceInstance.getServiceType())
+        //Service State
+        service.put("serviceState", "active")
+
+        Map<String, String> serviceSpecification = new LinkedHashMap()
+        String modelUuid = networkServiceInstance.getModelVersionId()
+        serviceSpecification.put("id", modelUuid)
+        service.put("serviceSpecification", serviceSpecification)
+
+        orderItem.put("service", service)
+        List<Map<String, String>> orderItemList = new ArrayList()
+        orderItemList.add(orderItem)
+        serviceOrder.put("orderItem", orderItemList)
+        String jsonServiceOrder = objectMapper.writeValueAsString(serviceOrder)
+        LOGGER.debug("******* ServiceOrder :: "+jsonServiceOrder)
+        execution.setVariable("serviceOrderRequest", jsonServiceOrder)
+
+        LOGGER.debug("${PREFIX} End prepareServiceOrderRequest")
+    }
 
-            LOGGER.debug("url = " + url)
 
-            currentNSSI['deleteServiceOrderURL'] = url
 
-            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-            String basicAuth =  UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+    /**
+     * Invokes deleteServiceOrder external API
+     * @param execution
+     */
+    void deleteServiceOrder(DelegateExecution execution) {
+        LOGGER.debug("${PREFIX} Start deleteServiceOrder")
 
-            def authHeader = utils.getBasicAuth(basicAuth, msoKey)
+        def currentNSSI = execution.getVariable("currentNSSI")
 
-            def requestDetails = ""
+        prepareServiceOrderRequest(execution)
 
-            String prepareRequestDetailsResponse = prepareRequestDetails(execution)
-            LOGGER.debug("deleteServiceOrder: prepareRequestDetailsResponse=" + prepareRequestDetailsResponse)
+        try {
+            String extAPIPath = execution.getVariable("ExternalAPIURL")
+            String payload = execution.getVariable("serviceOrderRequest")
+            LOGGER.debug("externalAPIURL is: " + extAPIPath)
+            LOGGER.debug("ServiceOrder payload is: " + payload)
 
-            String errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode")
-            LOGGER.debug("deleteServiceOrder: errorCode=" + errorCode)
-            if(errorCode == null || errorCode.isEmpty()) { // No error
-                requestDetails = prepareRequestDetailsResponse
-            }
-            else {
-                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage"))
-            }
+            execution.setVariable("ServiceOrderId", "")
 
-            String callDeleteServiceOrderResponse = callDeleteServiceOrder(url, authHeader, requestDetails)
-            errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
+            String callDeleteServiceOrderResponse = callDeleteServiceOrder(execution, extAPIPath, payload)
+            String errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
 
             if(errorCode == null || errorCode.isEmpty()) { // No error
-                String macroOperationId = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "requestReferences.requestId")
-                String requestSelfLink = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "requestReferences.requestSelfLink")
+                JSONObject responseObj = new JSONObject(callDeleteServiceOrderResponse)
 
-                execution.setVariable("macroOperationId",  macroOperationId)
-                execution.setVariable("requestSelfLink", requestSelfLink)
+                String serviceOrderId = responseObj.get("id")
 
-                currentNSSI['requestSelfLink'] = requestSelfLink
+                execution.setVariable("ServiceOrderId", serviceOrderId)
+                LOGGER.info("Delete ServiceOrderid is: " + serviceOrderId)
             }
             else {
                 LOGGER.error(jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage"))
                 exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage"))
             }
-        } catch (any) {
-            String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause()
-            LOGGER.error(msg)
+
+        }catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            String msg = "Exception in ServiceOrder ExtAPI" + ex.getMessage()
+            LOGGER.debug(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
 
@@ -354,33 +388,38 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
     }
 
 
-    String callDeleteServiceOrder(String url, String authHeader, String requestDetailsStr) {
+    String callDeleteServiceOrder(DelegateExecution execution, String extAPIPath, String payload) {
         LOGGER.debug("${PREFIX} Start callDeleteServiceOrder")
 
         String errorCode = ""
         String errorMessage = ""
         String response = ""
 
-        LOGGER.debug("callDeleteServiceOrder: url = " + url)
-        LOGGER.debug("callDeleteServiceOrder: authHeader = " + authHeader)
+        LOGGER.debug("callDeleteServiceOrder: url = " + extAPIPath)
 
         try {
-            HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
-            httpClient.addAdditionalHeader("Authorization", authHeader)
-            httpClient.addAdditionalHeader("Accept", "application/json")
-            Response httpResponse = httpClient.delete(requestDetailsStr)
+            ExternalAPIUtil externalAPIUtil = getExternalAPIUtil()
+            Response httpResponse = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
 
-            int soResponseCode = httpResponse.getStatus()
-            LOGGER.debug("callDeleteServiceOrder: soResponseCode = " + soResponseCode)
+            int responseCode = httpResponse.getStatus()
+            execution.setVariable("ServiceOrderResponseCode", responseCode)
+            LOGGER.debug("Delete ServiceOrder response code is: " + responseCode)
+
+            //Process Response
+            if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) {
+            //200 OK 201 CREATED 202 ACCEPTED
+                LOGGER.debug("Delete ServiceOrder Received a Good Response")
 
-            if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
                 response = httpResponse.readEntity(String.class)
 
                 LOGGER.debug("callDeleteServiceInstance: response = " + response)
+
+                execution.setVariable("DeleteServiceOrderResponse", response)
+
             }
             else {
                 errorCode = 500
-                errorMessage = "Response code is " + soResponseCode
+                errorMessage = "Response code is " + responseCode
 
                 response =  "{\n" +
                         " \"errorCode\": \"${errorCode}\",\n" +
@@ -503,18 +542,64 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
     void getDeleteServiceOrderProgress(DelegateExecution execution) {
         LOGGER.debug("${getPrefix()} Start getDeleteServiceOrderProgress")
 
-        def currentNSSI = execution.getVariable("currentNSSI")
-
-        String url = currentNSSI['requestSelfLink']
-
-        String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-
-        String basicAuth =  UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
-
-        def authHeader = ""
-        String basicAuthValue = utils.getBasicAuth(basicAuth, msoKey)
+        String msg
+        try {
+            String extAPIPath = execution.getVariable("ExternalAPIURL")
+            extAPIPath += "/" + execution.getVariable("ServiceOrderId")
+            LOGGER.debug("externalAPIURL is: " + extAPIPath)
+
+            ExternalAPIUtil externalAPIUtil = getExternalAPIUtil()
+            Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
+            int responseCode = response.getStatus()
+            execution.setVariable("GetServiceOrderResponseCode", responseCode)
+            LOGGER.debug("Get ServiceOrder response code is: " + responseCode)
+            String extApiResponse = response.readEntity(String.class)
+            JSONObject responseObj = new JSONObject(extApiResponse)
+            execution.setVariable("GetServiceOrderResponse", extApiResponse)
+            LOGGER.debug("Get response body is: " + extApiResponse)
+            //Process Response //200 OK 201 CREATED 202 ACCEPTED
+            if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
+            {
+                LOGGER.debug("Get Delete ServiceOrder Received a Good Response")
+                String orderState = responseObj.get("state")
+                if("REJECTED".equalsIgnoreCase(orderState)) {
+                    prepareFailedOperationStatusUpdate(execution)
+                    return
+                }
+                JSONArray items = responseObj.getJSONArray("orderItem")
+                JSONObject item = items.get(0) as JSONObject
+                JSONObject service = item.get("service") as JSONObject
+                String networkServiceId = service.get("id")
+
+                execution.setVariable("networkServiceId", networkServiceId)
+                String serviceOrderState = item.get("state")
+                execution.setVariable("ServiceOrderState", serviceOrderState)
+                // Get serviceOrder State and process progress
+                if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState) || "INPROGRESS".equalsIgnoreCase(serviceOrderState) || "IN_PROGRESS".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable("deleteStatus", "processing")
+                }
+                else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable("deleteStatus", "completed")
+                }
+                else if("FAILED".equalsIgnoreCase(serviceOrderState)) {
+                    msg = "ServiceOrder failed"
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  msg)
+                }
+                else {
+                    msg = "ServiceOrder failed"
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  msg)
+                }
+                LOGGER.debug("NBI serviceOrder state: "+serviceOrderState)
+            }
+            else{
+                msg = "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode
+                prepareFailedOperationStatusUpdate(execution)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  msg)
+            }
 
-        getProgress(execution, url, basicAuthValue, "deleteStatus")
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  e.getMessage())
+        }
 
         LOGGER.debug("${getPrefix()} Exit getDeleteServiceOrderProgress")
     }
@@ -574,4 +659,8 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
     String getAction() {
         return ACTION
     }
+
+    ExternalAPIUtil getExternalAPIUtil() {
+        return new ExternalAPIUtilFactory().create()
+    }
 }
index b09161d..ea4c29b 100644 (file)
@@ -34,6 +34,13 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
 import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.oof.adapter.beans.payload.OofRequest
+import javax.ws.rs.core.Response
+import org.onap.logging.filter.base.ONAPComponents
 import org.onap.so.db.request.beans.ResourceOperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -48,6 +55,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
     JsonUtils jsonUtil = new JsonUtils()
     RequestDBUtil requestDBUtil = new RequestDBUtil()
     TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    OofUtils oofUtils = new OofUtils()
     JsonSlurper jsonSlurper = new JsonSlurper()
     ObjectMapper objectMapper = new ObjectMapper()
     private static final Logger logger = LoggerFactory.getLogger(DoDeallocateTnNssi.class)
@@ -92,10 +100,69 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
                         "enableSdnc", "enableSdnc"))) {
             tnNssmfUtils.setEnableSdncConfig(execution)
         }
+        if (isBlank(additionalPropJsonStr) ||
+                isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution,
+                        additionalPropJsonStr,
+                        "enableOof", "enableOof"))) {
+            tnNssmfUtils.setEnableOofConfig(execution)
+        }
 
+               String nsiId = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiId")
+        execution.setVariable("nsiId", nsiId)
         logger.debug("Finish preProcessRequest")
     }
 
+    void prepareOOFNssiTerminationRequest(DelegateExecution execution) {
+        logger.debug("Start prepareOOFTnNssiTerminationRequest")
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "TN_NSSITermination"
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+
+        String relatedNsiId = execution.getVariable("nsiId")
+
+               String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,serviceInstanceId, "NSSI",messageType,relatedNsiId)
+               execution.setVariable("oofTnNssiPayload", oofRequest)
+               logger.debug("Finish prepareOOFTnNssiTerminationRequest")
+    }
+
+    void performOofNSSITerminationCall(DelegateExecution execution) {
+        boolean terminateTnNSSI = callOofAdapter(execution,execution.getVariable("oofTnNssiPayload"))
+               execution.setVariable("terminateTnNSSI", terminateTnNSSI)
+    }
+
+    /**
+        * @param execution
+        * @param oofRequest - Request payload to be sent to adapter
+        * @return
+        */
+       boolean callOofAdapter(DelegateExecution execution, Object oofRequest) {
+               logger.debug("Start callOofAdapter")
+               String requestId = execution.getVariable("msoRequestId")
+               String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
+               URL requestUrl = new URL(oofAdapterEndpoint)
+               OofRequest oofPayload = new OofRequest()
+               oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+               oofPayload.setRequestDetails(oofRequest)
+               String requestJson = objectMapper.writeValueAsString(oofPayload)
+               logger.debug("Calling OOF adapter  : ${requestUrl} with payload : ${requestJson}")
+               HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.EXTERNAL)
+               Response httpResponse = httpClient.post(requestJson)
+               int responseCode = httpResponse.getStatus()
+               logger.debug("OOF sync response code is: " + responseCode)
+               if(responseCode < 200 || responseCode >= 300){
+                       logger.debug("OOF request failed with reason : " + httpResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+               }else {
+                       Map<String,Object> response = objectMapper.readValue(httpResponse.getEntity(),Map.class)
+                       boolean terminateResponse =  response.get("terminateResponse")
+                       if(!terminateResponse) {
+                               logger.debug("Terminate response is false because " + response.get("reason"))
+                       }
+                       return terminateResponse
+               }
+       }
+
     void preprocessSdncDeallocateTnNssiRequest(DelegateExecution execution) {
         def method = getClass().getSimpleName() + '.preprocessSdncDeallocateTnNssiRequest(' +
                 'execution=' + execution.getId() + ')'
@@ -174,4 +241,3 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
         requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
     }
 }
-
index 09bbb81..9debd40 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import com.fasterxml.jackson.core.type.TypeReference
 import com.fasterxml.jackson.databind.ObjectMapper
+import org.json.JSONArray
 import com.google.gson.JsonArray
+import com.google.gson.GsonBuilder
 import com.google.gson.JsonObject
+import com.google.gson.JsonParser
 import groovy.json.JsonSlurper
+import org.onap.so.bpmn.common.scripts.OofUtils
+import com.google.gson.Gson
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.ServiceInstance
@@ -53,6 +59,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
     RequestDBUtil requestDBUtil = new RequestDBUtil()
     JsonSlurper jsonSlurper = new JsonSlurper()
     ObjectMapper objectMapper = new ObjectMapper()
+    OofUtils oofUtils = new OofUtils()
     TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
     private static final Logger logger = LoggerFactory.getLogger(TnAllocateNssi.class)
 
@@ -96,7 +103,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
                 msg = "Input sliceProfile is null"
                 logger.debug(msg)
                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-            } else {
+            }
+            else {
                 execution.setVariable("sliceProfile", sliceProfile)
             }
 
@@ -105,7 +113,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
                 msg = "Input transportSliceNetworks is null"
                 logger.debug(msg)
                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-            } else {
+            }
+            else {
                 execution.setVariable("transportSliceNetworks", transportSliceNetworks)
             }
             logger.debug("transportSliceNetworks: " + transportSliceNetworks)
@@ -115,7 +124,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
                 msg = "Input nsiInfo is null"
                 logger.debug(msg)
                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-            } else {
+            }
+            else {
                 execution.setVariable("nsiInfo", nsiInfoStr)
             }
 
@@ -123,6 +133,14 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
                     "enableSdnc", "enableSdnc"))) {
                 tnNssmfUtils.setEnableSdncConfig(execution)
             }
+
+            if (isBlank(additionalPropJsonStr) ||
+                    isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution,
+                            additionalPropJsonStr,
+                            "enableOof", "enableOof"))) {
+                tnNssmfUtils.setEnableOofConfig(execution)
+            }
+
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
@@ -169,6 +187,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
         //TN NSST decomposition
         String tnModelVersion = tnNsstServiceDecomposition.getModelInfo().getModelVersion()
         String tnModelName = tnNsstServiceDecomposition.getModelInfo().getModelName()
+
         List<ServiceProxy> serviceProxyList = tnNsstServiceDecomposition.getServiceProxy()
         List<String> nsstInfoList = new ArrayList<>()
         for (ServiceProxy serviceProxy : serviceProxyList) {
@@ -188,7 +207,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
             String msg = "Exception in TN NSST processDecomposition. There is no NSST associated with TN NSST "
             logger.info(msg)
             //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        } else {
+        }
+        else {
             execution.setVariable("tnNsstInfoList", nsstInfoList)
             execution.setVariable("tnModelVersion", tnModelVersion)
             execution.setVariable("tnModelName", tnModelName)
@@ -196,6 +216,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
             execution.setVariable("maxIndex", maxIndex)
         }
 
+        execution.setVariable("tnNfSliceProfile", execution.getVariable("sliceProfile"))
+        execution.setVariable("tnModelName", tnModelName)
         logger.debug("End processDecomposition")
     }
 
@@ -205,90 +227,52 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
         logger.debug("get NSSI option OOF Url: " + urlString)
         //build oof request body
+
         String requestId = execution.getVariable("msoRequestId")
-        String messageType = "NSISelectionResponse"
-        Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+        String messageType = "NSSISelectionResponse"
+        Map<String, Object> profileInfo = (Map<String, Object>) objectMapper.readValue(execution.getVariable("tnNfSliceProfile"), Map.class)
         String modelUuid = execution.getVariable("modelUuid")
         String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
         String modelName = execution.getVariable("tnModelName")
         String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
-        List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class)
-        JsonArray capabilitiesList = new JsonArray()
 
-        execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nssiSelection_Url", "/api/oof/selection/nssi/v1")
         execution.setVariable("nssiSelection_messageType", messageType)
         execution.setVariable("nssiSelection_correlator", requestId)
         execution.setVariable("nssiSelection_timeout", timeout)
-        String oofRequest = buildSelectTnNssiRequest(requestId, messageType, modelUuid, modelInvariantUuid,
-                modelName, profileInfo, nsstInfoList, capabilitiesList, false)
+        String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, modelUuid, modelInvariantUuid, modelName, profileInfo)
         execution.setVariable("nssiSelection_oofRequest", oofRequest)
 
         logger.debug("Finish prepareOofSelection")
     }
 
-    String buildSelectTnNssiRequest(String requestId, String messageType, String UUID, String invariantUUID,
-                                    String name, Map<String, Object> profileInfo,
-                                    List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse) {
-
-        def transactionId = requestId
-        logger.debug("transactionId is: " + transactionId)
-        String correlator = requestId
-        String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
-        ObjectMapper objectMapper = new ObjectMapper()
-        String profileJson = objectMapper.writeValueAsString(profileInfo)
-        String nsstInfoListString = objectMapper.writeValueAsString(nsstInfoList)
-        //Prepare requestInfo object
-        JsonObject requestInfo = new JsonObject()
-        requestInfo.addProperty("transactionId", transactionId)
-        requestInfo.addProperty("requestId", requestId)
-        requestInfo.addProperty("callbackUrl", callbackUrl)
-        requestInfo.addProperty("sourceId", "SO")
-        requestInfo.addProperty("timeout", 600)
-        requestInfo.addProperty("numSolutions", 1)
-
-        //Prepare serviceInfo object
-        JsonObject ranNsstInfo = new JsonObject()
-        ranNsstInfo.addProperty("UUID", UUID)
-        ranNsstInfo.addProperty("invariantUUID", invariantUUID)
-        ranNsstInfo.addProperty("name", name)
-
-        JsonObject json = new JsonObject()
-        json.add("requestInfo", requestInfo)
-        json.add("NSTInfo", ranNsstInfo)
-        json.addProperty("serviceProfile", profileJson)
-        json.addProperty("NSSTInfo", nsstInfoListString)
-        json.add("subnetCapabilities", capabilitiesList)
-        json.addProperty("preferReuse", preferReuse)
-
-        return json.toString()
-    }
-
     void processOofSelection(DelegateExecution execution) {
         logger.debug(Prefix + "processOofSelection method start")
         String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
         String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
         if (requestStatus.equals("completed")) {
-            List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
-            boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
-            if (existingNSI) {
-                def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution")
-                execution.setVariable("sharedTnNssiSolution", sharedNSISolution)
-                logger.debug("sharedTnNssiSolution from OOF " + sharedNSISolution)
-                String tnServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId")
-                execution.setVariable("tnServiceInstanceId", tnServiceInstanceId)
-                org.onap.so.bpmn.core.domain.ServiceInstance serviceInstance = new org.onap.so.bpmn.core.domain.ServiceInstance();
-                serviceInstance.setInstanceId(tnServiceInstanceId);
-                ServiceDecomposition serviceDecomposition = execution.getVariable("tnNsstServiceDecomposition")
-                serviceDecomposition.setServiceInstance(serviceInstance);
-                execution.setVariable("tnNsstServiceDecomposition", serviceDecomposition)
+            String solutions = jsonUtil.getJsonValue(oofResponse, "solutions")
+            JsonParser parser = new JsonParser()
+            JsonArray solution = parser.parse(solutions) as JsonArray
+            if (solution.size() >= 1) {
+                JsonObject sol = solution.get(0) as JsonObject
+                String tnNfNssiId = sol.get("NSSIId").getAsString()
+                String invariantUuid = sol.get("invariantUUID").getAsString()
+                String uuid = sol.get("UUID").getAsString()
+                String nssiName = sol.get("NSSIName").getAsString()
+                execution.setVariable("TnServiceInstanceId", tnNfNssiId)
+                execution.setVariable("TNNFInvariantUUID", invariantUuid)
+                execution.setVariable("TNNFUUID", uuid)
+                execution.setVariable("servicename", nssiName)
+                logger.debug("TnServiceInstanceId from OOF " + tnNfNssiId)
                 execution.setVariable("isOofTnNssiSelected", true)
-            } else {
-                def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
-                execution.setVariable("tnConstituentSliceProfiles", sliceProfiles)
+            }
+            else {
+                logger.debug("No solutions returned from OOF .. Create new TN NF NSSI")
                 execution.setVariable("isOofTnNssiSelected", false)
-                logger.debug("tnConstituentSliceProfiles list from OOF " + sliceProfiles)
             }
-        } else {
+        }
+        else {
             String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
             logger.error("received failed status from oof " + statusMessage)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a failed Async Response from OOF : " + statusMessage)
@@ -297,6 +281,75 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
         logger.debug(Prefix + "processOofSelection method finished")
     }
 
+    void prepareModifyTnNssiInputs(DelegateExecution execution) {
+        logger.debug(Prefix + "prepareModifyTnNssiInputs method start")
+        String additionalPropJsonStr = execution.getVariable("sliceParams")
+        String sliceProfile = execution.getVariable("sliceProfile")
+        String snssaiList = jsonUtil.getJsonValue(sliceProfile, "snssaiList")
+        String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
+        String nsiInfo = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiInfo")
+        String scriptName = jsonUtil.getJsonValue(additionalPropJsonStr, "scriptName")
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        String serviceInstanceID = execution.getVariable("TnServiceInstanceId")
+        String servicename = execution.getVariable("servicename")
+        String transportSliceNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportSliceNetworks")
+
+        JsonObject modifySliceParams = new JsonObject()
+        modifySliceParams.addProperty("nsiInfo", nsiInfo)
+        modifySliceParams.addProperty("serviceInstanceID", serviceInstanceID)
+        modifySliceParams.addProperty("servicename", servicename)
+        modifySliceParams.addProperty("sliceProfile", sliceProfile)
+        modifySliceParams.addProperty("sliceProfileId", sliceProfileId)
+        modifySliceParams.addProperty("modelInvariantUuid", modelInvariantUuid)
+        modifySliceParams.addProperty("modelUuid", modelUuid)
+        modifySliceParams.addProperty("scriptName", scriptName)
+        modifySliceParams.addProperty("snssaiList", snssaiList)
+        modifySliceParams.addProperty("transportSliceNetworks", transportSliceNetworks)
+
+        execution.setVariable("modifySliceParams", modifySliceParams.toString())
+
+        logger.debug(Prefix + "prepareModifyTnNssiInputs method finished")
+    }
+
+    def createModifyNssiQueryJobStatus = { DelegateExecution execution ->
+        logger.debug(Prefix + "createModifyNssiQueryJobStatus method start")
+        JsonObject esrInfo = new JsonObject()
+        esrInfo.addProperty("networkType", "tn")
+        esrInfo.addProperty("vendor", "ONAP_internal")
+
+        execution.setVariable("esrInfo", esrInfo.toString())
+
+        JsonObject serviceInfo = new JsonObject()
+        serviceInfo.addProperty("nssiId", execution.getVariable("TnServiceInstanceId") as String)
+        serviceInfo.addProperty("nsiId", execution.getVariable("nsiId") as String)
+        serviceInfo.addProperty("nssiName", execution.getVariable("servicename") as String)
+        serviceInfo.addProperty("sST", execution.getVariable("sst") as String)
+        serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("pLMNIdList")))
+        serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId") as String)
+        serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType") as String)
+        serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("modelInvariantUuid") as String)
+        serviceInfo.addProperty("serviceUuid", execution.getVariable("modelUuid") as String)
+        execution.setVariable("serviceInfo", serviceInfo.toString())
+        execution.setVariable("responseId", "")
+    }
+
+    def processModifyJobStatusRsp = { DelegateExecution execution ->
+        logger.debug(Prefix + "processJobStatusRsp method start")
+        String jobResponse = execution.getVariable("jobResponse")
+        logger.debug("Job status response " + jobResponse)
+        String status = jsonUtil.getJsonValue(jobResponse, "status")
+        String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId")
+        if (status.equalsIgnoreCase("finished")) {
+            logger.debug("Job successfully completed ... proceeding with flow for nssi : " + nssi)
+        }
+        else {
+            String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
+            logger.error("received failed status from job status query for nssi : " + nssi + " with status description : " + statusDescription)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "received failed status from job status query for nssi : " + nssi + " with status description : " + statusDescription)
+        }
+    }
+
     void updateAAIOrchStatus(DelegateExecution execution) {
         logger.debug("Start updateAAIOrchStatus")
         String sliceServiceInstanceId = execution.getVariable("sliceServiceInstanceId")
index e0c2b77..d1e2b11 100644 (file)
@@ -377,12 +377,23 @@ class TnNssmfUtils {
             logger.debug("mso.workflow.TnNssmf.enableSDNCNetworkConfig is undefined, so use default value (true)")
             enableSdnc = "true"
         }
-       enableSdnc = "false"
         logger.debug("setEnableSdncConfig: enableSdnc=" + enableSdnc)
 
         execution.setVariable("enableSdnc", enableSdnc)
     }
 
+    void setEnableOofConfig(DelegateExecution execution) {
+        String enableOof = UrnPropertiesReader.getVariable(
+                "mso.workflow.TnNssmf.enableOOFNetworkConfig")
+        if (isBlank(enableOof)) {
+            logger.debug("mso.workflow.TnNssmf.enableOOFNetworkConfig is undefined, so use default value (true)")
+            enableOof = "true"
+        }
+        logger.debug("setEnableOofConfig: enableOof=" + enableOof)
+
+        execution.setVariable("enableOof", enableOof)
+    }
+
     String setExecVarFromJsonIfExists(DelegateExecution execution,
                                       String jsonStr, String jsonKey, String varName) {
         return setExecVarFromJsonStr(execution, jsonStr, jsonKey, varName, false)
index 6ea2be8..b7cddd2 100644 (file)
@@ -31,9 +31,12 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.beans.nsmf.oof.TemplateInfo
 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.common.scripts.OofUtils
 
 import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertEquals
 import static org.mockito.ArgumentMatchers.eq
 import static org.mockito.Mockito.*
 
@@ -166,4 +169,55 @@ class DoAllocateTnNssiTest extends MsoGroovyTest {
      }"""
         return expect.replaceAll("\\\\s+", "")
     }
+
+    @Test
+    void testPrepareOofSelection() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("10dad82d-4bd9-467a-b113-5f8ea7eaae3c")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("e2eb2fe3-92a7-447b-8582-077db5cd0862")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("22e6ce80-a55f-4171-a457-a7ecb1865669")
+        when(mockExecution.getVariable("tnModelName")).thenReturn("Tn_ONAP_internal_BH")
+        when(mockExecution.getVariable("mso.adapters.oof.timeout")).thenReturn("")
+        TnAllocateNssi obj = spy(TnAllocateNssi.class)
+        OofUtils oofUtils = spy(OofUtils.class)
+        String requestId = "10dad82d-4bd9-467a-b113-5f8ea7eaae3c"
+        String nsstInfo = "\"{\"UUID\":\"e2eb2fe3-92a7-447b-8582-077db5cd0862\",\"invariantUUID\":\"22e6ce80-a55f-4171-a457-a7ecb1865669\",\"name\":\"Tn_ONAP_internal_BH\"}"
+        String messageType = "NSSISelectionResponse"
+        String sliceProfile = "{\"maxBandwidth\":3000,\"sliceProfileId\":\"ab9af40f13f721b5f13539d87484098\",\"latency\":10,\"snssaiList\":[\"001-100001\"],\"pLMNIdList\":[\"460-00\",\"460-01\"],\"perfReq\":{},\"coverageAreaTAList\":[],\"resourceSharingLevel\":\"shared\"}}"
+        Integer timeout = 600
+
+        when(oofUtils.buildSelectNSSIRequest(requestId, nsstInfo as TemplateInfo, messageType, sliceProfile, timeout)).thenReturn("""
+        {
+    "apiPath": "/api/oof/selection/nssi/v1",
+    "requestDetails": "{\\"requestInfo\\":{\\"transactionId\\":\\"10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"requestId\\":\\"10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"callbackUrl\\":\\"http://so-oof-adapter.onap:8090/so/adapters/oof/callback/v1/NSSISelectionResponse/10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"sourceId\\":\\"SO\\",\\"timeout\\":600,\\"numSolutions\\":1},\\"NSSTInfo\\":{\\"UUID\\":\\"e2eb2fe3-92a7-447b-8582-077db5cd0862\\",\\"invariantUUID\\":\\"22e6ce80-a55f-4171-a457-a7ecb1865669\\",\\"name\\":\\"Tn_ONAP_internal_BH\\"},\\"sliceProfile\\":{\\"maxBandwidth\\":3000,\\"sliceProfileId\\":\\"ab9af40f13f721b5f13539d87484098\\",\\"latency\\":10,\\"snssaiList\\":[\\"001-100001\\"],\\"pLMNIdList\\":[\\"460-00\\",\\"460-01\\"],\\"perfReq\\":{},\\"coverageAreaTAList\\":[],\\"resourceSharingLevel\\":\\"shared\\"}}"
+    }""".replaceAll("\\\\s+", ""))
+        obj.prepareOofSelection(mockExecution)
+        verify(mockExecution, times(1)).setVariable(eq("nssiSelection_oofRequest"), captor.capture())
+        String nssiSelection_oofRequest = captor.getValue()
+        assertNotNull(nssiSelection_oofRequest)
+    }
+
+    @Test
+    void testprocessOofSelection() {
+        when(mockExecution.getVariable("nssiSelection_oofRequest")).thenReturn("""
+        {
+    "requestId": "a727643a-bf89-4fd9-b33c-b7bdda18c2b7",
+    "transactionId": "a727643a-bf89-4fd9-b33c-b7bdda18c2b7",
+    "requestStatus": "completed",
+    "statusMessage": "",
+    "solutions": [
+        {
+            "UUID": "e2eb2fe3-92a7-447b-8582-077db5cd0862",
+            "invariantUUID": "22e6ce80-a55f-4171-a457-a7ecb1865669",
+            "NSSIName": "nssi_tnservice12",
+            "NSSIId": "fe26a924-3845-4001-b84e-a439a27a88c0"
+        }
+    ]
+    }""".replaceAll("\\\\s+", ""))
+        TnAllocateNssi obj = spy(TnAllocateNssi.class)
+        ArrayList<String> solution = new ArrayList<>()
+        assertEquals(1, solution.size())
+        verify(mockExecution, times(1)).setVariable(eq("isOofTnNssiSelected"), captor.capture())
+        String isOofTnNssiSelected = captor.getValue()
+        assertEquals("true", isOofTnNssiSelected)
+    }
 }
index acace8c..9ee9255 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.fasterxml.jackson.databind.ObjectMapper
 import org.junit.Before
 import org.junit.Test
 import org.mockito.Mockito
-import org.onap.aai.domain.yang.v19.*
+import org.onap.aai.domain.yang.v19.AllottedResource
+import org.onap.aai.domain.yang.v19.AllottedResources
+import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aai.domain.yang.v19.SliceProfile
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.Relationships
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
-import org.onap.logging.filter.base.ONAPComponents
 import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
-import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.OofUtils
 import org.onap.so.client.HttpClient
 import org.onap.so.client.HttpClientFactory
-import org.onap.so.serviceinstancebeans.RequestDetails
 
 import javax.ws.rs.core.Response
 
 import static org.junit.Assert.assertNotNull
 import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.any
 import static org.mockito.Mockito.*
 
 class DoDeallocateCoreNSSITest extends MsoGroovyTest {
@@ -115,11 +114,6 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
 
         String authHeaderResponse =  "auth-header"
 
-      /*  String authHeaderResponse =  "{\n" +
-                " \"errorCode\": \"401\",\n" +
-                " \"errorMessage\": \"Bad request\"\n" +
-                "}" */
-
         when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse)
 
         AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
@@ -209,60 +203,32 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
 
         currentNSSI.put("networkServiceInstance", networkServiceInstance)
 
-        when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://mso.onap:8088")
-        when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey")
-        when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth")
+        String externalAPIURL = "https://nbi.onap:8443/nbi/api/v4/serviceOrder"
+        when(mockExecution.getVariable("ExternalAPIURL")).thenReturn(externalAPIURL)
 
         DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
         when(spy.getAAIClient()).thenReturn(client)
 
-        GenericVnf genericVnf = new GenericVnf()
-        genericVnf.setServiceId("service-id")
-        genericVnf.setVnfName("vnf-name")
-        genericVnf.setModelInvariantId("model-invariant-id")
-        genericVnf.setModelCustomizationId("model-customization-id")
-        genericVnf.setVnfName("vnf-name")
-        genericVnf.setVnfId("vnf-id")
-
-
-        currentNSSI.put("constituteVnf", genericVnf)
+        String serviceOrderRequest = ""
 
-        String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), genericVnf.getVnfId())
+        when(mockExecution.getVariable("serviceOrderRequest")).thenReturn(serviceOrderRequest)
 
-        RequestDetails requestDetails = new RequestDetails()
-        ObjectMapper mapper = new ObjectMapper()
-        String requestDetailsStr = mapper.writeValueAsString(requestDetails)
-
-        when(spy.prepareRequestDetails(mockExecution)).thenReturn(requestDetailsStr)
-
-        MsoUtils msoUtilsMock = mock(MsoUtils.class)
-        String basicAuth = "basicAuth"
-        when(msoUtilsMock.getBasicAuth(anyString(), anyString())).thenReturn(basicAuth)
-
-        HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class)
-        when(spy.getHttpClientFactory()).thenReturn(httpClientFactoryMock)
         Response responseMock = mock(Response.class)
 
-        HttpClient httpClientMock = mock(HttpClient.class)
-
-        when(httpClientFactoryMock.newJsonClient(any(), any())).thenReturn(httpClientMock)
-
-        when(httpClientMock.delete(requestDetailsStr)).thenReturn(responseMock)
+        ExternalAPIUtil externalAPIUtil = mock(ExternalAPIUtil.class)
+        when(spy.getExternalAPIUtil()).thenReturn(externalAPIUtil)
+        when(externalAPIUtil.executeExternalAPIPostCall(mockExecution, externalAPIURL, serviceOrderRequest)).thenReturn(responseMock)
 
         when(responseMock.getStatus()).thenReturn(200)
-        when(responseMock.hasEntity()).thenReturn(true)
 
-        String macroOperationId = "request-id"
-        String requestSelfLink = "request-self-link"
-        String entity = "{\"requestReferences\":{\"requestId\": \"${macroOperationId}\",\"requestSelfLink\":\"${requestSelfLink}\"}}"
+        String id = UUID.randomUUID().toString()
+        String entity = "{\"id\":\"${id}\"}"
         when(responseMock.readEntity(String.class)).thenReturn(entity)
 
         spy.deleteServiceOrder(mockExecution)
 
-        Mockito.verify(mockExecution,times(1)).setVariable("macroOperationId", macroOperationId)
-        Mockito.verify(mockExecution,times(1)).setVariable("requestSelfLink", requestSelfLink)
+        verify(mockExecution,times(1)).setVariable("ServiceOrderId", id)
 
-        assertTrue(currentNSSI['requestSelfLink'].equals(requestSelfLink))
     }
 
 
@@ -436,49 +402,44 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
     @Test
     void testDeleteServiceOrderProgressCompleted() {
 
-        executeDeleteServiceOrderProgress("COMPLETE")
+        executeDeleteServiceOrderProgress("COMPLETED")
         Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "completed")
     }
 
 
     void executeDeleteServiceOrderProgress(String state) {
         def currentNSSI = [:]
+        currentNSSI.put("nssiId","5G-999")
 
-        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
-
-        String url = "http://nbi.onap:8088/api/v4/serviceOrder/NS-777"
+        ServiceInstance networkServiceInstance = new ServiceInstance()
+        networkServiceInstance.setServiceInstanceId("NS-777")
+        networkServiceInstance.setServiceRole("Network Service")
 
-        currentNSSI['requestSelfLink'] =  url
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
 
-        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+        currentNSSI.put("networkServiceInstance", networkServiceInstance)
 
-        /*ExternalAPIUtilFactory externalAPIUtilFactoryMock = mock(ExternalAPIUtilFactory.class)
-        when(spy.getExternalAPIUtilFactory()).thenReturn(externalAPIUtilFactoryMock)
+        String serviceOrder = UUID.randomUUID().toString()
 
-        ExternalAPIUtil externalAPIUtilMock = mock(ExternalAPIUtil.class)
+        when(mockExecution.getVariable("ServiceOrderId")).thenReturn(serviceOrder)
 
-        when(externalAPIUtilFactoryMock.create()).thenReturn(externalAPIUtilMock) */
+        String externalAPIURL = "https://nbi.onap:8443/nbi/api/v4/serviceOrder"
+        when(mockExecution.getVariable("ExternalAPIURL")).thenReturn(externalAPIURL)
 
-        MsoUtils msoUtilsMock = mock(MsoUtils.class)
-        String basicAuth = "basicAuth"
-        when(msoUtilsMock.getBasicAuth(anyString(), anyString())).thenReturn(basicAuth)
+        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
 
-        HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class)
-        when(spy.getHttpClientFactory()).thenReturn(httpClientFactoryMock)
         Response responseMock = mock(Response.class)
 
-        HttpClient httpClientMock = mock(HttpClient.class)
+        ExternalAPIUtil externalAPIUtil = mock(ExternalAPIUtil.class)
+        when(spy.getExternalAPIUtil()).thenReturn(externalAPIUtil)
 
-
-        when(httpClientFactoryMock.newJsonClient(any(), any())).thenReturn(httpClientMock)
-
-        when(httpClientMock.get()).thenReturn(responseMock)
-//        when(externalAPIUtilMock.executeExternalAPIGetCall(mockExecution, url)).thenReturn(responseMock)
+        externalAPIURL += "/" + serviceOrder
+        when(externalAPIUtil.executeExternalAPIGetCall(mockExecution, externalAPIURL)).thenReturn(responseMock)
 
         when(responseMock.getStatus()).thenReturn(200)
-        when(responseMock.hasEntity()).thenReturn(true)
 
-        String entity = "{\"request\":{\"requestStatus\":{\"requestState\":\"${state}\"}},\"state\":\"ACCEPTED\"}"
+        String id = UUID.randomUUID().toString()
+        String entity = "{\"state\":\"ACCEPTED\",\"orderItem\":[{\"state\":\"${state}\",\"service\":{\"id\":\"${id}\"}}]}"
         when(responseMock.readEntity(String.class)).thenReturn(entity)
 
         spy.getDeleteServiceOrderProgress(mockExecution)
index 31bd3b5..2bb2270 100644 (file)
@@ -32,8 +32,10 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.common.scripts.OofUtils
 
 import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
 import static org.mockito.ArgumentMatchers.eq
 import static org.mockito.Mockito.*
 
@@ -135,4 +137,41 @@ class DoDeallocateTnNssiTest extends MsoGroovyTest {
         obj.deleteServiceInstance(mockExecution)
         Mockito.verify(client, times(1)).delete(serviceInstanceUri)
     }
+
+    @Test
+    void testPrepareOOFNssiTerminationRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("mso.adapters.oof.timeout")).thenReturn("")
+        DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class)
+        OofUtils oofUtils = spy(OofUtils.class)
+        when(oofUtils.buildTerminateNxiRequest()).thenReturn("""
+        {
+       "apiPath": "/api/oof/terminate/nxi/v1",
+       "requestDetails": "{\"type\":\"NSSI\",\"NxIId\":\"f78c1531-55a7-4dfa-8a12-1e2544c9b248\",\"requestInfo\":{\"transactionId\":\"863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"requestId\":\"863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"callbackUrl\":\"http://so-oof-adapter.onap:8090/so/adapters/oof/callback/v1/TN_NSSITermination/863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"sourceId\":\"SO\",\"timeout\":600,\"addtnlArgs\":{\"serviceInstanceId\":\"fe6f0901-292d-4493-bcad-485793605781\"}}}"
+       }""".replaceAll("\\\\s+", ""))
+        obj.prepareOOFNssiTerminationRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("oofTnNssiPayload"), captor.capture())
+        String oofTnNssiPayload = captor.getValue()
+        assertNotNull(oofTnNssiPayload)
+    }
+
+    @Test
+    void testPerformOofNSSITerminationCall() {
+        when(mockExecution.getVariable("oofTnNssiPayload")).thenReturn("""
+        {
+       "reason": "",
+       "requestId": "e0a026a9-dd6d-4800-ab27-0fdd8f5f64f5",
+       "requestStatus": "success",
+       "terminateResponse": true,
+       "transactionId": "e0a026a9-dd6d-4800-ab27-0fdd8f5f64f5"
+        }""".replaceAll("\\\\s+", ""))
+        DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class)
+        when(obj.callOofAdapter()).thenReturn(true)
+        obj.performOofNSSITerminationCall(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("terminateTnNSSI"), captor.capture())
+        String terminateTnNSSI = captor.getValue()
+        assertTrue(terminateTnNSSI)
+    }
 }
index 85aa7c2..374ce4c 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_05od9yd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_05od9yd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0">
   <bpmn:process id="DoAllocateAccessNSSI" name="DoAllocateAccessNSSI" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1" name="Start">
       <bpmn:outgoing>Flow_163f3sq</bpmn:outgoing>
@@ -19,7 +19,7 @@ def nss = new DoAllocateAccessNSSI()
 nss.getSubnetCapabilities(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="Activity_11vdo22" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
-      <bpmn:incoming>Flow_1gxbsoi</bpmn:incoming>
+      <bpmn:incoming>Flow_0833cha</bpmn:incoming>
       <bpmn:outgoing>Flow_1xw4abx</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def nss = new DoAllocateAccessNSSI()
@@ -50,7 +50,7 @@ nss.prepareOperationStatusUpdate(execution)</bpmn:script>
     <bpmn:endEvent id="Event_0vh1hs2">
       <bpmn:incoming>Flow_0ll5x3u</bpmn:incoming>
     </bpmn:endEvent>
-    <bpmn:sequenceFlow id="Flow_0833cha" sourceRef="Event_05jtdqp" targetRef="Activity_0vf28ld" />
+    <bpmn:sequenceFlow id="Flow_0833cha" sourceRef="Event_05jtdqp" targetRef="Activity_11vdo22" />
     <bpmn:sequenceFlow id="Flow_1xw4abx" sourceRef="Activity_11vdo22" targetRef="Activity_1nfx154" />
     <bpmn:sequenceFlow id="Flow_0ll5x3u" sourceRef="Activity_1nfx154" targetRef="Event_0vh1hs2" />
     <bpmn:sequenceFlow id="Flow_1x3y2tg" sourceRef="Event_18r5xkz" targetRef="Activity_03dgcg5" />
@@ -80,7 +80,7 @@ nss.prepareTnMhRequest(execution)</bpmn:script>
       <bpmn:linkEventDefinition id="LinkEventDefinition_05sogjc" name="OperationStatusUpdate" />
     </bpmn:intermediateCatchEvent>
     <bpmn:intermediateThrowEvent id="Event_0u9308h" name="Go to start   operation status update">
-      <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming>
+      <bpmn:incoming>Flow_06qv0en</bpmn:incoming>
       <bpmn:linkEventDefinition id="LinkEventDefinition_1o9trjv" name="OperationStatusUpdate" />
     </bpmn:intermediateThrowEvent>
     <bpmn:intermediateCatchEvent id="Event_18r5xkz" name="start TN allocate">
@@ -432,14 +432,7 @@ nss.updateAaiWithRANInstances(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_0ikdlkf" sourceRef="Activity_118je0o" targetRef="Activity_0pa8al6" />
     <bpmn:sequenceFlow id="Flow_1exjm0h" sourceRef="Activity_0pa8al6" targetRef="Gateway_1832fz7" />
-    <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Event_0u9308h" />
-    <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships" scriptFormat="groovy">
-      <bpmn:incoming>Flow_0833cha</bpmn:incoming>
-      <bpmn:outgoing>Flow_1gxbsoi</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def nss = new DoAllocateAccessNSSI()
-nss.updateAairelationships(execution)</bpmn:script>
-    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Activity_1pjf5mm" />
     <bpmn:subProcess id="Activity_0bcs8g1" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
       <bpmn:startEvent id="Event_077lf7i">
         <bpmn:outgoing>Flow_18rrdsq</bpmn:outgoing>
@@ -510,7 +503,6 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="Flow_1k3vqxg" sourceRef="Activity_08i0hzk" targetRef="Activity_1aweui4" />
     <bpmn:sequenceFlow id="Flow_083bb3k" sourceRef="Gateway_1cmraqs" targetRef="Activity_0fdm3in" />
-    <bpmn:sequenceFlow id="Flow_1gxbsoi" sourceRef="Activity_0vf28ld" targetRef="Activity_11vdo22" />
     <bpmn:intermediateThrowEvent id="Event_0lx9qhs" name="Goto start RANNF Allocate">
       <bpmn:incoming>Flow_0rb4j9r</bpmn:incoming>
       <bpmn:linkEventDefinition id="LinkEventDefinition_0s0j5kx" name="startRANNFAllocate" />
@@ -561,11 +553,37 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
     <bpmn:sequenceFlow id="Flow_1ryf352" name="No" sourceRef="Gateway_0rm6svp" targetRef="Event_0f7ueve">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("IsRANNfAlonePresent" )  == true)}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_1pjf5mm" name="update AAI relationships" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming>
+      <bpmn:outgoing>Flow_06qv0en</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.updateAairelationships(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_06qv0en" sourceRef="Activity_1pjf5mm" targetRef="Event_0u9308h" />
   </bpmn:process>
   <bpmn:message id="Message_1r7nv8u" name="WorkflowMessage" />
   <bpmn:error id="Error_047rteq" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_1ryf352_di" bpmnElement="Flow_1ryf352">
+        <di:waypoint x="1270" y="843" />
+        <di:waypoint x="1270" y="865" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1278" y="851" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15uux8j_di" bpmnElement="Flow_15uux8j">
+        <di:waypoint x="1295" y="818" />
+        <di:waypoint x="1392" y="818" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1335" y="800" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1tx240t_di" bpmnElement="Flow_1tx240t">
+        <di:waypoint x="1140" y="818" />
+        <di:waypoint x="1245" y="818" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1f0furp_di" bpmnElement="Flow_1f0furp">
         <di:waypoint x="790" y="120" />
         <di:waypoint x="875" y="120" />
@@ -584,14 +602,24 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
           <dc:Bounds x="970" y="102" width="17" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_024x74t_di" bpmnElement="Flow_024x74t">
+        <di:waypoint x="1350" y="1042" />
+        <di:waypoint x="1350" y="1100" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1358" y="1068" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0d40k12_di" bpmnElement="Flow_0d40k12">
+        <di:waypoint x="1375" y="1017" />
+        <di:waypoint x="1452" y="1017" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1406" y="999" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1eo3bed_di" bpmnElement="Flow_1eo3bed">
         <di:waypoint x="228" y="819" />
         <di:waypoint x="300" y="819" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1gxbsoi_di" bpmnElement="Flow_1gxbsoi">
-        <di:waypoint x="430" y="1440" />
-        <di:waypoint x="490" y="1440" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_083bb3k_di" bpmnElement="Flow_083bb3k">
         <di:waypoint x="790" y="554" />
         <di:waypoint x="790" y="660" />
@@ -604,7 +632,15 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0bd6dhi_di" bpmnElement="Flow_0bd6dhi">
         <di:waypoint x="1620" y="1260" />
-        <di:waypoint x="1722" y="1260" />
+        <di:waypoint x="1690" y="1260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1exjm0h_di" bpmnElement="Flow_1exjm0h">
+        <di:waypoint x="1300" y="1017" />
+        <di:waypoint x="1325" y="1017" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ikdlkf_di" bpmnElement="Flow_0ikdlkf">
+        <di:waypoint x="1170" y="1017" />
+        <di:waypoint x="1200" y="1017" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0fdetmo_di" bpmnElement="Flow_0fdetmo">
         <di:waypoint x="1260" y="1260" />
@@ -691,6 +727,14 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
         <di:waypoint x="410" y="1260" />
         <di:waypoint x="480" y="1260" />
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05yqmnj_di" bpmnElement="Flow_05yqmnj">
+        <di:waypoint x="1030" y="1017" />
+        <di:waypoint x="1070" y="1017" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pbiznt_di" bpmnElement="Flow_1pbiznt">
+        <di:waypoint x="880" y="1017" />
+        <di:waypoint x="930" y="1017" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0kn30g3_di" bpmnElement="Flow_0kn30g3">
         <di:waypoint x="853" y="818" />
         <di:waypoint x="910" y="818" />
@@ -765,64 +809,20 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
         <di:waypoint x="310" y="1260" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0ll5x3u_di" bpmnElement="Flow_0ll5x3u">
-        <di:waypoint x="760" y="1440" />
-        <di:waypoint x="862" y="1440" />
+        <di:waypoint x="580" y="1440" />
+        <di:waypoint x="672" y="1440" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1xw4abx_di" bpmnElement="Flow_1xw4abx">
-        <di:waypoint x="590" y="1440" />
-        <di:waypoint x="660" y="1440" />
+        <di:waypoint x="400" y="1440" />
+        <di:waypoint x="480" y="1440" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0833cha_di" bpmnElement="Flow_0833cha">
         <di:waypoint x="228" y="1440" />
-        <di:waypoint x="330" y="1440" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1tx240t_di" bpmnElement="Flow_1tx240t">
-        <di:waypoint x="1140" y="818" />
-        <di:waypoint x="1245" y="818" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_15uux8j_di" bpmnElement="Flow_15uux8j">
-        <di:waypoint x="1295" y="818" />
-        <di:waypoint x="1392" y="818" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1335" y="800" width="18" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0d40k12_di" bpmnElement="Flow_0d40k12">
-        <di:waypoint x="1375" y="1017" />
-        <di:waypoint x="1452" y="1017" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1406" y="999" width="18" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1pbiznt_di" bpmnElement="Flow_1pbiznt">
-        <di:waypoint x="880" y="1017" />
-        <di:waypoint x="930" y="1017" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_05yqmnj_di" bpmnElement="Flow_05yqmnj">
-        <di:waypoint x="1030" y="1017" />
-        <di:waypoint x="1070" y="1017" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0ikdlkf_di" bpmnElement="Flow_0ikdlkf">
-        <di:waypoint x="1170" y="1017" />
-        <di:waypoint x="1200" y="1017" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1exjm0h_di" bpmnElement="Flow_1exjm0h">
-        <di:waypoint x="1300" y="1017" />
-        <di:waypoint x="1325" y="1017" />
+        <di:waypoint x="300" y="1440" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_024x74t_di" bpmnElement="Flow_024x74t">
-        <di:waypoint x="1350" y="1042" />
-        <di:waypoint x="1350" y="1100" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1358" y="1068" width="15" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1ryf352_di" bpmnElement="Flow_1ryf352">
-        <di:waypoint x="1270" y="843" />
-        <di:waypoint x="1270" y="865" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1278" y="851" width="15" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNEdge id="Flow_06qv0en_di" bpmnElement="Flow_06qv0en">
+        <di:waypoint x="1790" y="1260" />
+        <di:waypoint x="1852" y="1260" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
         <dc:Bounds x="162" y="102" width="36" height="36" />
@@ -836,15 +836,6 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_1gdi5bo_di" bpmnElement="Activity_0vhvubq">
         <dc:Bounds x="1030" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_11vdo22_di" bpmnElement="Activity_11vdo22">
-        <dc:Bounds x="490" y="1400" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1nfx154_di" bpmnElement="Activity_1nfx154">
-        <dc:Bounds x="660" y="1400" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_0vh1hs2_di" bpmnElement="Event_0vh1hs2">
-        <dc:Bounds x="862" y="1422" width="36" height="36" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0icw8wt_di" bpmnElement="Activity_19laorl">
         <dc:Bounds x="300" y="779" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -860,12 +851,6 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
           <dc:Bounds x="174" y="1465" width="73" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1ea1h0i_di" bpmnElement="Event_0u9308h">
-        <dc:Bounds x="1722" y="1242" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1700" y="1290" width="79" height="40" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_1fj3anx_di" bpmnElement="Event_18r5xkz">
         <dc:Bounds x="192" y="1242" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -893,6 +878,12 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
           <dc:Bounds x="1220" y="397" width="79" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_15zn4zi_di" bpmnElement="Event_15zn4zi">
+        <dc:Bounds x="1452" y="999" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1438" y="1042" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1pxd5wf_di" bpmnElement="Activity_1pxd5wf">
         <dc:Bounds x="560" y="780" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -902,6 +893,12 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
           <dc:Bounds x="799" y="765" width="62" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0a95zgv_di" bpmnElement="Activity_0a95zgv">
+        <dc:Bounds x="780" y="977" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_118je0o_di" bpmnElement="Activity_118je0o">
+        <dc:Bounds x="1070" y="977" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_0qwruv5_di" bpmnElement="Event_0s8t1ji">
         <dc:Bounds x="1572" y="102" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -929,6 +926,9 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_0y9xgkl_di" bpmnElement="Activity_0y9xgkl">
         <dc:Bounds x="430" y="780" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0vbzhej_di" bpmnElement="Activity_0vbzhej">
+        <dc:Bounds x="930" y="977" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0zn4e4n_di" bpmnElement="Activity_0zn4e4n">
         <dc:Bounds x="1520" y="1220" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -938,6 +938,9 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_06hcbu6_di" bpmnElement="Activity_06hcbu6">
         <dc:Bounds x="530" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xke4xc_di" bpmnElement="Activity_1aweui4">
+        <dc:Bounds x="1040" y="778" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1bjike9_di" bpmnElement="Activity_1bjike9">
         <dc:Bounds x="530" y="340" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -980,59 +983,26 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_0qpy2sg_di" bpmnElement="Activity_0qpy2sg">
         <dc:Bounds x="1160" y="1220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1riw9uv_di" bpmnElement="Activity_0vf28ld">
-        <dc:Bounds x="330" y="1400" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1cqde7p_di" bpmnElement="Event_1cqde7p">
-        <dc:Bounds x="1392" y="800" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1378" y="843" width="67" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1xke4xc_di" bpmnElement="Activity_1aweui4">
-        <dc:Bounds x="1040" y="778" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_0rm6svp_di" bpmnElement="Gateway_0rm6svp" isMarkerVisible="true">
-        <dc:Bounds x="1245" y="793" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1235" y="763" width="73" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_15zn4zi_di" bpmnElement="Event_15zn4zi">
-        <dc:Bounds x="1452" y="999" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1438" y="1042" width="67" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0a95zgv_di" bpmnElement="Activity_0a95zgv">
-        <dc:Bounds x="780" y="977" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_118je0o_di" bpmnElement="Activity_118je0o">
-        <dc:Bounds x="1070" y="977" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0vbzhej_di" bpmnElement="Activity_0vbzhej">
-        <dc:Bounds x="930" y="977" width="100" height="80" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0pa8al6_di" bpmnElement="Activity_0pa8al6">
         <dc:Bounds x="1200" y="977" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1832fz7_di" bpmnElement="Gateway_1832fz7" isMarkerVisible="true">
-        <dc:Bounds x="1325" y="992" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1313" y="971" width="74" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="Activity_1pjf5mm_di" bpmnElement="Activity_1pjf5mm">
+        <dc:Bounds x="1690" y="1220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_11t655f_di" bpmnElement="Event_11t655f">
-        <dc:Bounds x="1332" y="1100" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_1ea1h0i_di" bpmnElement="Event_0u9308h">
+        <dc:Bounds x="1852" y="1242" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1310" y="1148" width="79" height="40" />
+          <dc:Bounds x="1830" y="1290" width="79" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_0f7ueve_di" bpmnElement="Event_0f7ueve">
-        <dc:Bounds x="1252" y="865" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1230" y="913" width="79" height="40" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="Activity_11vdo22_di" bpmnElement="Activity_11vdo22">
+        <dc:Bounds x="300" y="1400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nfx154_di" bpmnElement="Activity_1nfx154">
+        <dc:Bounds x="480" y="1400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0vh1hs2_di" bpmnElement="Event_0vh1hs2">
+        <dc:Bounds x="672" y="1422" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0bcs8g1_di" bpmnElement="Activity_0bcs8g1" isExpanded="true">
         <dc:Bounds x="390" y="1530" width="781" height="196" />
@@ -1068,6 +1038,12 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_0p0mwue_di" bpmnElement="Activity_0p0mwue">
         <dc:Bounds x="680" y="1594" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1cqde7p_di" bpmnElement="Event_1cqde7p">
+        <dc:Bounds x="1392" y="800" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1378" y="843" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_08i0hzk_di" bpmnElement="Activity_08i0hzk">
         <dc:Bounds x="910" y="778" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -1083,6 +1059,18 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
           <dc:Bounds x="180" y="844" width="63" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1832fz7_di" bpmnElement="Gateway_1832fz7" isMarkerVisible="true">
+        <dc:Bounds x="1325" y="992" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1313" y="971" width="74" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_11t655f_di" bpmnElement="Event_11t655f">
+        <dc:Bounds x="1332" y="1100" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1310" y="1148" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Gateway_0qnxawk_di" bpmnElement="Gateway_0qnxawk" isMarkerVisible="true">
         <dc:Bounds x="875" y="95" width="50" height="50" />
         <bpmndi:BPMNLabel>
@@ -1095,6 +1083,18 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
           <dc:Bounds x="860" y="227" width="81" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0rm6svp_di" bpmnElement="Gateway_0rm6svp" isMarkerVisible="true">
+        <dc:Bounds x="1245" y="793" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1235" y="763" width="73" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0f7ueve_di" bpmnElement="Event_0f7ueve">
+        <dc:Bounds x="1252" y="865" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1230" y="913" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index b70569b..fb03f6f 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0">
   <bpmn:process id="DoAllocateTransportNSSI" name="DoAllocateTransportNSSI" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Allocate TN NSSMF Work Flow">
       <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
     </bpmn:startEvent>
     <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="OOF TN NSSI Selection">
-      <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing>
+      <bpmn:outgoing>Flow_071hnt4</bpmn:outgoing>
       <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="OofTnNssiSelect" />
     </bpmn:intermediateCatchEvent>
     <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
@@ -22,7 +22,7 @@ css.preProcessRequest(execution)</bpmn:script>
 def css = new TnAllocateNssi()
 css.processOofSelection(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Use Existing TN NSSI?" default="SequenceFlow_038lb9m">
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Use Existing TN NSSI?">
       <bpmn:incoming>SequenceFlow_197cm2e</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing>
       <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing>
@@ -73,7 +73,7 @@ runScript.prepareUpdateJobStatus(execution,"INPROGRESS","10","Allocate TN NSSI s
     </bpmn:scriptTask>
     <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection">
       <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
-      <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="TnAllocateNssi" />
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="OofTnNssiSelect" />
     </bpmn:intermediateThrowEvent>
     <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
@@ -102,7 +102,7 @@ def runScript = new TnAllocateNssi()
 runScript.prepareDecomposeService(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare OOF TN NSSI Selection" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming>
+      <bpmn:incoming>Flow_0nu9t8e</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def css = new TnAllocateNssi()
@@ -117,7 +117,7 @@ css.prepareOofSelection(execution)</bpmn:script>
       <bpmn:linkEventDefinition id="LinkEventDefinition_16f2ri9" name="TnAllocateNssi" />
     </bpmn:intermediateThrowEvent>
     <bpmn:endEvent id="EndEvent_1oouvuh" name="End">
-      <bpmn:incoming>Flow_0pbq5q0</bpmn:incoming>
+      <bpmn:incoming>Flow_13ikwvr</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoCreateTnNssiInstance&#10;" calledElement="DoCreateTnNssiInstance">
       <bpmn:extensionElements>
@@ -146,9 +146,11 @@ css.prepareOofSelection(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="Activity_187hs2t" targetRef="ScriptTask_1jgtb0y" />
     <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" />
     <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="No" sourceRef="ExclusiveGateway_0elbczl" targetRef="IntermediateThrowEvent_0ktwpki">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isOofTnNssiSelected")  == false)}</bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isOofTnNssiSelected") == false}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="Yes" sourceRef="ExclusiveGateway_0elbczl" targetRef="Activity_07jtiau">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isOofTnNssiSelected") == true}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="Yes" sourceRef="ExclusiveGateway_0elbczl" targetRef="Activity_1mh10j4" />
     <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" />
     <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" />
     <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" />
@@ -160,7 +162,6 @@ css.prepareOofSelection(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" />
     <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="Activity_187hs2t" />
     <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" />
-    <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_08wim95" />
     <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" />
     <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
@@ -171,14 +172,6 @@ def runScript = new TnAllocateNssi()
 runScript.updateAAIOrchStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
-    <bpmn:scriptTask id="Activity_1mh10j4" name="Prepare Update Resource Oper Status(finish)" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming>
-      <bpmn:outgoing>Flow_1853sgs</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def runScript = new TnAllocateNssi()
-runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI successfully")</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1853sgs" sourceRef="Activity_1mh10j4" targetRef="Activity_124z7q2" />
     <bpmn:callActivity id="Activity_187hs2t" name="Handle TN NSSI Selection OOF request" calledElement="DoHandleOofRequest">
       <bpmn:extensionElements>
         <camunda:in source="nssiSelection_Url" target="apiPath" />
@@ -192,29 +185,6 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
       <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:serviceTask id="Activity_124z7q2" name="Update Resource Operation Status">
-      <bpmn:extensionElements>
-        <camunda:connector>
-          <camunda:inputOutput>
-            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
-            <camunda:inputParameter name="headers">
-              <camunda:map>
-                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
-              </camunda:map>
-            </camunda:inputParameter>
-            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
-            <camunda:inputParameter name="method">POST</camunda:inputParameter>
-            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
-            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
-          </camunda:inputOutput>
-          <camunda:connectorId>http-connector</camunda:connectorId>
-        </camunda:connector>
-      </bpmn:extensionElements>
-      <bpmn:incoming>Flow_1853sgs</bpmn:incoming>
-      <bpmn:outgoing>Flow_0pbq5q0</bpmn:outgoing>
-    </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="Flow_0pbq5q0" sourceRef="Activity_124z7q2" targetRef="EndEvent_1oouvuh" />
     <bpmn:serviceTask id="Activity_14an583" name="Update Resource Operation Status">
       <bpmn:extensionElements>
         <camunda:connector>
@@ -261,12 +231,125 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
       <bpmn:outgoing>Flow_06rrcwf</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:sequenceFlow id="Flow_06rrcwf" sourceRef="Activity_1xko5pk" targetRef="EndEvent_05h01gx" />
+    <bpmn:exclusiveGateway id="Gateway_08t9sts" name="Enable OOF?">
+      <bpmn:incoming>Flow_071hnt4</bpmn:incoming>
+      <bpmn:outgoing>Flow_0nu9t8e</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0tz6v1f</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0nu9t8e" name="yes" sourceRef="Gateway_08t9sts" targetRef="ScriptTask_08wim95">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("enableOof") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_071hnt4" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="Gateway_08t9sts" />
+    <bpmn:sequenceFlow id="Flow_0tz6v1f" name="No" sourceRef="Gateway_08t9sts" targetRef="Event_0uq2hsq" />
+    <bpmn:intermediateThrowEvent id="Event_0uq2hsq" name="Goto Allocate TN NSSI">
+      <bpmn:incoming>Flow_0tz6v1f</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0xfqvfe" name="TnAllocateNssi" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_07jtiau" name="prepare Modify Tn NSSI inputs" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming>
+      <bpmn:outgoing>Flow_10etjmr</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.prepareModifyTnNssiInputs(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1mw6mcq" name="call DoModifyTransportNSSI" calledElement="DoModifyTransportNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="TnServiceInstanceId" target="serviceInstanceID" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="networkType" target="networkType" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" />
+        <camunda:in source="jobId" target="jobId" />
+        <camunda:in source="modifySliceParams" target="sliceParams" />
+        <camunda:in source="servicename" target="servicename" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+        <camunda:in source="modelUuid" target="modelUuid" />
+        <camunda:in source="operationType" target="operationType" />
+        <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_10etjmr</bpmn:incoming>
+      <bpmn:outgoing>Flow_01bdm61</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0wllwek" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_01bdm61</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tvh0t6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.createModifyNssiQueryJobStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_10etjmr" sourceRef="Activity_07jtiau" targetRef="Activity_1mw6mcq" />
+    <bpmn:sequenceFlow id="Flow_01bdm61" sourceRef="Activity_1mw6mcq" targetRef="Activity_0wllwek" />
+    <bpmn:callActivity id="Activity_0wx2ah5" name="Query Job status" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="modifyTnNssiJobId" target="jobId" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+        <camunda:out source="responseDescriptor" target="jobResponse" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="esrInfo" target="esrInfo" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0tvh0t6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rt0mvl</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0tvh0t6" sourceRef="Activity_0wllwek" targetRef="Activity_0wx2ah5" />
+    <bpmn:scriptTask id="Activity_1hhcncj" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0rt0mvl</bpmn:incoming>
+      <bpmn:outgoing>Flow_13ikwvr</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.processModifyJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0rt0mvl" sourceRef="Activity_0wx2ah5" targetRef="Activity_1hhcncj" />
+    <bpmn:sequenceFlow id="Flow_13ikwvr" sourceRef="Activity_1hhcncj" targetRef="EndEvent_1oouvuh" />
   </bpmn:process>
   <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
   <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_13ikwvr_di" bpmnElement="Flow_13ikwvr">
+        <di:waypoint x="1380" y="490" />
+        <di:waypoint x="1452" y="490" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rt0mvl_di" bpmnElement="Flow_0rt0mvl">
+        <di:waypoint x="1240" y="490" />
+        <di:waypoint x="1280" y="490" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tvh0t6_di" bpmnElement="Flow_0tvh0t6">
+        <di:waypoint x="1110" y="490" />
+        <di:waypoint x="1140" y="490" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01bdm61_di" bpmnElement="Flow_01bdm61">
+        <di:waypoint x="960" y="490" />
+        <di:waypoint x="1010" y="490" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10etjmr_di" bpmnElement="Flow_10etjmr">
+        <di:waypoint x="800" y="490" />
+        <di:waypoint x="860" y="490" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tz6v1f_di" bpmnElement="Flow_0tz6v1f">
+        <di:waypoint x="320" y="355" />
+        <di:waypoint x="320" y="440" />
+        <di:waypoint x="342" y="440" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="328" y="395" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_071hnt4_di" bpmnElement="Flow_071hnt4">
+        <di:waypoint x="214" y="330" />
+        <di:waypoint x="295" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0nu9t8e_di" bpmnElement="Flow_0nu9t8e">
+        <di:waypoint x="345" y="330" />
+        <di:waypoint x="463" y="330" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="395" y="312" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_06rrcwf_di" bpmnElement="Flow_06rrcwf">
         <di:waypoint x="1140" y="680" />
         <di:waypoint x="1252" y="680" />
@@ -275,14 +358,6 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
         <di:waypoint x="750" y="121" />
         <di:waypoint x="850" y="121" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0pbq5q0_di" bpmnElement="Flow_0pbq5q0">
-        <di:waypoint x="1460" y="500" />
-        <di:waypoint x="1562" y="500" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1853sgs_di" bpmnElement="Flow_1853sgs">
-        <di:waypoint x="1270" y="500" />
-        <di:waypoint x="1360" y="500" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
         <di:waypoint x="770" y="680" />
         <di:waypoint x="860" y="680" />
@@ -291,17 +366,13 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
         <di:waypoint x="1420" y="121" />
         <di:waypoint x="1532" y="121" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
-        <di:waypoint x="214" y="330" />
-        <di:waypoint x="320" y="330" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
         <di:waypoint x="228" y="680" />
         <di:waypoint x="320" y="680" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
-        <di:waypoint x="420" y="330" />
-        <di:waypoint x="540" y="330" />
+        <di:waypoint x="563" y="330" />
+        <di:waypoint x="630" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
         <di:waypoint x="950" y="121" />
@@ -338,26 +409,27 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
         <di:waypoint x="1320" y="121" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
-        <di:waypoint x="1090" y="355" />
-        <di:waypoint x="1090" y="500" />
-        <di:waypoint x="1170" y="500" />
+        <di:waypoint x="970" y="355" />
+        <di:waypoint x="970" y="400" />
+        <di:waypoint x="740" y="400" />
+        <di:waypoint x="740" y="450" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1100" y="413" width="19" height="14" />
+          <dc:Bounds x="981" y="368" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
-        <di:waypoint x="1115" y="330" />
-        <di:waypoint x="1292" y="330" />
+        <di:waypoint x="995" y="330" />
+        <di:waypoint x="1092" y="330" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1183" y="313" width="14" height="14" />
+          <dc:Bounds x="1029" y="313" width="15" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
         <di:waypoint x="890" y="330" />
-        <di:waypoint x="1065" y="330" />
+        <di:waypoint x="945" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
-        <di:waypoint x="640" y="330" />
+        <di:waypoint x="730" y="330" />
         <di:waypoint x="790" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
@@ -387,9 +459,9 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
         <dc:Bounds x="790" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true">
-        <dc:Bounds x="1065" y="305" width="50" height="50" />
+        <dc:Bounds x="945" y="305" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1050" y="276" width="79" height="27" />
+          <dc:Bounds x="930" y="276" width="79" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
@@ -404,6 +476,15 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
       <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw">
         <dc:Bounds x="495" y="762" width="36" height="36" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
+        <dc:Bounds x="1452" y="472" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1460" y="515" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0wllwek_di" bpmnElement="Activity_0wllwek">
+        <dc:Bounds x="1010" y="450" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
         <dc:Bounds x="685" y="1080" width="781" height="196" />
       </bpmndi:BPMNShape>
@@ -449,7 +530,7 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
         <dc:Bounds x="850" y="81" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95">
-        <dc:Bounds x="320" y="290" width="100" height="80" />
+        <dc:Bounds x="463" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun">
         <dc:Bounds x="192" y="662" width="36" height="36" />
@@ -458,15 +539,9 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki">
-        <dc:Bounds x="1292" y="312" width="36" height="36" />
+        <dc:Bounds x="1092" y="312" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1280" y="353" width="84" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
-        <dc:Bounds x="1562" y="482" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1570" y="525" width="20" height="14" />
+          <dc:Bounds x="1080" y="353" width="84" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i">
@@ -475,14 +550,8 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
       <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
         <dc:Bounds x="670" y="640" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1mh10j4_di" bpmnElement="Activity_1mh10j4">
-        <dc:Bounds x="1170" y="460" width="100" height="80" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_187hs2t_di" bpmnElement="Activity_187hs2t">
-        <dc:Bounds x="540" y="290" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_124z7q2_di" bpmnElement="Activity_124z7q2">
-        <dc:Bounds x="1360" y="460" width="100" height="80" />
+        <dc:Bounds x="630" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_14an583_di" bpmnElement="Activity_14an583">
         <dc:Bounds x="650" y="81" width="100" height="80" />
@@ -490,6 +559,30 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s
       <bpmndi:BPMNShape id="Activity_1xko5pk_di" bpmnElement="Activity_1xko5pk">
         <dc:Bounds x="1040" y="640" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_08t9sts_di" bpmnElement="Gateway_08t9sts" isMarkerVisible="true">
+        <dc:Bounds x="295" y="305" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="290" y="275" width="68" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ltl0tk_di" bpmnElement="Event_0uq2hsq">
+        <dc:Bounds x="342" y="422" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="318" y="465" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07jtiau_di" bpmnElement="Activity_07jtiau">
+        <dc:Bounds x="700" y="450" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1mw6mcq_di" bpmnElement="Activity_1mw6mcq">
+        <dc:Bounds x="860" y="450" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0wx2ah5_di" bpmnElement="Activity_0wx2ah5">
+        <dc:Bounds x="1140" y="450" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hhcncj_di" bpmnElement="Activity_1hhcncj">
+        <dc:Bounds x="1280" y="450" width="100" height="80" />
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index ae81364..513f715 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_17amn3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_17amn3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0">
   <bpmn:process id="DoDeallocateAccessNSSI" name="DoDeallocateAccessNSSI" isExecutable="true">
     <bpmn:startEvent id="Event_0seox25" name="Start">
       <bpmn:outgoing>Flow_14g5p2j</bpmn:outgoing>
@@ -623,13 +623,14 @@ deallocator.deleteRanNfSliceProfileInAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="Activity_03zg1pp" name="Delete TN Slice profiles" scriptFormat="groovy">
       <bpmn:incoming>Flow_12wqmdr</bpmn:incoming>
-      <bpmn:outgoing>Flow_15ok12u</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0kuminm</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def deallocator = new DoDeAllocateAccessNSSI()
 deallocator.deleteTNSliceProfileInAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="Activity_1ri9jrn" name="Delete RAN NSSI" scriptFormat="groovy">
-      <bpmn:incoming>Flow_183aijy</bpmn:incoming>
+      <bpmn:incoming>Flow_0kuminm</bpmn:incoming>
+      <bpmn:incoming>Flow_0e6ug2u</bpmn:incoming>
       <bpmn:outgoing>Flow_1nh3x4j</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def deallocator = new DoDeAllocateAccessNSSI()
@@ -638,7 +639,7 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
     <bpmn:callActivity id="Activity_0umktii" name="Modify RAN NF NSSI" calledElement="DoModifyRanNfNssi">
       <bpmn:extensionElements>
         <camunda:in source="anNfNssiId" target="serviceInstanceID" />
-        <camunda:in source="anNfSliceProfileId" target="SliceProfileId" />
+        <camunda:in source="anNfSliceProfileId" target="sliceProfileId" />
         <camunda:in source="msoRequestId" target="msoRequestId" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
@@ -693,23 +694,53 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
     <bpmn:exclusiveGateway id="Gateway_11aiy0x" name="Is TN present?" default="Flow_12wqmdr">
       <bpmn:incoming>Flow_0412ven</bpmn:incoming>
       <bpmn:outgoing>Flow_12wqmdr</bpmn:outgoing>
-      <bpmn:outgoing>Flow_0r8ldai</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0e6ug2u</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:sequenceFlow id="Flow_12wqmdr" name="Yes" sourceRef="Gateway_11aiy0x" targetRef="Activity_03zg1pp" />
-    <bpmn:sequenceFlow id="Flow_0r8ldai" name="No" sourceRef="Gateway_11aiy0x" targetRef="Gateway_187nc60">
+    <bpmn:sequenceFlow id="Flow_0kuminm" sourceRef="Activity_03zg1pp" targetRef="Activity_1ri9jrn" />
+    <bpmn:sequenceFlow id="Flow_0e6ug2u" sourceRef="Gateway_11aiy0x" targetRef="Activity_1ri9jrn">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("IsRANNfAlonePresent" )  == true)}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="Flow_183aijy" sourceRef="Gateway_187nc60" targetRef="Activity_1ri9jrn" />
-    <bpmn:parallelGateway id="Gateway_187nc60">
-      <bpmn:incoming>Flow_0r8ldai</bpmn:incoming>
-      <bpmn:incoming>Flow_15ok12u</bpmn:incoming>
-      <bpmn:outgoing>Flow_183aijy</bpmn:outgoing>
-    </bpmn:parallelGateway>
-    <bpmn:sequenceFlow id="Flow_15ok12u" sourceRef="Activity_03zg1pp" targetRef="Gateway_187nc60" />
   </bpmn:process>
   <bpmn:error id="Error_0i5gql0" name="DeallocateWorkflowError" errorCode="2500" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_12wqmdr_di" bpmnElement="Flow_12wqmdr">
+        <di:waypoint x="460" y="1135" />
+        <di:waypoint x="460" y="1260" />
+        <di:waypoint x="570" y="1260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="466" y="1199" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1scubfn_di" bpmnElement="Flow_1scubfn">
+        <di:waypoint x="2460" y="435" />
+        <di:waypoint x="2460" y="482" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2468" y="456" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01ssl7f_di" bpmnElement="Flow_01ssl7f">
+        <di:waypoint x="2485" y="410" />
+        <di:waypoint x="2552" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2510" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yewqtt_di" bpmnElement="Flow_1yewqtt">
+        <di:waypoint x="2260" y="265" />
+        <di:waypoint x="2260" y="282" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2268" y="271" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0b3qqvw_di" bpmnElement="Flow_0b3qqvw">
+        <di:waypoint x="2285" y="240" />
+        <di:waypoint x="2362" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2315" y="222" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0x71rer_di" bpmnElement="Flow_0x71rer">
         <di:waypoint x="1275" y="650" />
         <di:waypoint x="1320" y="650" />
@@ -976,58 +1007,15 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
         <di:waypoint x="238" y="410" />
         <di:waypoint x="290" y="410" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0b3qqvw_di" bpmnElement="Flow_0b3qqvw">
-        <di:waypoint x="2285" y="240" />
-        <di:waypoint x="2362" y="240" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2315" y="222" width="18" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1yewqtt_di" bpmnElement="Flow_1yewqtt">
-        <di:waypoint x="2260" y="265" />
-        <di:waypoint x="2260" y="282" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2268" y="271" width="15" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_01ssl7f_di" bpmnElement="Flow_01ssl7f">
-        <di:waypoint x="2485" y="410" />
-        <di:waypoint x="2552" y="410" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2510" y="392" width="18" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1scubfn_di" bpmnElement="Flow_1scubfn">
-        <di:waypoint x="2460" y="435" />
-        <di:waypoint x="2460" y="482" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2468" y="456" width="15" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_12wqmdr_di" bpmnElement="Flow_12wqmdr">
-        <di:waypoint x="460" y="1135" />
-        <di:waypoint x="460" y="1260" />
-        <di:waypoint x="520" y="1260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="466" y="1199" width="18" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNEdge id="Flow_0kuminm_di" bpmnElement="Flow_0kuminm">
+        <di:waypoint x="670" y="1260" />
+        <di:waypoint x="790" y="1260" />
+        <di:waypoint x="790" y="1150" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0r8ldai_di" bpmnElement="Flow_0r8ldai">
+      <bpmndi:BPMNEdge id="Flow_0e6ug2u_di" bpmnElement="Flow_0e6ug2u">
         <di:waypoint x="485" y="1110" />
-        <di:waypoint x="655" y="1110" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="589" y="1092" width="15" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_183aijy_di" bpmnElement="Flow_183aijy">
-        <di:waypoint x="705" y="1110" />
         <di:waypoint x="740" y="1110" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_15ok12u_di" bpmnElement="Flow_15ok12u">
-        <di:waypoint x="620" y="1260" />
-        <di:waypoint x="680" y="1260" />
-        <di:waypoint x="680" y="1135" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="Event_0seox25_di" bpmnElement="Event_0seox25">
         <dc:Bounds x="202" y="392" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -1046,6 +1034,12 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Gateway_1ypyzn3_di" bpmnElement="Gateway_1ypyzn3" isMarkerVisible="true">
         <dc:Bounds x="1265" y="385" width="50" height="50" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1dvx4n9_di" bpmnElement="Event_0vthuwp">
+        <dc:Bounds x="2552" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2530" y="438" width="81" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_1ekryu8_di" bpmnElement="Event_0opsm2p">
         <dc:Bounds x="202" y="862" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -1067,6 +1061,12 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_1h4jup8_di" bpmnElement="Activity_0gzrekf">
         <dc:Bounds x="1100" y="370" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18fpd51_di" bpmnElement="Event_18fpd51">
+        <dc:Bounds x="2362" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2340" y="268" width="81" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0m43umg_di" bpmnElement="Activity_1v1ra2k">
         <dc:Bounds x="2280" y="370" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -1112,59 +1112,8 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_1i9b3oi_di" bpmnElement="Activity_114fx71">
         <dc:Bounds x="1330" y="840" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_18fpd51_di" bpmnElement="Event_18fpd51">
-        <dc:Bounds x="2362" y="222" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2340" y="268" width="81" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1dvx4n9_di" bpmnElement="Event_0vthuwp">
-        <dc:Bounds x="2552" y="392" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2530" y="438" width="81" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_0jjou51_di" bpmnElement="Gateway_0jjou51" isMarkerVisible="true">
-        <dc:Bounds x="2235" y="215" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2224" y="185" width="73" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_05q1nj2_di" bpmnElement="Event_05q1nj2">
-        <dc:Bounds x="2242" y="282" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2218" y="328" width="90" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_0qsknv5_di" bpmnElement="Gateway_0qsknv5" isMarkerVisible="true">
-        <dc:Bounds x="2435" y="385" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2423" y="361" width="73" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_0y39bzp_di" bpmnElement="Event_0y39bzp">
-        <dc:Bounds x="2442" y="482" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="2418" y="528" width="90" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0r4899a_di" bpmnElement="Activity_0qho4pw">
-        <dc:Bounds x="290" y="1070" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_11aiy0x_di" bpmnElement="Gateway_11aiy0x" isMarkerVisible="true">
-        <dc:Bounds x="435" y="1085" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="424" y="1055" width="73" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0b0pl0x_di" bpmnElement="Activity_03zg1pp">
-        <dc:Bounds x="520" y="1220" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0dreslj_di" bpmnElement="Activity_1ri9jrn">
-        <dc:Bounds x="740" y="1070" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_10923hr_di" bpmnElement="Gateway_187nc60">
-        <dc:Bounds x="655" y="1085" width="50" height="50" />
+        <dc:Bounds x="570" y="1220" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0qbd3cz_di" bpmnElement="Activity_0qbd3cz" isExpanded="true">
         <dc:Bounds x="820" y="1310" width="770" height="170" />
@@ -1331,6 +1280,12 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
           <dc:Bounds x="189" y="1135" width="62" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0r4899a_di" bpmnElement="Activity_0qho4pw">
+        <dc:Bounds x="290" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0dreslj_di" bpmnElement="Activity_1ri9jrn">
+        <dc:Bounds x="740" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_01s2lve_di" bpmnElement="Activity_0umktii">
         <dc:Bounds x="1400" y="200" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -1343,6 +1298,36 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Event_1m6hsxq_di" bpmnElement="Event_161u9s2">
         <dc:Bounds x="1822" y="82" width="36" height="36" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0jjou51_di" bpmnElement="Gateway_0jjou51" isMarkerVisible="true">
+        <dc:Bounds x="2235" y="215" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2224" y="185" width="73" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_05q1nj2_di" bpmnElement="Event_05q1nj2">
+        <dc:Bounds x="2242" y="282" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2218" y="328" width="90" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0qsknv5_di" bpmnElement="Gateway_0qsknv5" isMarkerVisible="true">
+        <dc:Bounds x="2435" y="385" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2423" y="361" width="73" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0y39bzp_di" bpmnElement="Event_0y39bzp">
+        <dc:Bounds x="2442" y="482" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2418" y="528" width="90" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_11aiy0x_di" bpmnElement="Gateway_11aiy0x" isMarkerVisible="true">
+        <dc:Bounds x="435" y="1085" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="423.5" y="1061" width="73" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 1dd362b..4897850 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0">
   <bpmn:process id="DoDeallocateTransportNSSI" name="DoDeallocateTransportNSSI" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Deallocate TN NSSMF Work Flow">
       <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
@@ -26,7 +26,7 @@ ex.processJavaException(execution)</bpmn:script>
       <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming>
+      <bpmn:incoming>Flow_14tkuoh</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def runScript = new DoDeallocateTnNssi()
@@ -69,7 +69,7 @@ runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script>
     <bpmn:scriptTask id="Activity_013rjwc" name="Delete Service Instance (TN NSSI) in AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
       <bpmn:incoming>Flow_0dirb5b</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1jygjln</bpmn:outgoing>
+      <bpmn:outgoing>Flow_14pzrs9</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def runScript = new DoDeallocateTnNssi()
 runScript.deleteServiceInstance(execution)</bpmn:script>
@@ -77,13 +77,11 @@ runScript.deleteServiceInstance(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_013rjwc" />
     <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1xxj5g6</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def runScript = new DoDeallocateTnNssi()
 runScript.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_1spi9lo" />
-    <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_1ssh2l9" />
     <bpmn:serviceTask id="Activity_0rgeefb" name="Update Resource Operation Status">
       <bpmn:extensionElements>
         <camunda:connector>
@@ -108,7 +106,7 @@ runScript.preProcessRequest(execution)</bpmn:script>
     </bpmn:serviceTask>
     <bpmn:sequenceFlow id="Flow_0ca4l8d" sourceRef="Activity_0rgeefb" targetRef="EndEvent_05h01gx" />
     <bpmn:exclusiveGateway id="Gateway_1spi9lo" name="Enable SDNC?">
-      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:incoming>Flow_08so17j</bpmn:incoming>
       <bpmn:outgoing>Flow_0sj0mtu</bpmn:outgoing>
       <bpmn:outgoing>Flow_0dirb5b</bpmn:outgoing>
     </bpmn:exclusiveGateway>
@@ -116,119 +114,281 @@ runScript.preProcessRequest(execution)</bpmn:script>
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" )  == true)}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:sequenceFlow id="Flow_0dirb5b" name="No" sourceRef="Gateway_1spi9lo" targetRef="Activity_013rjwc" />
+    <bpmn:exclusiveGateway id="Gateway_0evcwr8" name="Enable OOF?" default="Flow_0buil9w">
+      <bpmn:incoming>Flow_1xxj5g6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0elnhnt</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0buil9w</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:exclusiveGateway id="Gateway_0m3yrzp" name="Terminate Tn NSSI?" default="Flow_1oxjcb2">
+      <bpmn:incoming>Flow_18xmkvl</bpmn:incoming>
+      <bpmn:outgoing>Flow_1oxjcb2</bpmn:outgoing>
+      <bpmn:outgoing>Flow_083usqs</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1xxj5g6" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_0evcwr8" />
+    <bpmn:scriptTask id="Activity_0tw406b" name="Prepare OOF Terminate TN NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0elnhnt</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yadxwl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeallocateTnNssi()
+deallocator.prepareOOFNssiTerminationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0ztykbe" name="Call OOF flow for TN termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1yadxwl</bpmn:incoming>
+      <bpmn:outgoing>Flow_18xmkvl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeallocateTnNssi()
+deallocator.performOofNSSITerminationCall(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0elnhnt" name="Yes" sourceRef="Gateway_0evcwr8" targetRef="Activity_0tw406b">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("enableOof") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1yadxwl" sourceRef="Activity_0tw406b" targetRef="Activity_0ztykbe" />
+    <bpmn:intermediateCatchEvent id="Event_0ypmuow" name="Start operation status update">
+      <bpmn:outgoing>Flow_14tkuoh</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0sxzf9o" name="OperationStatusUpdate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_14tkuoh" sourceRef="Event_0ypmuow" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:intermediateThrowEvent id="Event_0c3sko9" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_14pzrs9</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1qixrye" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_14pzrs9" sourceRef="Activity_013rjwc" targetRef="Event_0c3sko9" />
+    <bpmn:intermediateThrowEvent id="Event_0l28lqi" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_1oxjcb2</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0rexbo3" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_18xmkvl" sourceRef="Activity_0ztykbe" targetRef="Gateway_0m3yrzp" />
+    <bpmn:sequenceFlow id="Flow_1oxjcb2" name="No" sourceRef="Gateway_0m3yrzp" targetRef="Event_0l28lqi" />
+    <bpmn:intermediateThrowEvent id="Event_01bin3l" name="Go to deallocate TN nssi">
+      <bpmn:incoming>Flow_083usqs</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1tnxmki" name="DeAllocateTnNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_083usqs" name="Yes" sourceRef="Gateway_0m3yrzp" targetRef="Event_01bin3l">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("terminateTnNSSI") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateCatchEvent id="Event_0a5fzwt" name="Start deallocate TN nssi">
+      <bpmn:outgoing>Flow_08so17j</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_11dpw4b" name="DeAllocateTnNSSI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_08so17j" sourceRef="Event_0a5fzwt" targetRef="Gateway_1spi9lo" />
+    <bpmn:intermediateThrowEvent id="Event_06m6kud" name="Go to deallocate TN nssi">
+      <bpmn:incoming>Flow_0buil9w</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_02jveqm" name="DeAllocateTnNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0buil9w" name="No" sourceRef="Gateway_0evcwr8" targetRef="Event_06m6kud" />
   </bpmn:process>
   <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
   <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateTransportNSSI">
-      <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d">
-        <di:waypoint x="1030" y="410" />
-        <di:waypoint x="1152" y="410" />
+      <bpmndi:BPMNEdge id="Flow_0dirb5b_di" bpmnElement="Flow_0dirb5b">
+        <di:waypoint x="350" y="496" />
+        <di:waypoint x="350" y="680" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="353" y="511" width="15" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln">
-        <di:waypoint x="530" y="410" />
-        <di:waypoint x="660" y="410" />
+      <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu">
+        <di:waypoint x="375" y="471" />
+        <di:waypoint x="439" y="471" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="400" y="453" width="18" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
-        <di:waypoint x="385" y="121" />
-        <di:waypoint x="455" y="121" />
+      <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d">
+        <di:waypoint x="570" y="910" />
+        <di:waypoint x="662" y="910" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
-        <di:waypoint x="1130" y="121" />
-        <di:waypoint x="1220" y="121" />
-        <di:waypoint x="1220" y="260" />
-        <di:waypoint x="480" y="260" />
-        <di:waypoint x="480" y="370" />
+        <di:waypoint x="1000" y="471" />
+        <di:waypoint x="1090" y="471" />
+        <di:waypoint x="1090" y="610" />
+        <di:waypoint x="350" y="610" />
+        <di:waypoint x="350" y="680" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
-        <di:waypoint x="910" y="121" />
-        <di:waypoint x="1009" y="121" />
+        <di:waypoint x="780" y="471" />
+        <di:waypoint x="879" y="471" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
-        <di:waypoint x="690" y="121" />
-        <di:waypoint x="789" y="121" />
+        <di:waypoint x="560" y="471" />
+        <di:waypoint x="659" y="471" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
-        <di:waypoint x="760" y="410" />
-        <di:waypoint x="930" y="410" />
+        <di:waypoint x="400" y="910" />
+        <di:waypoint x="470" y="910" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
-        <di:waypoint x="214" y="121" />
-        <di:waypoint x="285" y="121" />
+        <di:waypoint x="208" y="140" />
+        <di:waypoint x="280" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu">
-        <di:waypoint x="505" y="121" />
-        <di:waypoint x="569" y="121" />
+      <bpmndi:BPMNEdge id="Flow_1xxj5g6_di" bpmnElement="Flow_1xxj5g6">
+        <di:waypoint x="380" y="140" />
+        <di:waypoint x="445" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0elnhnt_di" bpmnElement="Flow_0elnhnt">
+        <di:waypoint x="495" y="140" />
+        <di:waypoint x="570" y="140" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="529" y="103" width="19" height="14" />
+          <dc:Bounds x="524" y="122" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0dirb5b_di" bpmnElement="Flow_0dirb5b">
-        <di:waypoint x="480" y="146" />
-        <di:waypoint x="480" y="370" />
+      <bpmndi:BPMNEdge id="Flow_1yadxwl_di" bpmnElement="Flow_1yadxwl">
+        <di:waypoint x="670" y="140" />
+        <di:waypoint x="750" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14tkuoh_di" bpmnElement="Flow_14tkuoh">
+        <di:waypoint x="208" y="910" />
+        <di:waypoint x="300" y="910" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14pzrs9_di" bpmnElement="Flow_14pzrs9">
+        <di:waypoint x="400" y="720" />
+        <di:waypoint x="502" y="720" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18xmkvl_di" bpmnElement="Flow_18xmkvl">
+        <di:waypoint x="850" y="140" />
+        <di:waypoint x="921" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1oxjcb2_di" bpmnElement="Flow_1oxjcb2">
+        <di:waypoint x="946" y="165" />
+        <di:waypoint x="946" y="260" />
+        <di:waypoint x="1062" y="260" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="483" y="166" width="14" height="14" />
+          <dc:Bounds x="954" y="210" width="15" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
-        <dc:Bounds x="178" y="103" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_083usqs_di" bpmnElement="Flow_083usqs">
+        <di:waypoint x="971" y="140" />
+        <di:waypoint x="1062" y="140" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="166" y="146" width="70" height="53" />
+          <dc:Bounds x="1008" y="122" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_08so17j_di" bpmnElement="Flow_08so17j">
+        <di:waypoint x="208" y="471" />
+        <di:waypoint x="325" y="471" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0buil9w_di" bpmnElement="Flow_0buil9w">
+        <di:waypoint x="470" y="165" />
+        <di:waypoint x="470" y="250" />
+        <di:waypoint x="532" y="250" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="478" y="205" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0ypmuow_di" bpmnElement="Event_0ypmuow">
+        <dc:Bounds x="172" y="892" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="154" y="935" width="73" height="27" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
-        <dc:Bounds x="660" y="370" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc">
-        <dc:Bounds x="430" y="370" width="100" height="80" />
+        <dc:Bounds x="300" y="680" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="300" y="870" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb">
-        <dc:Bounds x="930" y="370" width="100" height="80" />
+        <dc:Bounds x="470" y="870" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
-        <dc:Bounds x="1152" y="392" width="36" height="36" />
+        <dc:Bounds x="662" y="892" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1160" y="435" width="20" height="14" />
+          <dc:Bounds x="670" y="935" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
-        <dc:Bounds x="569" y="74" width="121" height="94" />
+      <bpmndi:BPMNShape id="Event_0c3sko9_di" bpmnElement="Event_0c3sko9">
+        <dc:Bounds x="502" y="702" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="480" y="750" width="79" height="40" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true">
-        <dc:Bounds x="455" y="96" width="50" height="50" />
+      <bpmndi:BPMNShape id="Event_0a5fzwt_di" bpmnElement="Event_0a5fzwt">
+        <dc:Bounds x="172" y="453" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="152" y="496" width="77" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0evcwr8_di" bpmnElement="Gateway_0evcwr8" isMarkerVisible="true">
+        <dc:Bounds x="445" y="115" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="437" y="92" width="68" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_06m6kud_di" bpmnElement="Event_06m6kud">
+        <dc:Bounds x="532" y="232" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="443" y="73" width="75" height="14" />
+          <dc:Bounds x="509" y="280" width="81" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="280" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="172" y="122" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="160" y="165" width="70" height="53" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+        <dc:Bounds x="439" y="424" width="121" height="94" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
-        <dc:Bounds x="789" y="74" width="121" height="94" />
+        <dc:Bounds x="659" y="424" width="121" height="94" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
-        <dc:Bounds x="1009" y="74" width="121" height="94" />
+        <dc:Bounds x="879" y="424" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true">
+        <dc:Bounds x="325" y="446" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="313" y="423" width="75" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_01bin3l_di" bpmnElement="Event_01bin3l">
+        <dc:Bounds x="1062" y="122" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1039" y="170" width="81" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0l28lqi_di" bpmnElement="Event_0l28lqi">
+        <dc:Bounds x="1062" y="242" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1040" y="290" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0m3yrzp_di" bpmnElement="Gateway_0m3yrzp" isMarkerVisible="true">
+        <dc:Bounds x="921" y="115" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="915" y="85" width="64" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ztykbe_di" bpmnElement="Activity_0ztykbe">
+        <dc:Bounds x="750" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tw406b_di" bpmnElement="Activity_0tw406b">
+        <dc:Bounds x="570" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
-        <dc:Bounds x="685" y="1080" width="781" height="196" />
+        <dc:Bounds x="555" y="1430" width="781" height="196" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
-        <di:waypoint x="1079" y="1184" />
-        <di:waypoint x="1353" y="1184" />
+        <di:waypoint x="949" y="1534" />
+        <di:waypoint x="1223" y="1534" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
-        <di:waypoint x="751" y="1184" />
-        <di:waypoint x="979" y="1184" />
+        <di:waypoint x="621" y="1534" />
+        <di:waypoint x="849" y="1534" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
-        <dc:Bounds x="715" y="1166" width="36" height="36" />
+        <dc:Bounds x="585" y="1516" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
-        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+        <dc:Bounds x="1223" y="1516" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
-        <dc:Bounds x="979" y="1144" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
-        <dc:Bounds x="285" y="81" width="100" height="80" />
+        <dc:Bounds x="849" y="1494" width="100" height="80" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java
new file mode 100644 (file)
index 0000000..2eebde0
--- /dev/null
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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.adapter.cnf.tasks;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.cnf.CnfAdapterClient;
+import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceRequest;
+import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceResponse;
+import org.onap.so.client.adapter.vnf.mapper.AttributeNameValue;
+import org.onap.so.client.adapter.vnf.mapper.Attributes;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.openstack.utils.MsoMulticloudUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class CnfAdapterUpgradeTasks {
+    private static final Logger logger = LoggerFactory.getLogger(CnfAdapterUpgradeTasks.class);
+
+    public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
+
+    @Autowired
+    private ExtractPojosForBB extractPojosForBB;
+    @Autowired
+    private ExceptionBuilder exceptionUtil;
+    @Autowired
+    private CnfAdapterClient cnfAdapterClient;
+    @Autowired
+    private VnfAdapterVfModuleObjectMapper vfModuleMapper;
+
+    private ObjectMapper mapper = new ObjectMapper();
+
+    /**
+     * This method is used for updating the request for an Instance in Multicloud K8s Plugin.
+     *
+     * @param execution
+     * @return
+     */
+    public void upgradeInstance(BuildingBlockExecution execution) {
+        try {
+            GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+            ServiceInstance serviceInstance =
+                    gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+            GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+            VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+            RequestContext requestContext = gBBInput.getRequestContext();
+            CloudRegion cloudRegion = gBBInput.getCloudRegion();
+            String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
+            String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId());
+            Map<String, Object> paramsMap = vfModuleMapper.buildVfModuleParamsMap(requestContext, serviceInstance,
+                    genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+            Map<String, String> sdncDirectives = getSdncDirectives(paramsMap);
+            UpgradeInstanceRequest upgradeInstanceRequest =
+                    upgradeInstanceRequest(vfModule, cloudRegion, sdncDirectives);
+            UpgradeInstanceResponse response = cnfAdapterClient.upgradeVfModule(upgradeInstanceRequest);
+            execution.setVariable("heatStackId", response.getId());
+        } catch (Exception ex) {
+            logger.error("Exception occurred", ex);
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+        }
+    }
+
+    protected Map<String, String> getSdncDirectives(Map<String, Object> paramsMap)
+            throws JsonParseException, JsonMappingException, IOException {
+        Map<String, String> sdncDirectivesMap = new HashMap<>();
+        String sdncDirectivesString = (String) paramsMap.get(MsoMulticloudUtils.SDNC_DIRECTIVES);
+        Attributes sdncDirectives = mapper.readValue(sdncDirectivesString, Attributes.class);
+        for (AttributeNameValue nameVal : sdncDirectives.getAttributes()) {
+            sdncDirectivesMap.put(nameVal.getAttributeName(), (String) nameVal.getAttributeValue());
+        }
+        return sdncDirectivesMap;
+    }
+
+    protected UpgradeInstanceRequest upgradeInstanceRequest(VfModule vfModule, CloudRegion cloudRegion,
+            Map<String, String> sdncDirectives) {
+
+        UpgradeInstanceRequest request = new UpgradeInstanceRequest();
+
+        request.setModelInvariantId(vfModule.getModelInfoVfModule().getModelInvariantUUID());
+        request.setModelCustomizationId(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+        request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
+        request.setVfModuleUUID(vfModule.getVfModuleId());
+        request.setProfileName(sdncDirectives.get("k8s-rb-profile-name"));
+        request.setLabels(sdncDirectives);
+        if (sdncDirectives.containsKey("k8s-rb-instance-status-check"))
+            request.setStatusCheck(sdncDirectives.get("k8s-rb-instance-status-check").equalsIgnoreCase("true"));
+        request.setOverrideValues(sdncDirectives);
+        return request;
+    }
+
+}
index b0182c1..d7f2b85 100755 (executable)
@@ -55,6 +55,7 @@ public class ExecuteBuildingBlockBuilder {
     private static final String VFMODULE = "VfModule";
     private static final String NETWORK = "Network";
     private static final String HEALTH_CHECK = "HealthCheckBB";
+    private static final String UPGRADE_CNF = "UpgradeVfModuleBB";
 
     protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
             List<Resource> originalResourceList, String requestId, String apiVersion, String resourceId,
@@ -133,6 +134,10 @@ public class ExecuteBuildingBlockBuilder {
                 && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope())) {
             addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion,
                     resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if ((orchFlow.getFlowName().equalsIgnoreCase(UPGRADE_CNF))
+                && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope())) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion,
+                    resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
         } else if (orchFlow.getFlowName().contains(PNF)
                 || (orchFlow.getFlowName().contains(CONTROLLER) && (PNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
             addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.PNF, orchFlow, requestId, apiVersion,
index 0214a3f..3617512 100644 (file)
@@ -40,6 +40,8 @@ public class Resource implements Serializable {
     private String cvnfModuleCustomizationId;
     private String instanceName;
     private String modelInvariantId;
+    private String modelVersionId;
+    private String modelCustomizationId;
     private int processingPriority;
     private Resource parent;
     private List<Resource> children;
@@ -140,6 +142,21 @@ public class Resource implements Serializable {
         this.modelInvariantId = modelInvariantId;
     }
 
+    public String getModelVersionId() {
+        return modelVersionId;
+    }
+
+    public void setModelVersionId(String modelVersionId) {
+        this.modelVersionId = modelVersionId;
+    }
+
+    public String getModelCustomizationId() {
+        return modelCustomizationId;
+    }
+
+    public void setModelCustomizationId(String modelCustomizationId) {
+        this.modelCustomizationId = modelCustomizationId;
+    }
 
     public int getProcessingPriority() {
         return processingPriority == 0 ? (isBaseVfModule() ? Integer.MIN_VALUE + 1 : 0) : processingPriority;
index 31a7caa..35e1196 100755 (executable)
@@ -42,6 +42,7 @@ import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConst
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPDATE_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.HEALTH_CHECK;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPGRADE_CNF;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -306,6 +307,9 @@ public class WorkflowAction {
         } else if (resourceType == WorkflowType.VNF && HEALTH_CHECK.equalsIgnoreCase(requestAction)) {
             vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
                     workflowResourceIds.getVnfId(), aaiResourceIds);
+        } else if (resourceType == WorkflowType.VNF && UPGRADE_CNF.equalsIgnoreCase(requestAction)) {
+            vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
+                    workflowResourceIds.getVnfId(), aaiResourceIds);
         } else {
             buildAndThrowException(execution, "Current Macro Request is not supported");
         }
index dda217f..22d78bb 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.UUID;
 import java.util.stream.Collectors;
@@ -49,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
 import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
 import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.BuildingBlockRollback;
 import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
 import org.onap.so.db.catalog.client.CatalogDbClient;
 import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -86,6 +88,9 @@ public class WorkflowActionBBTasks {
     private static final String VFMODULE = "VfModule";
     private static final String CONFIGURATION_PATTERN = "(Ad|De)(.*)FabricConfiguration(.*)";
     protected String maxRetries = "mso.rainyDay.maxRetries";
+    private static final String ROLLBACK_TO_ASSIGNED = "RollbackToAssigned";
+    private static final String UNASSIGN = "Unassign";
+    private static final String DELETE = "Delete";
     private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
 
     @Autowired
@@ -316,94 +321,98 @@ public class WorkflowActionBBTasks {
     public void rollbackExecutionPath(DelegateExecution execution) {
         final String action = (String) execution.getVariable(BBConstants.G_ACTION);
         final String resourceName = (String) execution.getVariable("resourceName");
-        if (!(boolean) execution.getVariable("isRollback")) {
-            List<ExecuteBuildingBlock> flowsToExecute =
-                    (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
-
-            List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = flowsToExecute.stream()
-                    .filter(buildingBlock -> buildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change"))
-                    .collect(Collectors.toList());
-
-            List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>();
-            int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-            int listSize = flowsToExecute.size();
+        if ((boolean) execution.getVariable("isRollback")) {
+            workflowAction.buildAndThrowException(execution,
+                    "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
+        }
+        List<ExecuteBuildingBlock> flowsToExecute =
+                (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
 
-            for (int i = listSize - 1; i >= 0; i--) {
-                if (i > currentSequence - 1) {
-                    flowsToExecute.remove(i);
-                } else {
-                    String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
-                    if (flowName.startsWith("Assign")) {
-                        flowName = flowName.replaceFirst("Assign", "Unassign");
-                    } else if (flowName.startsWith("Create")) {
-                        flowName = flowName.replaceFirst("Create", "Delete");
-                    } else if (flowName.startsWith("Activate")) {
-                        flowName = flowName.replaceFirst("Activate", "Deactivate");
-                    } else if (flowName.startsWith("Add")) {
-                        flowName = flowName.replaceFirst("Add", "Delete");
-                    } else if (flowName.startsWith("VNF")) {
-                        if (flowName.startsWith("VNFSet")) {
-                            flowName = flowName.replaceFirst("VNFSet", "VNFUnset");
-                        } else if (flowName.startsWith("VNFLock")) {
-                            flowName = flowName.replaceFirst("VNFLock", "VNFUnlock");
-                        } else if (flowName.startsWith("VNFStop")) {
-                            flowName = flowName.replaceFirst("VNFStop", "VNFStart");
-                        } else if (flowName.startsWith("VNFQuiesce")) {
-                            flowName = flowName.replaceFirst("VNFQuiesce", "VNFResume");
-                        } else {
-                            continue;
-                        }
-                    } else {
-                        continue;
+        List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = flowsToExecute.stream()
+                .filter(buildingBlock -> buildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change"))
+                .collect(Collectors.toList());
+        List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>();
+        int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+        int listSize = flowsToExecute.size();
+        List<BuildingBlockRollback> bbRollbackList = catalogDbClient.getBuildingBlockRollbackEntries();
+
+        for (int i = listSize - 1; i >= 0; i--) {
+            if (i > currentSequence - 1) {
+                flowsToExecute.remove(i);
+            } else {
+                // filter bbRollbackList for bbrollback, and check if action exists, then filter by action
+                BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock();
+                String flowName = bb.getBpmnFlowName();
+                String scope = Objects.toString(bb.getBpmnScope(), "");
+                String bbAction = Objects.toString(bb.getBpmnAction(), "");
+                ExecuteBuildingBlock currentBB = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+
+                List<BuildingBlockRollback> filteredList = bbRollbackList.stream()
+                        .filter(k -> k.getBuildingBlockName().equals((flowName))).collect(Collectors.toList());
+                Optional<BuildingBlockRollback> matchedBBRollback =
+                        "".equals(bbAction) ? filteredList.stream().findFirst()
+                                : filteredList.stream().filter(k -> bbAction.equals(k.getAction())).findFirst();
+                if (matchedBBRollback.isPresent()) {
+                    final BuildingBlockRollback buildingBlockRollbackItem = matchedBBRollback.get();
+                    String rollbackFlow = buildingBlockRollbackItem.getRollbackBuildingBlockName();
+                    flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(rollbackFlow);
+                    // if we have an action, search the filtered list for the bbrollback that matches the given action.
+                    if (null != buildingBlockRollbackItem.getRollbackAction()) {
+                        logger.info("Setting rollback_action {} for BB: {} action: {}",
+                                buildingBlockRollbackItem.getRollbackAction(),
+                                buildingBlockRollbackItem.getBuildingBlockName(),
+                                buildingBlockRollbackItem.getAction());
+                        flowsToExecute.get(i).getBuildingBlock()
+                                .setBpmnAction(buildingBlockRollbackItem.getRollbackAction());
                     }
-                    flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
                     rollbackFlows.add(flowsToExecute.get(i));
                 }
             }
+        }
 
-            String handlingCode = (String) execution.getVariable(HANDLINGCODE);
-            List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
-            if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)
-                    || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) {
-                for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
-                    if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign")
-                            && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
-                        rollbackFlowsFiltered.remove(rollbackFlow);
-                    } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete")
-                            && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
-                                    && (ROLLBACKTOCREATED.equals(handlingCode)
-                                            || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))
-                                    || (rollbackFlow.getBuildingBlock().getBpmnFlowName()
-                                            .contains("FabricConfiguration")
-                                            && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) {
-                        rollbackFlowsFiltered.remove(rollbackFlow);
-                    }
+        String handlingCode = (String) execution.getVariable(HANDLINGCODE);
+        List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
+        if (ROLLBACK_TO_ASSIGNED.equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)
+                || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) {
+            for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
+                if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(UNASSIGN)
+                        && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(FABRIC_CONFIGURATION)) {
+                    rollbackFlowsFiltered.remove(rollbackFlow);
+                } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(DELETE)
+                        && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(FABRIC_CONFIGURATION)
+                                && (ROLLBACKTOCREATED.equals(handlingCode)
+                                        || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))
+                                || (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(FABRIC_CONFIGURATION)
+                                        && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) {
+                    rollbackFlowsFiltered.remove(rollbackFlow);
                 }
             }
+        }
 
-            List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList<>();
-            if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) {
-                for (ExecuteBuildingBlock executeBuildingBlock : rollbackFlowsFiltered) {
-                    if (!executeBuildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) {
-                        rollbackFlowsFilteredNonChangeBBs.add(executeBuildingBlock);
-                    }
+        List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList<>();
+        if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) {
+            for (ExecuteBuildingBlock executeBuildingBlock : rollbackFlowsFiltered) {
+                if (!executeBuildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) {
+                    rollbackFlowsFilteredNonChangeBBs.add(executeBuildingBlock);
                 }
-                rollbackFlowsFiltered.clear();
-                rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs);
-                rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs);
             }
-
-            workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
-            execution.setVariable("isRollbackNeeded", !rollbackFlows.isEmpty());
-            execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
-            execution.setVariable(HANDLINGCODE, "PreformingRollback");
-            execution.setVariable("isRollback", true);
-            execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
-            execution.setVariable(RETRY_COUNT, 0);
-        } else {
-            workflowAction.buildAndThrowException(execution,
-                    "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
+            rollbackFlowsFiltered.clear();
+            rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs);
+            rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs);
         }
+
+        logger.info("List of BuildingBlocks to execute for rollback");
+        rollbackFlowsFiltered.forEach(item -> {
+            logger.info(item.getBuildingBlock().getBpmnFlowName());
+        });
+
+        workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+        execution.setVariable("isRollbackNeeded", !rollbackFlows.isEmpty());
+        execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
+        execution.setVariable(HANDLINGCODE, "PreformingRollback");
+        execution.setVariable("isRollback", true);
+        execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
+        execution.setVariable(RETRY_COUNT, 0);
     }
 
     protected void updateInstanceId(DelegateExecution execution) {
index 7bbc9f3..7ffd066 100755 (executable)
@@ -53,5 +53,6 @@ public final class WorkflowActionConstants {
     public static final String VOLUMEGROUP = "VolumeGroup";
     public static final String HEALTH_CHECK = "healthCheck";
     public static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
+    public static final String UPGRADE_CNF = "upgradeCnf";
 
 }
index f16365b..9d76707 100644 (file)
@@ -42,6 +42,8 @@ import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException
 import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
 import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
 import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
 import org.onap.so.client.exception.ExceptionBuilder;
@@ -207,6 +209,7 @@ public class ServiceEBBLoader {
             var serviceResource =
                     new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
             serviceResource.setModelInvariantId(serviceInstanceAAI.getModelInvariantId());
+            serviceResource.setModelVersionId(serviceInstanceAAI.getModelVersionId());
             resourceList.add(serviceResource);
             traverseServiceInstanceChildService(resourceList, serviceResource, serviceInstanceAAI);
             traverseServiceInstanceMSOVnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
@@ -215,8 +218,15 @@ public class ServiceEBBLoader {
                 for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
                         .getNetworks()) {
                     aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId()));
-                    resourceList
-                            .add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource));
+                    Resource networkResource =
+                            new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource);
+                    ModelInfoNetwork modelInfoNetwork = network.getModelInfoNetwork();
+                    if (modelInfoNetwork != null) {
+                        networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID());
+                        networkResource.setModelVersionId(modelInfoNetwork.getModelUUID());
+                        networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID());
+                    }
+                    resourceList.add(networkResource);
                 }
             }
             if (serviceInstanceMSO.getCollection() != null) {
@@ -261,6 +271,8 @@ public class ServiceEBBLoader {
             GenericVnf genericVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId());
             Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource);
             vnfResource.setVnfCustomizationId(genericVnf.getModelCustomizationId());
+            vnfResource.setModelCustomizationId(genericVnf.getModelCustomizationId());
+            vnfResource.setModelVersionId(genericVnf.getModelVersionId());
             resourceList.add(vnfResource);
             traverseVnfModules(resourceList, vnfResource, aaiResourceIds, vnf);
             if (vnf.getVolumeGroups() != null) {
@@ -281,7 +293,13 @@ public class ServiceEBBLoader {
         }
         for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) {
             aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId()));
-            resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource));
+            Resource resource = new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource);
+            ModelInfoPnf modelInfo = pnf.getModelInfoPnf();
+            if (modelInfo != null) {
+                resource.setModelVersionId(modelInfo.getModelUuid());
+                resource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
+            }
+            resourceList.add(resource);
         }
     }
 
@@ -494,6 +512,10 @@ public class ServiceEBBLoader {
         for (VfModule vfModule : vnf.getVfModules()) {
             aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
             Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource);
+            org.onap.aai.domain.yang.VfModule aaiVfModule =
+                    bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId());
+            resource.setModelCustomizationId(aaiVfModule.getModelCustomizationId());
+            resource.setModelInvariantId(aaiVfModule.getModelInvariantId());
             resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
             resourceList.add(resource);
         }
index b8b9c45..b56bd90 100644 (file)
@@ -38,6 +38,7 @@ import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
 import org.onap.so.db.catalog.beans.CvnfcCustomization;
 import org.onap.so.db.catalog.beans.VfModuleCustomization;
 import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
 import org.onap.so.serviceinstancebeans.Networks;
 import org.onap.so.serviceinstancebeans.Pnfs;
 import org.onap.so.serviceinstancebeans.Service;
@@ -93,6 +94,11 @@ public class UserParamsServiceTraversal {
         List<Resource> resourceList = new ArrayList<>();
         Resource serviceResource =
                 new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false, null);
+        ModelInfo modelInfo = validate.getModelInfo();
+        if (modelInfo != null) {
+            serviceResource.setModelVersionId(modelInfo.getModelVersionId());
+            serviceResource.setModelInvariantId(modelInfo.getModelInvariantUuid());
+        }
         resourceList.add(serviceResource);
         if (validate.getResources().getServices() != null) {
             setResourceListForChildServices(execution, resourceList, serviceResource, validate);
@@ -129,6 +135,11 @@ public class UserParamsServiceTraversal {
                     serviceResource);
             vnfResource.setProcessingPriority(vnf.getProcessingPriority());
             vnfResource.setInstanceName(vnf.getInstanceName());
+            ModelInfo modelInfo = vnf.getModelInfo();
+            if (modelInfo != null) {
+                vnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
+                vnfResource.setModelVersionId(modelInfo.getModelVersionId());
+            }
             resourceList.add(vnfResource);
             setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf);
         }
@@ -174,6 +185,11 @@ public class UserParamsServiceTraversal {
             foundVfModuleOrVG = true;
             Resource resource =
                     setVfModuleWorkFlowTypeToResourceList(resourceList, vnfResource, vfModuleCustomization, vfModule);
+            if (vnf.getModelInfo() != null) {
+                resource.setModelVersionId(vnf.getModelInfo().getModelVersionId());
+            }
+            resource.setVfModuleCustomizationId(vfModuleCustomization.getModelCustomizationUUID());
+            resource.setModelCustomizationId(vfModuleCustomization.getModelCustomizationUUID());
             setConfigurationWorkFlowTypeToResourceList(resourceList, vnfResource, validate, vnf, vfModule, resource);
         }
     }
@@ -225,6 +241,11 @@ public class UserParamsServiceTraversal {
         for (Pnfs pnf : validate.getResources().getPnfs()) {
             Resource pnfResource = new Resource(WorkflowType.PNF, pnf.getModelInfo().getModelCustomizationId(), false,
                     serviceResource);
+            ModelInfo modelInfo = pnf.getModelInfo();
+            if (modelInfo != null) {
+                pnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
+                pnfResource.setModelVersionId(modelInfo.getModelVersionId());
+            }
             pnfResource.setProcessingPriority(pnf.getProcessingPriority());
             resourceList.add(pnfResource);
         }
@@ -236,6 +257,11 @@ public class UserParamsServiceTraversal {
             Resource networkResource = new Resource(WorkflowType.NETWORK,
                     network.getModelInfo().getModelCustomizationId(), false, serviceResource);
             networkResource.setProcessingPriority(network.getProcessingPriority());
+            ModelInfo modelInfo = network.getModelInfo();
+            if (modelInfo != null) {
+                networkResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
+                networkResource.setModelVersionId(modelInfo.getModelVersionId());
+            }
             resourceList.add(networkResource);
         }
         if (requestAction.equals(CREATE_INSTANCE)) {
index b950eb4..3778f64 100644 (file)
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
 import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
 import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
 import org.onap.so.client.exception.ExceptionBuilder;
@@ -117,6 +116,9 @@ public class VnfEBBLoader {
             if (vnf.getVnfId().equals(vnfId)) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
                 Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource);
+                org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+                vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId());
+                vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId());
                 resourceList.add(vnfResource);
                 processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution);
                 processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource);
@@ -131,8 +133,11 @@ public class VnfEBBLoader {
         for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
             if (vnf.getVnfId().equals(vnfId)) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
-                Resource vnfResource = new Resource(WorkflowType.VNF,
-                        bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false, serviceResource);
+                org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+                Resource vnfResource =
+                        new Resource(WorkflowType.VNF, aaiGenericVnf.getModelCustomizationId(), false, serviceResource);
+                vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId());
+                vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId());
                 resourceList.add(vnfResource);
                 processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution);
                 processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource);
@@ -141,10 +146,10 @@ public class VnfEBBLoader {
         }
     }
 
-    private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId,
-            List<Resource> resourceList, Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) {
+    private void findConfigurationsInsideVfModule(DelegateExecution execution,
+            org.onap.aai.domain.yang.VfModule aaiVfModule, List<Resource> resourceList, Resource vfModuleResource,
+            List<Pair<WorkflowType, String>> aaiResourceIds) {
         try {
-            org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
             AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
                     new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule));
             Optional<Relationships> relationshipsOp;
@@ -166,11 +171,14 @@ public class VnfEBBLoader {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
                 Resource vfModuleResource =
                         new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource);
-                Optional.ofNullable(vfModule.getModelInfoVfModule()).map(ModelInfoVfModule::getIsBaseBoolean)
-                        .ifPresent(vfModuleResource::setBaseVfModule);
+                org.onap.aai.domain.yang.VfModule aaiVfModule =
+                        bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId());
+                vfModuleResource.setModelInvariantId(aaiVfModule.getModelInvariantId());
+                vfModuleResource.setModelCustomizationId(aaiVfModule.getModelCustomizationId());
+                vfModuleResource.setBaseVfModule(aaiVfModule.isIsBaseVfModule());
                 resourceList.add(vfModuleResource);
-                findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceList,
-                        vfModuleResource, aaiResourceIds);
+                findConfigurationsInsideVfModule(execution, aaiVfModule, resourceList, vfModuleResource,
+                        aaiResourceIds);
             }
         }
     }
index ff6c113..dc77ea1 100644 (file)
@@ -24,12 +24,10 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import org.apache.logging.log4j.util.Strings;
 import org.onap.so.bpmn.common.BBConstants;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
 import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.db.catalog.beans.PnfResourceCustomization;
 import org.onap.so.db.catalog.beans.Service;
@@ -40,7 +38,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
 
 @Component
 public class SkipCDSBuildingBlockListener implements PreFlowManipulator {
@@ -76,43 +73,37 @@ public class SkipCDSBuildingBlockListener implements PreFlowManipulator {
     @Override
     public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
             BuildingBlockExecution execution) {
-        String customizationUUID = currentBB.getBuildingBlock().getKey();
+        String resourceKey = currentBB.getBuildingBlock().getKey();
+        List<Resource> resources = execution.getVariable("resources");
+        Resource resource = resources.stream().filter(r -> resourceKey.equals(r.getResourceId())).findFirst()
+                .orElseThrow(() -> new IllegalArgumentException("Resource not found for key:" + resourceKey));
 
-        if ("SERVICE".equalsIgnoreCase(currentBB.getBuildingBlock().getBpmnScope())) {
-            String modelUUID = currentBB.getRequestDetails().getModelInfo().getModelUuid();
-            Service service = catalogDbClient.getServiceByID(modelUUID);
-            currentSequenceSkipCheck(execution, service.getSkipPostInstConf());
-        } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF")
-                && containsIgnoreCaseAction(currentBB, vnfActions)) {
-            List<VnfResourceCustomization> vnfResourceCustomizations =
-                    catalogDbClient.getVnfResourceCustomizationByModelUuid(
-                            currentBB.getRequestDetails().getModelInfo().getModelUuid());
-            if (!CollectionUtils.isEmpty(vnfResourceCustomizations)) {
-                VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID,
-                        vnfResourceCustomizations);
-                if (null != vrc) {
-                    logger.debug("getSkipPostInstConf value: " + vrc.getSkipPostInstConf().booleanValue());
-                    boolean skipConfigVNF = vrc.getSkipPostInstConf().booleanValue();
-                    currentSequenceSkipCheck(execution, skipConfigVNF);
-                }
+        String scope = currentBB.getBuildingBlock().getBpmnScope();
 
+        if ("SERVICE".equalsIgnoreCase(scope)) {
+            Service service = catalogDbClient.getServiceByID(resource.getModelVersionId());
+            currentSequenceSkipCheck(execution, service.getSkipPostInstConf());
+        } else if ("VNF".equalsIgnoreCase(scope) && containsIgnoreCaseAction(currentBB, vnfActions)) {
+            VnfResourceCustomization vrc = catalogDbClient
+                    .getVnfResourceCustomizationByModelCustomizationUUID(resource.getModelCustomizationId());
+            if (vrc != null) {
+                logger.debug("getSkipPostInstConf value: " + vrc.getSkipPostInstConf());
+                boolean skipConfigVNF = vrc.getSkipPostInstConf();
+                currentSequenceSkipCheck(execution, skipConfigVNF);
             }
         } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VFModule")
                 && containsIgnoreCaseAction(currentBB, vFModuleAction)) {
-
-            VfModuleCustomization vfc =
-                    catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(customizationUUID);
-
+            VfModuleCustomization vfc = catalogDbClient
+                    .getVfModuleCustomizationByModelCuztomizationUUID(resource.getModelCustomizationId());
             if (null != vfc) {
                 logger.debug("getSkipPostInstConf value: " + vfc.getSkipPostInstConf().booleanValue());
                 boolean skipVfModule = vfc.getSkipPostInstConf();
                 currentSequenceSkipCheck(execution, skipVfModule);
             }
-
         } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF")
                 && containsIgnoreCaseAction(currentBB, pnfActions)) {
-            PnfResourceCustomization pnfResourceCustomization =
-                    catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(customizationUUID);
+            PnfResourceCustomization pnfResourceCustomization = catalogDbClient
+                    .getPnfResourceCustomizationByModelCustomizationUUID(resource.getModelCustomizationId());
 
             if (null != pnfResourceCustomization) {
                 logger.debug("getSkipPostInstConf value: " + pnfResourceCustomization.getSkipPostInstConf());
index da36a6f..e8122e7 100644 (file)
@@ -27,6 +27,8 @@ import javax.ws.rs.core.UriBuilder;
 import org.apache.http.HttpStatus;
 import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
 import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
+import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceResponse;
+import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -115,6 +117,25 @@ public class CnfAdapterClient {
         }
     }
 
+    @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000))
+    public UpgradeInstanceResponse upgradeVfModule(UpgradeInstanceRequest request) throws CnfAdapterClientException {
+        try {
+            String uri = "http://so-cnf-adapter:8090";
+            String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/instance/{instanceID}/upgrade").build()
+                    .toString();
+            HttpEntity<?> entity = getHttpEntity(request);
+            ResponseEntity<UpgradeInstanceResponse> result =
+                    restTemplate.exchange(endpoint, HttpMethod.POST, entity, UpgradeInstanceResponse.class);
+            return result.getBody();
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling CNF Adapter, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        }
+    }
+
     protected HttpHeaders getHttpHeaders() {
         HttpHeaders headers = new HttpHeaders();
         List<MediaType> acceptableMediaTypes = new ArrayList<>();
@@ -135,4 +156,8 @@ public class CnfAdapterClient {
         return new HttpEntity<>(request, headers);
     }
 
+    protected HttpEntity<?> getHttpEntity(UpgradeInstanceRequest request) {
+        HttpHeaders headers = getHttpHeaders();
+        return new HttpEntity<>(request, headers);
+    }
 }
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceRequest.java
new file mode 100644 (file)
index 0000000..ef516d4
--- /dev/null
@@ -0,0 +1,100 @@
+
+package org.onap.so.client.adapter.cnf.entities;
+
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UpgradeInstanceRequest {
+
+    @JsonProperty("modelInvariantId")
+    private String modelInvariantId;
+
+    @JsonProperty("modelCustomizationId")
+    private String modelCustomizationId;
+
+    @JsonProperty("k8sRBProfileName")
+    private String profileName;
+
+    @JsonProperty("k8sRBInstanceStatusCheck")
+    private Boolean statusCheck = false;
+
+    @JsonProperty("cloudRegionId")
+    private String cloudRegion;
+
+    @JsonProperty("vfModuleUUID")
+    private String vfModuleUUID;
+
+    @JsonProperty("labels")
+    private Map<String, String> labels;
+
+    @JsonProperty("override-values")
+    private Map<String, String> overrideValues;
+
+    public String getModelInvariantId() {
+        return modelInvariantId;
+    }
+
+    public void setModelInvariantId(String modelInvariantId) {
+        this.modelInvariantId = modelInvariantId;
+    }
+
+    public String getModelCustomizationId() {
+        return modelCustomizationId;
+    }
+
+    public void setModelCustomizationId(String modelCustomizationId) {
+        this.modelCustomizationId = modelCustomizationId;
+    }
+
+    public String getProfileName() {
+        return profileName;
+    }
+
+    public void setProfileName(String profileName) {
+        this.profileName = profileName;
+    }
+
+    public Boolean getStatusCheck() {
+        return statusCheck;
+    }
+
+    public void setStatusCheck(Boolean statusCheck) {
+        this.statusCheck = statusCheck;
+    }
+
+    public String getCloudRegion() {
+        return cloudRegion;
+    }
+
+    public void setCloudRegion(String cloudRegion) {
+        this.cloudRegion = cloudRegion;
+    }
+
+    public Map<String, String> getLabels() {
+        return labels;
+    }
+
+    public void setLabels(Map<String, String> labels) {
+        this.labels = labels;
+    }
+
+    public String getVfModuleUUID() {
+        return vfModuleUUID;
+    }
+
+    public void setVfModuleUUID(String vfModuleUUID) {
+        this.vfModuleUUID = vfModuleUUID;
+    }
+
+    public Map<String, String> getOverrideValues() {
+        return overrideValues;
+    }
+
+    public void setOverrideValues(Map<String, String> overrideValues) {
+        this.overrideValues = overrideValues;
+    }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceResponse.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceResponse.java
new file mode 100644 (file)
index 0000000..6498279
--- /dev/null
@@ -0,0 +1,78 @@
+
+package org.onap.so.client.adapter.cnf.entities;
+
+import java.util.List;
+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", "release-name", "resources"})
+public class UpgradeInstanceResponse {
+
+    @JsonProperty("id")
+    private String id;
+
+    @JsonProperty("request")
+    private InstanceRequest request;
+
+    @JsonProperty("namespace")
+    private String namespace;
+
+    @JsonProperty("release-name")
+    private String releaseName;
+
+    @JsonProperty("resources")
+    private List<Resource> resources = null;
+
+    @JsonProperty("id")
+    public String getId() {
+        return id;
+    }
+
+    @JsonProperty("id")
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    @JsonProperty("request")
+    public InstanceRequest getRequest() {
+        return request;
+    }
+
+    @JsonProperty("request")
+    public void setRequest(InstanceRequest 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;
+    }
+
+    @JsonProperty("release-name")
+    public String getReleaseName() {
+        return releaseName;
+    }
+
+    @JsonProperty("release-name")
+    public void setReleaseName(String releaseName) {
+        this.releaseName = releaseName;
+    }
+
+}
index 28d2abc..7d4267e 100644 (file)
@@ -25,13 +25,16 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
 import org.camunda.bpm.engine.delegate.BpmnError;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
 import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.adapters.nwrest.CreateNetworkResponse;
 import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -42,7 +45,17 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
 import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIPnfResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import java.util.HashMap;
 import static org.junit.Assert.assertEquals;
@@ -57,8 +70,29 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-public class AAIUpdateTasksTest extends BaseTaskTest {
-
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AAIUpdateTasksTest extends TestDataSetup {
+
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected ExceptionBuilder exceptionUtil;
+    @Mock
+    protected AAIServiceInstanceResources aaiServiceInstanceResources;
+    @Mock
+    protected AAIPnfResources aaiPnfResources;
+    @Mock
+    protected AAIVnfResources aaiVnfResources;
+    @Mock
+    protected AAIVfModuleResources aaiVfModuleResources;
+    @Mock
+    protected AAIVolumeGroupResources aaiVolumeGroupResources;
+    @Mock
+    protected AAINetworkResources aaiNetworkResources;
+    @Mock
+    protected AAICollectionResources aaiCollectionResources;
+    @Mock
+    protected AAIConfigurationResources aaiConfigurationResources;
     @InjectMocks
     private AAIUpdateTasks aaiUpdateTasks = new AAIUpdateTasks();
 
@@ -99,7 +133,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignedServiceTest() throws Exception {
+    public void updateOrchestrationStatusAssignedServiceTest() {
         doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance,
                 OrchestrationStatus.ASSIGNED);
 
@@ -110,7 +144,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception {
+    public void updateOrchestrationStatusAssignedServiceExceptionTest() {
         expectedException.expect(BpmnError.class);
 
         doThrow(RuntimeException.class).when(aaiServiceInstanceResources)
@@ -120,7 +154,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActiveServiceTest() throws Exception {
+    public void updateOrchestrationStatusActiveServiceTest() {
         doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance,
                 OrchestrationStatus.ACTIVE);
 
@@ -131,7 +165,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception {
+    public void updateOrchestrationStatusActiveServiceExceptionTest() {
         expectedException.expect(BpmnError.class);
 
         doThrow(RuntimeException.class).when(aaiServiceInstanceResources)
@@ -221,7 +255,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignedVnfTest() throws Exception {
+    public void updateOrchestrationStatusAssignedVnfTest() {
         doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
 
         aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution);
@@ -230,7 +264,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception {
+    public void updateOrchestrationStatusAssignedVnfExceptionTest() {
         expectedException.expect(BpmnError.class);
 
         doThrow(RuntimeException.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf,
@@ -240,7 +274,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActiveVnfTest() throws Exception {
+    public void updateOrchestrationStatusActiveVnfTest() {
         doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
 
         aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution);
@@ -249,7 +283,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception {
+    public void updateOrchestrationStatusActiveVnfExceptionTest() {
         expectedException.expect(BpmnError.class);
 
         doThrow(RuntimeException.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf,
@@ -259,7 +293,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignVfModuleTest() throws Exception {
+    public void updateOrchestrationStatusAssignVfModuleTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.ASSIGNED);
         aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
@@ -269,7 +303,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception {
+    public void updateOrchestrationStatusAssignVfModuleExceptionTest() {
         doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
                 genericVnf, OrchestrationStatus.ASSIGNED);
 
@@ -279,7 +313,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
+    public void updateOrchestrationStatusCreatedVfModuleTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.CREATED);
         aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution);
@@ -288,7 +322,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception {
+    public void updateOrchestrationStatusCreatedVfModuleExceptionTest() {
         doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
                 genericVnf, OrchestrationStatus.CREATED);
 
@@ -298,7 +332,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception {
+    public void updateOrchestrationStatusPendingActivatefModuleTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.PENDING_ACTIVATION);
 
@@ -309,7 +343,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception {
+    public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() {
         doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
                 genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
 
@@ -319,7 +353,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception {
+    public void updateOrchestrationStatusDectivateVfModuleTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.CREATED);
 
@@ -330,7 +364,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception {
+    public void updateOrchestrationStatusDectivateVfModuleExceptionTest() {
         doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
                 genericVnf, OrchestrationStatus.CREATED);
 
@@ -340,7 +374,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateHeatStackIdVfModuleTest() throws Exception {
+    public void updateHeatStackIdVfModuleTest() {
         execution.setVariable("heatStackId", "newHeatStackId");
         doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
 
@@ -351,18 +385,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateHeatStackIdVfModuleToNullTest() throws Exception {
+    public void updateHeatStackIdVfModuleToNullTest() {
         execution.setVariable("heatStackId", null);
         doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
 
         aaiUpdateTasks.updateHeatStackIdVfModule(execution);
 
         verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
-        assertEquals(vfModule.getHeatStackId(), "");
+        assertEquals("", vfModule.getHeatStackId());
     }
 
     @Test
-    public void updateHeatStackIdVfModuleExceptionTest() throws Exception {
+    public void updateHeatStackIdVfModuleExceptionTest() {
         doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
 
         expectedException.expect(BpmnError.class);
@@ -371,7 +405,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception {
+    public void updateOrchestrationStatusActiveVolumeGroupTest() {
         doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
                 OrchestrationStatus.ACTIVE);
 
@@ -382,7 +416,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception {
+    public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() {
         expectedException.expect(BpmnError.class);
         doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup,
                 cloudRegion, OrchestrationStatus.ACTIVE);
@@ -390,7 +424,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception {
+    public void updateOrchestrationStatusCreatedVolumeGroupTest() {
         doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
                 OrchestrationStatus.CREATED);
 
@@ -401,7 +435,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception {
+    public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() {
         expectedException.expect(BpmnError.class);
         doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup,
                 cloudRegion, OrchestrationStatus.CREATED);
@@ -409,7 +443,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception {
+    public void test_updateOrchestrationStatusAssignedVolumeGroup() {
         doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
                 OrchestrationStatus.ASSIGNED);
 
@@ -421,7 +455,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception {
+    public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() {
         expectedException.expect(BpmnError.class);
         doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup,
                 cloudRegion, OrchestrationStatus.ASSIGNED);
@@ -429,7 +463,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateHeatStackIdVolumeGroupTest() throws Exception {
+    public void updateHeatStackIdVolumeGroupTest() {
         execution.setVariable("heatStackId", "newHeatStackId");
         doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
 
@@ -440,18 +474,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateHeatStackIdVolumeGroupToNullTest() throws Exception {
+    public void updateHeatStackIdVolumeGroupToNullTest() {
         execution.setVariable("heatStackId", null);
         doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
 
         aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
 
         verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
-        assertEquals(volumeGroup.getHeatStackId(), "");
+        assertEquals("", volumeGroup.getHeatStackId());
     }
 
     @Test
-    public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception {
+    public void updateHeatStackIdVolumeGroupExceptionTest() {
         expectedException.expect(BpmnError.class);
         doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup,
                 cloudRegion);
@@ -459,7 +493,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateNetworkExceptionTest() throws Exception {
+    public void updateNetworkExceptionTest() {
         expectedException.expect(BpmnError.class);
 
         doThrow(RuntimeException.class).when(aaiNetworkResources).updateNetwork(network);
@@ -468,21 +502,21 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOstatusActivedNetworkCollectionTest() throws Exception {
+    public void updateOstatusActivedNetworkCollectionTest() {
         doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection());
         aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution);
         verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection());
     }
 
     @Test
-    public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception {
+    public void updateOstatusActiveNetworkColectionExceptionTest() {
         expectedException.expect(BpmnError.class);
         doThrow(RuntimeException.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection());
         aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution);
     }
 
     @Test
-    public void updateOrchestrationStatusActivateVfModuleTest() throws Exception {
+    public void updateOrchestrationStatusActivateVfModuleTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.ACTIVE);
 
@@ -493,7 +527,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception {
+    public void updateOrchestrationStatusActivateVfModuleExceptionTest() {
         doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
                 genericVnf, OrchestrationStatus.ACTIVE);
 
@@ -642,7 +676,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception {
+    public void updateOrchestrationStatusDeleteVfModuleTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.ASSIGNED);
 
@@ -668,7 +702,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception {
+    public void updateOrchestrationStatusDeactivateFabricConfigurationTest() {
         gBBInput = execution.getGeneralBuildingBlock();
         doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration,
                 OrchestrationStatus.ASSIGNED);
@@ -680,7 +714,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception {
+    public void updateOrchestrationStatusActivateFabricConfigurationTest() {
         gBBInput = execution.getGeneralBuildingBlock();
         doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration,
                 OrchestrationStatus.ACTIVE);
@@ -692,7 +726,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusAssignedFabricConfigurationTest() throws Exception {
+    public void updateOrchestrationStatusAssignedFabricConfigurationTest() {
         gBBInput = execution.getGeneralBuildingBlock();
         doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration,
                 OrchestrationStatus.ASSIGNED);
@@ -704,7 +738,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
+    public void updateContrailServiceInstanceFqdnVfModuleTest() {
         execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn");
         doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
 
@@ -715,13 +749,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception {
+    public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() {
         aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
         verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
     }
 
     @Test
-    public void updateIpv4OamAddressVnfTest() throws Exception {
+    public void updateIpv4OamAddressVnfTest() {
         execution.setVariable("oamManagementV4Address", "newIpv4OamAddress");
         doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
 
@@ -732,13 +766,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception {
+    public void updateIpv4OamAddressVnfNoUpdateTest() {
         aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
         verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
     }
 
     @Test
-    public void updateManagementV6AddressVnfTest() throws Exception {
+    public void updateManagementV6AddressVnfTest() {
         execution.setVariable("oamManagementV6Address", "newManagementV6Address");
         doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
 
@@ -749,13 +783,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateManagementV6AddressVnfNoUpdateTest() throws Exception {
+    public void updateManagementV6AddressVnfNoUpdateTest() {
         aaiUpdateTasks.updateManagementV6AddressVnf(execution);
         verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
     }
 
     @Test
-    public void updateOrchestrationStatusVnfConfigureTest() throws Exception {
+    public void updateOrchestrationStatusVnfConfigureTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.CONFIGURE);
 
@@ -763,7 +797,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusVnfConfiguredTest() throws Exception {
+    public void updateOrchestrationStatusVnfConfiguredTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.CONFIGURED);
 
@@ -777,7 +811,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusVnfConfigAssignedTest() throws Exception {
+    public void updateOrchestrationStatusVnfConfigAssignedTest() {
         doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGASSIGNED);
 
         aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-assign");
@@ -786,7 +820,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusVnfConfigDeployedTest() throws Exception {
+    public void updateOrchestrationStatusVnfConfigDeployedTest() {
         doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGDEPLOYED);
 
         aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-deploy");
@@ -795,7 +829,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusVfModuleConfigDeployedTest() throws Exception {
+    public void updateOrchestrationStatusVfModuleConfigDeployedTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.CONFIGDEPLOYED);
         aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-deploy");
@@ -804,7 +838,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateOrchestrationStatusVfModuleConfigAssignedTest() throws Exception {
+    public void updateOrchestrationStatusVfModuleConfigAssignedTest() {
         doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
                 OrchestrationStatus.CONFIGASSIGNED);
         aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-assign");
index 60bed17..9e70a66 100644 (file)
@@ -31,11 +31,14 @@ import java.util.Map;
 import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.adapters.nwrest.CreateNetworkRequest;
 import org.onap.so.adapters.nwrest.CreateNetworkResponse;
-import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -43,9 +46,20 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
 import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
 
-public class NetworkAdapterCreateTasksTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class NetworkAdapterCreateTasksTest extends TestDataSetup {
+
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected NetworkAdapterObjectMapper networkAdapterObjectMapper;
+    @Mock
+    protected NetworkAdapterResources networkAdapterResources;
     @InjectMocks
     private NetworkAdapterCreateTasks networkAdapterCreateTasks = new NetworkAdapterCreateTasks();
 
@@ -77,7 +91,7 @@ public class NetworkAdapterCreateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void createNetworkTest() throws Exception {
+    public void createNetworkTest() {
         String cloudRegionPo = "cloudRegionPo";
         CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
         execution.setVariable("cloudRegionPo", cloudRegionPo);
index eb48165..6c9ec59 100644 (file)
@@ -27,27 +27,36 @@ import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import java.io.UnsupportedEncodingException;
 import org.camunda.bpm.engine.delegate.BpmnError;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.client.adapter.network.NetworkAdapterClientException;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
 import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
 
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class NetworkAdapterDeleteTasksTest extends TestDataSetup {
 
-public class NetworkAdapterDeleteTasksTest extends BaseTaskTest {
-
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected ExceptionBuilder exceptionUtil;
+    @Mock
+    protected NetworkAdapterObjectMapper networkAdapterObjectMapper;
     @InjectMocks
     private NetworkAdapterDeleteTasks networkAdapterDeleteTasks = new NetworkAdapterDeleteTasks();
 
@@ -72,7 +81,7 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException {
+    public void test_deleteNetwork() {
         DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
         doReturn(deleteNetworkRequest).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext,
                 cloudRegion, serviceInstance, l3Network);
@@ -83,7 +92,7 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void test_deleteNetwork_exception() throws UnsupportedEncodingException, NetworkAdapterClientException {
+    public void test_deleteNetwork_exception() {
         expectedException.expect(BpmnError.class);
 
         doThrow(RuntimeException.class).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(
index 10cc09c..cf97fa0 100644 (file)
@@ -5,13 +5,20 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
 import static org.junit.Assert.assertNotNull;
 import javax.xml.bind.JAXBException;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.FileUtil;
 import org.onap.so.adapters.nwrest.CreateNetworkResponse;
-import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
 
-public class NetworkAdapterImplTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class NetworkAdapterImplTest extends TestDataSetup {
 
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
     @InjectMocks
     private NetworkAdapterImpl networkAdapterImpl = new NetworkAdapterImpl();
 
index 64a315a..082d410 100644 (file)
 package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.isA;
 import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import java.io.UnsupportedEncodingException;
 import java.util.Map;
-import java.util.Optional;
-import org.camunda.bpm.engine.delegate.BpmnError;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
-import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
-import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -50,11 +44,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.client.adapter.network.NetworkAdapterClientException;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
 import org.onap.so.client.exception.BBObjectNotFoundException;
-import org.springframework.beans.factory.annotation.Autowired;
 
-public class NetworkAdapterUpdateTasksTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class NetworkAdapterUpdateTasksTest extends TestDataSetup {
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected NetworkAdapterObjectMapper networkAdapterObjectMapper;
     @InjectMocks
     private NetworkAdapterUpdateTasks networkAdapterUpdateTasks = new NetworkAdapterUpdateTasks();
 
@@ -84,7 +83,7 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void updateNetworkTest() throws Exception {
+    public void updateNetworkTest() {
         String cloudRegionPo = "cloudRegionPo";
         UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
         execution.setVariable("cloudRegionPo", cloudRegionPo);
index 13f2b81..ef2e742 100644 (file)
@@ -30,12 +30,15 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import org.camunda.bpm.engine.delegate.BpmnError;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
 import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
-import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -44,9 +47,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
+import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
-public class VnfAdapterCreateTasksTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class VnfAdapterCreateTasksTest extends TestDataSetup {
+    @Mock
+    protected ExceptionBuilder exceptionUtil;
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
+    @Mock
+    protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
     @InjectMocks
     private VnfAdapterCreateTasks vnfAdapterCreateTasks = new VnfAdapterCreateTasks();
 
index c680978..e7b3d3e 100644 (file)
@@ -31,12 +31,15 @@ import static org.mockito.Mockito.when;
 import org.camunda.bpm.engine.delegate.BpmnError;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
 import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -45,8 +48,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-
-public class VnfAdapterDeleteTasksTest extends BaseTaskTest {
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
+import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class VnfAdapterDeleteTasksTest extends TestDataSetup {
+
+    @Mock
+    protected ExceptionBuilder exceptionUtil;
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+    @Mock
+    protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
     @InjectMocks
     private VnfAdapterDeleteTasks vnfAdapterDeleteTasks = new VnfAdapterDeleteTasks();
 
index 16e8c2d..51bd770 100644 (file)
@@ -30,22 +30,30 @@ import static org.mockito.Mockito.when;
 import org.camunda.bpm.engine.delegate.BpmnError;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.FileUtil;
-import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
 import org.onap.so.client.exception.BBObjectNotFoundException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class VnfAdapterImplTest extends BaseTaskTest {
-
+import org.onap.so.client.exception.ExceptionBuilder;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class VnfAdapterImplTest extends TestDataSetup {
+    @Mock
+    protected ExceptionBuilder exceptionUtil;
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
     @InjectMocks
     private VnfAdapterImpl vnfAdapterImpl = new VnfAdapterImpl();
 
@@ -159,12 +167,12 @@ public class VnfAdapterImplTest extends BaseTaskTest {
         execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE);
         vnfAdapterImpl.postProcessVnfAdapter(execution);
         assertNull(vfModule.getHeatStackId());
-        assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
-        assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), "");
-        assertEquals(genericVnf.getIpv4OamAddress(), "");
-        assertEquals(execution.getVariable("oamManagementV4Address"), "");
-        assertEquals(genericVnf.getManagementV6Address(), "");
-        assertEquals(execution.getVariable("oamManagementV6Address"), "");
+        assertEquals("", vfModule.getContrailServiceInstanceFqdn());
+        assertEquals("", execution.getVariable("contrailServiceInstanceFqdn"));
+        assertEquals("", genericVnf.getIpv4OamAddress());
+        assertEquals("", execution.getVariable("oamManagementV4Address"));
+        assertEquals("", genericVnf.getManagementV6Address());
+        assertEquals("", execution.getVariable("oamManagementV6Address"));
         assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
     }
 
index d7d6da2..ad96537 100644 (file)
@@ -34,13 +34,16 @@ import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Optional;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aai.domain.yang.Vserver;
 import org.onap.appc.client.lcm.model.Action;
 import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
 import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
-import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -48,14 +51,23 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.orchestration.AAIVnfResources;
 import org.onap.so.client.policy.JettisonStyleMapperProvider;
 import org.onap.so.db.catalog.beans.ControllerSelectionReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.db.catalog.client.CatalogDbClient;
 
-public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AppcOrchestratorPreProcessorTest extends TestDataSetup {
 
     private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
-
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected AAIVnfResources aaiVnfResources;
+    @Mock
+    protected CatalogDbClient catalogDbClient;
     @InjectMocks
     private AppcOrchestratorPreProcessor appcOrchestratorPreProcessor = new AppcOrchestratorPreProcessor();
 
@@ -111,7 +123,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
     }
 
     @Test
-    public void addVmInfoToAppcTaskRequestTest() throws Exception {
+    public void addVmInfoToAppcTaskRequestTest() {
         ApplicationControllerTaskRequest appcTaskRequest = new ApplicationControllerTaskRequest();
         ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
         appcTaskRequest.setApplicationControllerVnf(applicationControllerVnf);
index d2a38cb..e386dff 100644 (file)
@@ -37,25 +37,43 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aai.domain.yang.Vserver;
 import org.onap.appc.client.lcm.model.Action;
-import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.appc.ApplicationControllerAction;
 import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
 import org.onap.so.db.catalog.beans.ControllerSelectionReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.db.catalog.client.CatalogDbClient;
 
-public class AppcRunTasksTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AppcRunTasksTest extends TestDataSetup {
 
     private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
-
+    @Mock
+    protected ExtractPojosForBB extractPojosForBB;
+    @Mock
+    protected CatalogDbClient catalogDbClient;
+    @Mock
+    protected ExceptionBuilder exceptionUtil;
+    @Mock
+    protected ApplicationControllerAction appCClient;
+    @Mock
+    protected AAIVnfResources aaiVnfResources;
     @InjectMocks
     private AppcRunTasks appcRunTasks = new AppcRunTasks();
 
@@ -171,7 +189,7 @@ public class AppcRunTasksTest extends BaseTaskTest {
     }
 
     @Test
-    public void testUserParams() throws Exception {
+    public void testUserParams() {
         Map<String, Object> userParams = new HashMap<String, Object>();
         userParams.put("existing_software_version", "3.1");
         userParams.put("new_software_version", "3.2");
index cbb746d..2e4d99f 100644 (file)
@@ -35,6 +35,8 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -64,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.db.catalog.beans.BuildingBlockRollback;
 import org.onap.so.db.catalog.beans.ConfigurationResource;
 import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
@@ -108,6 +111,11 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
     @Mock
     private DelegateExecution mockExecution;
 
+    @Before
+    public void initCatalogDBRollbackTable() {
+        when(catalogDbClient.getBuildingBlockRollbackEntries()).thenReturn(getRollbackBuildingBlockList());
+    }
+
     @Before
     public void before() throws Exception {
         execution = new DelegateExecutionFake();
@@ -613,6 +621,52 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
         assertEquals(2, ebbs.size());
     }
 
+    @Test
+    public void rollbackExecutionRollbackControllerExecutionBBTest() {
+        execution.setVariable("isRollback", false);
+        execution.setVariable("handlingCode", "Rollback");
+        execution.setVariable("requestAction", EMPTY_STRING);
+        execution.setVariable("resourceName", EMPTY_STRING);
+        List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+        BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
+        ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+        flowsToExecute.add(ebb1);
+
+        BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB");
+        ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+        flowsToExecute.add(ebb2);
+
+        BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("AssignVnfBB");
+        ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+        flowsToExecute.add(ebb3);
+
+        BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+        ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+        flowsToExecute.add(ebb4);
+
+        BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ControllerExecutionBB");
+        buildingBlock5.setBpmnScope("vnf");
+        buildingBlock5.setBpmnAction("config-assign");
+        ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
+        flowsToExecute.add(ebb5);
+
+        BuildingBlock buildingBlock6 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+        ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock6);
+        flowsToExecute.add(ebb6);
+
+        execution.setVariable("flowsToExecute", flowsToExecute);
+        execution.setVariable("gCurrentSequence", 5);
+
+        workflowActionBBTasks.rollbackExecutionPath(execution);
+        List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+        BuildingBlock bb = ebbs.get(0).getBuildingBlock();
+        assertEquals("ControllerExecutionBB", bb.getBpmnFlowName());
+        assertEquals("vnf", bb.getBpmnScope());
+        assertEquals("config-unassign", bb.getBpmnAction());
+        assertEquals(0, execution.getVariable("gCurrentSequence"));
+        assertEquals(5, ebbs.size());
+    }
+
     @Test
     public void postProcessingExecuteBBActivateVfModuleNotReplaceInstanceTest() throws CloneNotSupportedException {
         WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
@@ -1061,4 +1115,40 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
         execution.setVariable("homing", false);
         execution.setVariable("calledHoming", false);
     }
+
+    private List<BuildingBlockRollback> getRollbackBuildingBlockList() {
+        List<BuildingBlockRollback> rollbackBBList = Collections.unmodifiableList(Arrays.asList(
+                new BuildingBlockRollback(1, "ActivateNetworkBB", null, "DeactivateNetworkBB", null),
+                new BuildingBlockRollback(2, "ActivatePnfBB", null, "DeactivatePnfBB", null),
+                new BuildingBlockRollback(3, "ActivateServiceInstanceBB", null, "DeactivateServiceInstanceBB", null),
+                new BuildingBlockRollback(4, "ActivateVfModuleBB", null, "DeactivateVfModuleBB", null),
+                new BuildingBlockRollback(5, "ActivateVnfBB", null, "DeactivateVnfBB", null),
+                new BuildingBlockRollback(6, "ActivateVolumeGroupBB", null, "DeactivateVolumeGroupBB", null),
+                new BuildingBlockRollback(7, "AssignNetworkBB", null, "UnassignNetworkBB", null),
+                new BuildingBlockRollback(8, "AssignServiceInstanceBB", null, "UnassignServiceInstanceBB", null),
+                new BuildingBlockRollback(9, "AssignVfModuleBB", null, "UnassignVfModuleBB", null),
+                new BuildingBlockRollback(10, "AssignVnfBB", null, "UnassignVnfBB", null),
+                new BuildingBlockRollback(11, "AssignVolumeGroupBB", null, "UnassignVolumeGroupBB", null),
+                new BuildingBlockRollback(12, "ControllerExecutionBB", "config-assign", "ControllerExecutionBB",
+                        "config-unassign"),
+                new BuildingBlockRollback(13, "ControllerExecutionBB", "config-deploy", "ControllerExecutionBB",
+                        "config-undeploy"),
+                new BuildingBlockRollback(14, "ControllerExecutionBB", "service-config-deploy", "ControllerExecutionBB",
+                        "service-config-undeploy"),
+                new BuildingBlockRollback(15, "CreateNetworkBB", null, "DeleteNetworkBB", null),
+                new BuildingBlockRollback(16, "CreateNetworkCollectionBB", null, "DeleteNetworkCollectionBB", null),
+                new BuildingBlockRollback(17, "CreateVfModuleBB", null, "DeleteVfModuleBB", null),
+                new BuildingBlockRollback(18, "CreateVolumeGroupBB", null, "DeleteVolumeGroupBB", null),
+                new BuildingBlockRollback(19, "VNFSetInMaintFlagActivity", null, "VNFUnsetInMaintFlagActivity", null),
+                new BuildingBlockRollback(20, "VNFSetClosedLoopDisabledFlagActivity", null,
+                        "VNFUnsetClosedLoopDisabledFlagActivity", null),
+                new BuildingBlockRollback(21, "VNFLockActivity", null, "VNFUnlockActivity", null),
+                new BuildingBlockRollback(22, "VNFStopActivity", null, "VNFStartActivity", null),
+                new BuildingBlockRollback(23, "VNFQuiesceTrafficActivity", null, "VNFResumeTrafficActivity", null),
+                new BuildingBlockRollback(24, "EtsiVnfInstantiateBB", null, "EtsiVnfDeleteBB", null),
+                // AddFabricConfigurationBB this does not seem to be present as a bpmn in Guilin
+                new BuildingBlockRollback(25, "AddFabricConfigurationBB", null, "DeleteFabricConfigurationBB", null)));
+        return rollbackBBList;
+    }
+
 }
index 52196aa..a044944 100644 (file)
@@ -409,6 +409,10 @@ public class WorkflowActionTest extends BaseTaskTest {
 
         serviceInstanceMSO.getVnfs().add(vnf);
 
+        VfModule aaiVfModule = new VfModule();
+        aaiVfModule.setIsBaseVfModule(false);
+
+        doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
         doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0");
         doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
         doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any());
@@ -932,6 +936,10 @@ public class WorkflowActionTest extends BaseTaskTest {
         serviceInstanceMSO.getVnfs().add(vnf);
         serviceInstanceMSO.getPnfs().add(pnf);
 
+        VfModule aaiVfModule = new VfModule();
+        aaiVfModule.setIsBaseVfModule(false);
+
+        doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
         doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
         doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
         doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any());
@@ -1013,6 +1021,10 @@ public class WorkflowActionTest extends BaseTaskTest {
 
         serviceInstanceMSO.getVnfs().add(vnf);
 
+        VfModule aaiVfModule = new VfModule();
+        aaiVfModule.setIsBaseVfModule(false);
+
+        doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
         doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
         doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
         doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any());
@@ -1104,6 +1116,11 @@ public class WorkflowActionTest extends BaseTaskTest {
 
         serviceInstanceMSO.getVnfs().add(vnf);
 
+        org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule();
+        aaiVfModule.setIsBaseVfModule(false);
+
+        doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
+        doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(bbSetupUtils).getAAIGenericVnf(vnf.getVnfId());
         doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
         doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
         when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
@@ -1151,21 +1168,26 @@ public class WorkflowActionTest extends BaseTaskTest {
         vfModule2.setVfModuleId("vfModule2");
         vnf.getVfModules().add(vfModule2);
         serviceInstanceMSO.getVnfs().add(vnf);
-        VfModule vfModuleAAI = new VfModule();
-        vfModuleAAI.setVfModuleId("vfModule2");
+        VfModule vfModuleAAI1 = new VfModule();
+        vfModuleAAI1.setIsBaseVfModule(false);
+        VfModule vfModuleAAI2 = new VfModule();
+        vfModuleAAI2.setIsBaseVfModule(false);
+        vfModuleAAI2.setVfModuleId("vfModule2");
         RelationshipList relationshipList = new RelationshipList();
         Relationship relationship = new Relationship();
         relationshipList.getRelationship().add(relationship);
-        vfModuleAAI.setRelationshipList(relationshipList);
+        vfModuleAAI2.setRelationshipList(relationshipList);
         Relationships relationships = new Relationships("abc");
         Configuration config = new Configuration();
         config.setConfigurationId("configId");
         Optional<Configuration> configOp = Optional.of(config);
         Optional<Relationships> relationshipsOp = Optional.of(relationships);
 
+        doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(bbSetupUtils).getAAIGenericVnf(vnf.getVnfId());
         doReturn(relationshipsOp).when(workflowActionUtils).extractRelationshipsVnfc(isA(Relationships.class));
         doReturn(configOp).when(workflowActionUtils).extractRelationshipsConfiguration(isA(Relationships.class));
-        doReturn(vfModuleAAI).when(bbSetupUtils).getAAIVfModule("1234", "vfModule2");
+        doReturn(vfModuleAAI1).when(bbSetupUtils).getAAIVfModule("1234", "vfModule1");
+        doReturn(vfModuleAAI2).when(bbSetupUtils).getAAIVfModule("1234", "vfModule2");
         doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
         doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
         when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
index 9377dae..2d41a24 100644 (file)
@@ -243,6 +243,9 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
         aaiConfiguration2.setConfigurationId("testConfigurationId2");
         aaiConfiguration2.setRelationshipList(relationshipList1);
 
+        org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule();
+        aaiVfModule.setIsBaseVfModule(true);
+
         try {
             doReturn(genericVnfAai).when(mockBbInputSetupUtils).getAAIGenericVnf(genericVnf.getVnfId());
             doReturn(serviceInstanceAAI).when(mockBbInputSetupUtils).getAAIServiceInstanceById(resourceId);
@@ -251,6 +254,7 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
                     .getConfiguration("testConfigurationId");
             doReturn(Optional.of(aaiConfiguration2)).when(mockAaiConfigurationResources)
                     .getConfiguration("testConfigurationId2");
+            doReturn(aaiVfModule).when(mockBbInputSetupUtils).getAAIVfModule(any(), any());
             serviceEBBLoader.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
             assertEquals(8, resourceCounter.size());
             assertTrue(resourceCounter.get(2).isBaseVfModule());
index 78a9628..2775c6d 100644 (file)
@@ -47,12 +47,14 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.only;
 
 
 public class VnfEBBLoaderTest {
 
     private String serviceId;
     private String vnfId;
+    private String vfModuleId;
     private BBInputSetupUtils bbInputSetupUtils;
     private BBInputSetup bbInputSetup;
     private WorkflowActionExtractResourcesAAI workflowActionUtils;
@@ -67,6 +69,7 @@ public class VnfEBBLoaderTest {
     public void setup() {
         serviceId = "service123";
         vnfId = "vnf123";
+        vfModuleId = "vfModule123";
         serviceInstanceAAI = mock(org.onap.aai.domain.yang.ServiceInstance.class);
         serviceInstanceMSO = mock(ServiceInstance.class);
         bbInputSetupUtils = mock(BBInputSetupUtils.class);
@@ -95,11 +98,19 @@ public class VnfEBBLoaderTest {
         GenericVnf genericVnf = mock(GenericVnf.class);
         doReturn(vnfId).when(genericVnf).getVnfId();
 
+        org.onap.aai.domain.yang.GenericVnf aaiVnf = mock(org.onap.aai.domain.yang.GenericVnf.class);
+        doReturn(aaiVnf).when(bbInputSetupUtils).getAAIGenericVnf(vnfId);
+
         VfModule vfModule = mock(VfModule.class);
+        doReturn(vfModuleId).when(vfModule).getVfModuleId();
         ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
         modelInfoVfModule.setIsBaseBoolean(true);
         doReturn(modelInfoVfModule).when(vfModule).getModelInfoVfModule();
 
+        org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule();
+        aaiVfModule.setIsBaseVfModule(true);
+        doReturn(aaiVfModule).when(bbInputSetupUtils).getAAIVfModule(vnfId, vfModuleId);
+
         doReturn(serviceInstanceAAI).when(bbInputSetupUtils).getAAIServiceInstanceById(serviceId);
         doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
         doReturn(List.of(genericVnf)).when(serviceInstanceMSO).getVnfs();
index b23147e..1fbee2d 100644 (file)
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.when;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.UUID;
 import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
 import org.junit.Before;
 import org.junit.Test;
@@ -34,6 +35,8 @@ import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.bpmn.common.BBConstants;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
 import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.db.catalog.beans.PnfResourceCustomization;
@@ -41,7 +44,6 @@ import org.onap.so.db.catalog.beans.Service;
 import org.onap.so.db.catalog.beans.VfModuleCustomization;
 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
 import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.serviceinstancebeans.ModelInfo;
 import org.onap.so.serviceinstancebeans.RequestDetails;
 
 @RunWith(MockitoJUnitRunner.Silent.class)
@@ -51,25 +53,24 @@ public class SkipCDSBuildingBlockListenerTest {
     private static final String VNF_SCOPE = "VNF";
     private static final String VF_SCOPE = "VFModule";
     private static final String PNF_SCOPE = "pnf";
-    private static final String TEST_MODELUUID = "123456789";
     private static final String VNF_TEST_ACTION = "VnfConfigAssign";
     private static final String VFModule_TEST_ACTION = "VfModuleConfigAssign";
     private static final String PNFModule_TEST_ACTION = "config-assign";
-    private static final String MODELCUSTOMIZATIONUUID = "123456789";
+    private static final String SERVICE_MODEL_VERSION_ID = UUID.randomUUID().toString();
+    private static final String VNF_MODEL_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+    private static final String VF_MODULE_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+    private static final String PNF_CUSTOMIZATION_ID = UUID.randomUUID().toString();
     private static final String BBNAME = "ControllerExecutionBB";
     private static final boolean ISFIRST = true;
 
-    private int actual;
     private List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
-    private List<VnfResourceCustomization> vnfResourceCustomization;
-    private List<VfModuleCustomization> vfModuleCustomization;
-    private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+    private ExecuteBuildingBlock executeBuildingBlock;
     private RequestDetails reqDetail = new RequestDetails();
     private BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake());
-    private VnfResourceCustomization vnfCust = new VnfResourceCustomization();
-    private VfModuleCustomization vfCust = new VfModuleCustomization();
-    private PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
-    private BuildingBlock buildingBlock = new BuildingBlock();
+    private VnfResourceCustomization vnfCust;
+    private VfModuleCustomization vfCust;
+    private PnfResourceCustomization pnfResourceCustomization;
+    private BuildingBlock buildingBlock;
 
     @InjectMocks
     private SkipCDSBuildingBlockListener skipCDSBuildingBlockListener;
@@ -78,10 +79,27 @@ public class SkipCDSBuildingBlockListenerTest {
 
     @Before
     public void before() {
-        ModelInfo model = new ModelInfo();
-        model.setModelUuid(TEST_MODELUUID);
-        reqDetail.setModelInfo(model);
-        executeBuildingBlock.setRequestDetails(reqDetail);
+        executeBuildingBlock = new ExecuteBuildingBlock();
+        buildingBlock = new BuildingBlock();
+
+        ArrayList<Resource> resources = new ArrayList<>();
+        Resource service = new Resource(WorkflowType.SERVICE, SERVICE_MODEL_VERSION_ID, false, null);
+        service.setModelVersionId(SERVICE_MODEL_VERSION_ID);
+        resources.add(service);
+        Resource vnf = new Resource(WorkflowType.VNF, VNF_MODEL_CUSTOMIZATION_ID, false, null);
+        vnf.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_ID);
+        resources.add(vnf);
+        Resource vfModule = new Resource(WorkflowType.VFMODULE, VF_MODULE_CUSTOMIZATION_ID, false, null);
+        vfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_ID);
+        resources.add(vfModule);
+        Resource pnf = new Resource(WorkflowType.PNF, PNF_CUSTOMIZATION_ID, false, null);
+        pnf.setModelCustomizationId(PNF_CUSTOMIZATION_ID);
+        resources.add(pnf);
+        buildingBlockExecution.setVariable("resources", resources);
+
+        vnfCust = new VnfResourceCustomization();
+        vfCust = new VfModuleCustomization();
+        pnfResourceCustomization = new PnfResourceCustomization();
     }
 
     @Test
@@ -93,133 +111,83 @@ public class SkipCDSBuildingBlockListenerTest {
 
     @Test
     public void testSkipCDSforService() {
-        setBuildingBlockAndCurrentSequence(SERVICE_SCOPE, "service-config-assign", 0);
-        Service service = new Service();
-        when(catalogDbClient.getServiceByID(TEST_MODELUUID)).thenReturn(service);
+        setBuildingBlockAndCurrentSequence(SERVICE_SCOPE, "service-config-assign", SERVICE_MODEL_VERSION_ID, 0);
+        when(catalogDbClient.getServiceByID(SERVICE_MODEL_VERSION_ID)).thenReturn(new Service());
 
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(1, actual);
+        assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
     @Test
     public void testProcessForVNFToSkipCDSBB() {
-        // given
-        setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0);
-        vnfResourceCustomization = getVnfResourceCustomizationList(true);
+        setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, VNF_MODEL_CUSTOMIZATION_ID, 0);
+        when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(VNF_MODEL_CUSTOMIZATION_ID))
+                .thenReturn(vnfCust);
 
-        when(catalogDbClient.getVnfResourceCustomizationByModelUuid(
-                executeBuildingBlock.getRequestDetails().getModelInfo().getModelUuid()))
-                        .thenReturn(vnfResourceCustomization);
-        when(catalogDbClient.findVnfResourceCustomizationInList(executeBuildingBlock.getBuildingBlock().getKey(),
-                vnfResourceCustomization)).thenReturn(vnfCust);
-
-        // when
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        // then
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(1, actual);
-
+        assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
     @Test
     public void testProcessForVNFNotToSkipCDSBB() {
-        // given
-        setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0);
-        vnfResourceCustomization = getVnfResourceCustomizationList(false);
-
-        when(catalogDbClient.getVnfResourceCustomizationByModelUuid(
-                executeBuildingBlock.getRequestDetails().getModelInfo().getModelUuid()))
-                        .thenReturn(vnfResourceCustomization);
-        when(catalogDbClient.findVnfResourceCustomizationInList(executeBuildingBlock.getBuildingBlock().getKey(),
-                vnfResourceCustomization)).thenReturn(vnfCust);
+        setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, VNF_MODEL_CUSTOMIZATION_ID, 0);
+        vnfCust.setSkipPostInstConf(false);
+        when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(VNF_MODEL_CUSTOMIZATION_ID))
+                .thenReturn(vnfCust);
 
-        // when
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        // then
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(0, actual);
-
+        assertEquals(0, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
 
     @Test
     public void testProcessForVFToSkipCDSBB() {
-        // given
-        setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0);
-        vfModuleCustomization = getVfModuleCustomizationList(true);
-
-        when(catalogDbClient
-                .getVfModuleCustomizationByModelCuztomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
-                        .thenReturn(vfCust);
+        setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, VF_MODULE_CUSTOMIZATION_ID, 0);
+        when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(VF_MODULE_CUSTOMIZATION_ID))
+                .thenReturn(vfCust);
 
-        // when
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        // then
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(1, actual);
-
+        assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
     @Test
     public void testProcessForVFNotToSkipCDSBB() {
-        // given
-        setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0);
-        vfModuleCustomization = getVfModuleCustomizationList(false);
-
+        setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, VF_MODULE_CUSTOMIZATION_ID, 0);
+        vfCust.setSkipPostInstConf(false);
         when(catalogDbClient
                 .getVfModuleCustomizationByModelCuztomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
                         .thenReturn(vfCust);
 
-        // when
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        // then
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(0, actual);
-
+        assertEquals(0, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
     @Test
     public void testProcessForPNFToSkipCDSBB() {
-        // given
-        setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
-        pnfResourceCustomization = getPnfResourceCustomization(true);
-
-        when(catalogDbClient
-                .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
-                        .thenReturn(pnfResourceCustomization);
+        setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, PNF_CUSTOMIZATION_ID, 0);
+        when(catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(PNF_CUSTOMIZATION_ID))
+                .thenReturn(pnfResourceCustomization);
 
-        // when
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        // then
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(1, actual);
-
+        assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
     @Test
     public void testProcessForPNFNotToSkipCDSBB() {
-        // given
-        setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
-        pnfResourceCustomization = getPnfResourceCustomization(false);
-
-        when(catalogDbClient
-                .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
-                        .thenReturn(pnfResourceCustomization);
+        setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, PNF_CUSTOMIZATION_ID, 0);
+        pnfResourceCustomization.setSkipPostInstConf(false);
+        when(catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(PNF_CUSTOMIZATION_ID))
+                .thenReturn(pnfResourceCustomization);
 
-        // when
         skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
 
-        // then
-        actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
-        assertEquals(0, actual);
-
+        assertEquals(0, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE));
     }
 
     /**
@@ -229,37 +197,13 @@ public class SkipCDSBuildingBlockListenerTest {
      * @param action
      * @param squence
      */
-    private void setBuildingBlockAndCurrentSequence(String scope, String action, int sequence) {
+    private void setBuildingBlockAndCurrentSequence(String scope, String action, String key, int sequence) {
         buildingBlock.setBpmnScope(scope);
         buildingBlock.setBpmnAction(action);
         buildingBlock.setBpmnFlowName("ControllerExecutionBB");
-        buildingBlock.setKey(MODELCUSTOMIZATIONUUID);
+        buildingBlock.setKey(key);
         executeBuildingBlock.setBuildingBlock(buildingBlock);
         buildingBlockExecution.setVariable(BBConstants.G_CURRENT_SEQUENCE, sequence);
-
-    }
-
-    private List<VnfResourceCustomization> getVnfResourceCustomizationList(boolean setSkippost) {
-        List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
-        vnfCust.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
-        vnfCust.setSkipPostInstConf(setSkippost);
-        vnfResourceCustomizations.add(vnfCust);
-        return vnfResourceCustomizations;
-    }
-
-    private List<VfModuleCustomization> getVfModuleCustomizationList(boolean setSkippost) {
-        List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>();
-        vfCust.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
-        vfCust.setSkipPostInstConf(setSkippost);
-        vfModuleCustomizations.add(vfCust);
-        return vfModuleCustomizations;
-    }
-
-    private PnfResourceCustomization getPnfResourceCustomization(boolean setSkippost) {
-        PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
-        pnfResourceCustomization.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
-        pnfResourceCustomization.setSkipPostInstConf(setSkippost);
-        return pnfResourceCustomization;
     }
 
 }
index 5146685..df137d0 100644 (file)
@@ -56,4 +56,7 @@ public class ServiceInfo implements Serializable {
     private String pLMNIdList;
 
     private String actionType;
+
+    private String resourceSharingLevel;
+
 }
index 7cc940d..2b31561 100644 (file)
@@ -176,6 +176,7 @@ public class SliceProfileAdapter implements Serializable {
         BeanUtils.copyProperties(this, tnSliceProfile);
         tnSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|")));
         tnSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
+        tnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
         return tnSliceProfile;
     }
 }
index 14b1ab5..90df220 100644 (file)
@@ -42,7 +42,7 @@ public class Service implements Serializable {
     @JsonProperty("instanceName")
     protected String instanceName;
     @JsonProperty("instanceParams")
-    private List<Map<String, String>> instanceParams = new ArrayList<>();
+    private List<Map<String, Object>> instanceParams = new ArrayList<>();
     @JsonProperty("resources")
     protected Resources resources;
     @JsonProperty("processingPriority")
@@ -73,11 +73,11 @@ public class Service implements Serializable {
         this.instanceName = instanceName;
     }
 
-    public List<Map<String, String>> getInstanceParams() {
+    public List<Map<String, Object>> getInstanceParams() {
         return instanceParams;
     }
 
-    public void setInstanceParams(List<Map<String, String>> instanceParams) {
+    public void setInstanceParams(List<Map<String, Object>> instanceParams) {
         this.instanceParams = instanceParams;
     }
 
index e9e8fe7..3966d18 100644 (file)
@@ -97,4 +97,113 @@ public class HttpClientTest {
                 postRequestedFor(urlEqualTo("/services/sdnc/post")).withHeader("Accept", equalTo("application/json")));
     }
 
+    @Test
+    public void testPostUsingXmlClient_success() throws MalformedURLException {
+
+        wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post"))
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody("")));
+
+        URL url = new URL("http://localhost:" + wireMockRule.port() + "/services/sdnc/post");
+        HttpClient client = httpClientFactory.newXmlClient(url, ONAPComponents.BPMN);
+
+        client.addBasicAuthHeader(
+                "97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF",
+                "123");
+        client.addAdditionalHeader("Accept", "application/xml");
+
+        client.post("{}");
+
+        verify(exactly(1), postRequestedFor(urlEqualTo("/services/sdnc/post")));
+    }
+
+    @Test
+    public void testPostUsingXmlClient_nullHeader() throws MalformedURLException {
+
+        wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post"))
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody("")));
+
+        URL url = new URL("http://localhost:" + wireMockRule.port() + "/services/sdnc/post");
+        HttpClient client = httpClientFactory.newXmlClient(url, ONAPComponents.BPMN);
+
+        client.accept = "application/xml";
+        client.addAdditionalHeader("id", null);
+
+        client.post("{}");
+
+        verify(exactly(1),
+                postRequestedFor(urlEqualTo("/services/sdnc/post")).withHeader("Accept", equalTo("application/xml")));
+    }
+
+    @Test
+    public void testPostUsingXmlClient_nullBasicAuth() throws MalformedURLException {
+
+        wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post"))
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody("")));
+
+        URL url = new URL("http://localhost:" + wireMockRule.port() + "/services/sdnc/post");
+        HttpClient client = httpClientFactory.newXmlClient(url, ONAPComponents.BPMN);
+
+        client.accept = "application/xml";
+        client.addBasicAuthHeader("", "12345");
+
+        client.post("{}");
+
+        verify(exactly(1),
+                postRequestedFor(urlEqualTo("/services/sdnc/post")).withHeader("Accept", equalTo("application/xml")));
+    }
+
+    @Test
+    public void testPostUsingTextXmlClient_success() throws MalformedURLException {
+
+        wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post"))
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody("")));
+
+        URL url = new URL("http://localhost:" + wireMockRule.port() + "/services/sdnc/post");
+        HttpClient client = httpClientFactory.newTextXmlClient(url, ONAPComponents.BPMN);
+
+        client.addBasicAuthHeader(
+                "97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF",
+                "123");
+        client.addAdditionalHeader("Accept", "text/xml");
+
+        client.post("{}");
+
+        verify(exactly(1), postRequestedFor(urlEqualTo("/services/sdnc/post")));
+    }
+
+    @Test
+    public void testPostUsingTextXmlClient_nullHeader() throws MalformedURLException {
+
+        wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post"))
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody("")));
+
+        URL url = new URL("http://localhost:" + wireMockRule.port() + "/services/sdnc/post");
+        HttpClient client = httpClientFactory.newTextXmlClient(url, ONAPComponents.BPMN);
+
+        client.addAdditionalHeader("Accept", "text/xml");
+        client.addAdditionalHeader("id", null);
+
+        client.post("{}");
+
+        verify(exactly(1),
+                postRequestedFor(urlEqualTo("/services/sdnc/post")).withHeader("Accept", equalTo("text/xml")));
+    }
+
+    @Test
+    public void testPostUsingTextXmlClient_nullBasicAuth() throws MalformedURLException {
+
+        wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post"))
+                .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody("")));
+
+        URL url = new URL("http://localhost:" + wireMockRule.port() + "/services/sdnc/post");
+        HttpClient client = httpClientFactory.newTextXmlClient(url, ONAPComponents.BPMN);
+
+        client.addBasicAuthHeader("", "12345");
+        client.addAdditionalHeader("Accept", "text/xml");
+
+        client.post("{}");
+
+        verify(exactly(1),
+                postRequestedFor(urlEqualTo("/services/sdnc/post")).withHeader("Accept", equalTo("text/xml")));
+    }
 }
diff --git a/common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java b/common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java
new file mode 100644 (file)
index 0000000..51de61a
--- /dev/null
@@ -0,0 +1,45 @@
+package org.onap.so.security;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import java.util.ArrayList;
+import org.junit.Test;
+import java.util.List;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+public class UserDetailsServiceImplTest {
+
+    private static final String USERNAME = "usernameTest";
+    private static final String PASSWORD = "passTest";
+    private static final String ROLE = "roleTest";
+
+    @Test
+    public void loadUserByUsername_Success() {
+        UserDetailsServiceImpl testedObject = new UserDetailsServiceImpl();
+        testedObject.setUsercredentials(prepareUserCredentials());
+        UserDetails result = testedObject.loadUserByUsername(USERNAME);
+        assertThat(result.getUsername()).isEqualTo(USERNAME);
+        assertThat(result.getPassword()).isEqualTo(PASSWORD);
+    }
+
+    @Test
+    public void loadUserByUsername_userNotFoundEx() {
+        UserDetailsServiceImpl testedObject = new UserDetailsServiceImpl();
+        testedObject.setUsercredentials(prepareUserCredentials());
+        assertThatThrownBy(() -> testedObject.loadUserByUsername("notExistingUser"))
+                .isInstanceOf(UsernameNotFoundException.class);
+    }
+
+    private List<UserCredentials> prepareUserCredentials() {
+        UserCredentials userCredentials = new UserCredentials();
+        userCredentials.setUsername(USERNAME);
+        userCredentials.setPassword(PASSWORD);
+        userCredentials.setRole(ROLE);
+        List<UserCredentials> list = new ArrayList<>();
+        list.add(userCredentials);
+        return list;
+    }
+
+
+}
index 3472b92..ccb7ee7 100644 (file)
Binary files a/docs/architecture/SO Internal Arc.pptx and b/docs/architecture/SO Internal Arc.pptx differ
index d59429a..7cfb276 100644 (file)
@@ -9,7 +9,7 @@ SO - Architecture
 SO Functional View
 ------------------
 
-.. image:: ../images/SO_Architecture_1.png
+.. image:: ../images/SO_Architecture_2.png
 
 SO Deployment View
 --------------------
@@ -110,9 +110,22 @@ SO Sub-Components
    * Create, Instantiate, Terminate and Delete VNF, including Granting, Subscription and Lifecycle Notifications
    * Tracking capability which VNFM instance has handled with which VNF instance
    * BPMN Building Block workflows and Java-based recipes for VNF LCM
+   * Conformance of SOL001 VNFD and SOL004 VNF package specifications
+   * Interfacing with the ETSI Catalog Manager (a.k.a. etsicatalog) for retrieving ETSI VNF descriptors and artifacts
    * VNFM Simulator for validating SO VNFM Adapter NBI and SBI for integration testing
-   * The SO ETSI CSIT Tests and running them, https://wiki.onap.org/display/DW/SO+ETSI+CSIT
-   * Testing the SO ETSI Alignment manually (Instantiate VNF using SVNFM), https://wiki.onap.org/pages/viewpage.action?pageId=68524128
+
+.. image:: ../images/SO-SOL003-Adapter-Architecture-1.png
+
+**SO ETSI NFVO**
+
+  Support ETSI NFVO functions which manages Network Service LCM
+   * Create, Instantiate, Terminate and Delete NS
+   * Decomposing an NS request into associated VNF request(s) and managing VNF LCM (Create, Instantiate, Terminate, Delete VNF) through SO VNFMN Adapter
+   * Leveraging SOL005 for its NBI and SOl003 for its SBI
+   * Conformance of SOL001 NSD and SOL007 NS package specifications
+   * Interfacing with the ETSI Catalog Manager (a.k.a. etsicatalog) for retrieving ETSI NS descriptors and artifacts
+
+.. image:: ../images/SO-NFVO-Architecture-1.png
 
 Third Party and Open Source
 ---------------------------
index b1ef356..3af3dc8 100644 (file)
@@ -16,8 +16,8 @@ curl -v -H "Content-Type: application/json" -X POST --data @request_body_file_na
 
  Request Body:
 
- {
-   "service":{
    {
+    "service":{
        "name":"SliceService",
        "description":"SliceService",
        "serviceInvariantUuid":"dfcd7471-16c7-444e-8268-d4c50d90593a",
@@ -62,18 +62,18 @@ curl -v -H "Content-Type: application/json" -X POST --data @request_body_file_na
               "nstar0_allottedresource0_providing_service_invariant_uuid": "1899e5c1-df4e-43a8-a889-48c157dad7bc"
            }
        }
-   }
+    }
 
 .. code-block:: bash
 
  Response body:
  
-  {
+    {
     "service": { 
         "serviceId": "ebe2d37f-f65b-43d8-8906-f81811ed8f22",
         "operationId": "ed9b4c84-17db-4874-8896-25324a0401fe"
+      }
     }
- }
 
 
 Code flows:
@@ -120,8 +120,8 @@ Payload will be reaching to bpmn in the form of:
 
 .. code-block:: bash
 
- {
-   "variables": {
   {
+    "variables": {
       "bpmnRequest": {
          "value": {
             "requestDetails": {
@@ -305,8 +305,8 @@ Payload will be reaching to bpmn in the form of:
          "value": false,
          "type": "Boolean"
       }
-   }
- }
+     }
   }
 
 Based on the serviceUuid which is mentioned in the request body it will call the the CreateCommunicationService.bpmn file and This CreateCommunicationService.bpmn is taken as a example to this workflow Understanding which then call the subprocess of this flow and so on.
 
@@ -349,8 +349,8 @@ Based on the serviceUuid which is mentioned in the request body it will call the
 
 .. code-block:: bash
 
- {
-   "serviceResources": {
   {
+    "serviceResources": {
       "modelInfo": {
          "modelName": "CST",
          "modelUuid": "bfc2775b-64ad-41e5-95fe-d3bc57df6c73",
@@ -547,8 +547,8 @@ Based on the serviceUuid which is mentioned in the request body it will call the
          }
       ],
       "serviceAllottedResources": []
-   }
- }
+     }
   }
 
 5. CreateCommunicationService--> prepareDoComposeE2E()
 
@@ -572,17 +572,17 @@ Based on the serviceUuid which is mentioned in the request body it will call the
  
  d. Request body for PUT request to the AAI from bpmn:
 
-{
-   "service-instance-name": "SliceService",
-   "service-role": "communication-service",
-   "environment-context": "01-70CAA6B",
-   "created-at": "2020-06-23 05:02:56",
-   "model-invariant-id": "d4df55ca-c985-46c9-8088-f952181f553e",
-   "model-version-id": "bfc2775b-64ad-41e5-95fe-d3bc57df6c73",
-   "orchestration-status": "processing",
-   "input-parameters": "{   \"service\":{       \"name\":\"SliceService\",       \"description\":\"SliceService\",       \"serviceInvariantUuid\":\"d4df55ca-c985-46c9-8088-f952181f553e\",       \"serviceUuid\":\"bfc2775b-64ad-41e5-95fe-d3bc57df6c73\",       \"globalSubscriberId\":\"5GCustomer\",       \"serviceType\":\"5G\",       \"parameters\":{           \"locationConstraints\":[           ],           \"resources\":[               {                   \"resourceIndex\":\"1\",                   \"resourceName\":\"allottedResource\",                   \"resourceInvariantUuid\":\"eeefcd86-7b5b-41ae-9516-08acc5d59d92\",                   \"resourceUuid\":\"265da937-76c7-4152-98e3-5f0d0a844b7f\",                   \"resourceCustomizationUuid\":\"a4eda1d9-1af4-424b-997f-12c57b74c67a\",                   \"parameters\":{                       \"locationConstraints\":[                       ],                       \"resources\":[                       ],                       \"requestInputs\":{                       }                   }               }           ],           \"requestInputs\":{\t\t\t   \"sST\": \"embb\",               \"sNSSAI\": \"1-10101\",               \"uEMobilityLevel\": \"stationary\",               \"areaTrafficCapDL\": 123,               \"maxNumberofUEs\": 1000,               \"expDataRateUL\": 2000,               \"plmnIdList\": \"39-00|39-01\",               \"areaTrafficCapUL\": 456,               \"latency\": 300,               \"expDataRateDL\": 400,               \"coverageAreaTAList\": 101001,               \"activityFactor\": 99,               \"resourceSharingLevel\": \"shared\",              \"nstar0_allottedresource0_providing_service_uuid\": \"4e8d930b-7483-4b9b-8c82-4708638ade4a\",              \"nstar0_allottedresource0_providing_service_invariant_uuid\": \"1899e5c1-df4e-43a8-a889-48c157dad7bc\"           }       }   }}"
-
-}
+    {
+       "service-instance-name": "SliceService",
+       "service-role": "communication-service",
+       "environment-context": "01-70CAA6B",
+       "created-at": "2020-06-23 05:02:56",
+       "model-invariant-id": "d4df55ca-c985-46c9-8088-f952181f553e",
+       "model-version-id": "bfc2775b-64ad-41e5-95fe-d3bc57df6c73",
+       "orchestration-status": "processing",
+       "input-parameters": "{   \"service\":{       \"name\":\"SliceService\",       \"description\":\"SliceService\",       \"serviceInvariantUuid\":\"d4df55ca-c985-46c9-8088-f952181f553e\",       \"serviceUuid\":\"bfc2775b-64ad-41e5-95fe-d3bc57df6c73\",       \"globalSubscriberId\":\"5GCustomer\",       \"serviceType\":\"5G\",       \"parameters\":{           \"locationConstraints\":[           ],           \"resources\":[               {                   \"resourceIndex\":\"1\",                   \"resourceName\":\"allottedResource\",                   \"resourceInvariantUuid\":\"eeefcd86-7b5b-41ae-9516-08acc5d59d92\",                   \"resourceUuid\":\"265da937-76c7-4152-98e3-5f0d0a844b7f\",                   \"resourceCustomizationUuid\":\"a4eda1d9-1af4-424b-997f-12c57b74c67a\",                   \"parameters\":{                       \"locationConstraints\":[                       ],                       \"resources\":[                       ],                       \"requestInputs\":{                       }                   }               }           ],           \"requestInputs\":{\t\t\t   \"sST\": \"embb\",               \"sNSSAI\": \"1-10101\",               \"uEMobilityLevel\": \"stationary\",               \"areaTrafficCapDL\": 123,               \"maxNumberofUEs\": 1000,               \"expDataRateUL\": 2000,               \"plmnIdList\": \"39-00|39-01\",               \"areaTrafficCapUL\": 456,               \"latency\": 300,               \"expDataRateDL\": 400,               \"coverageAreaTAList\": 101001,               \"activityFactor\": 99,               \"resourceSharingLevel\": \"shared\",              \"nstar0_allottedresource0_providing_service_uuid\": \"4e8d930b-7483-4b9b-8c82-4708638ade4a\",              \"nstar0_allottedresource0_providing_service_invariant_uuid\": \"1899e5c1-df4e-43a8-a889-48c157dad7bc\"           }       }   }}"
+    
+    }
 
 Response: Response is returned with an empty entity
 
@@ -593,7 +593,7 @@ https://aai.onap:8443/aai/v19/business/customers/customer/5GCustomer/service-sub
 
 payload:
 
-{"profile-id":"202a5e9a-d1d7-4afd-922f-3e7a709c780c","max-number-of-UEs":1000,"latency":300,"exp-data-rate-UL":2000,"exp-data-rate-DL":400,"ue-mobility-level":"stationary","resource-sharing-level":"shared"}
+    {"profile-id":"202a5e9a-d1d7-4afd-922f-3e7a709c780c","max-number-of-UEs":1000,"latency":300,"exp-data-rate-UL":2000,"exp-data-rate-DL":400,"ue-mobility-level":"stationary","resource-sharing-level":"shared"}
 
 Response: Response is returned with an empty entity
 
@@ -603,13 +603,13 @@ Response: Response is returned with an empty entity
 
  b. Response Body:
 
-   {
+    {
     "service":
      {
      "serviceId":"8a95e3ac-32cd-4ffb-b9e3-5366b393a7a2",
      "operationId":"a970a804-7ac5-4de9-b6db-17352afbc6fa"
 
-   }
+    }
 
 9. CreateCommunicationService--> generateE2EServiceProfile()
 
@@ -641,11 +641,10 @@ Response: Response is returned with an empty entity
 
 b. Request body:
     
-   {
+    {
     "related-link":"aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service- 
     subscription/5G/service-instances/service-instance/2e6c2d7f-85c0-4b1f-b7fd-5f2364c27ea7"
-   
-   }
+    }
 
 15. CreateCommunicationService--> prepareUpdateOperationStatus()
 
diff --git a/docs/developer_info/CSIT_Macroflow_developer_info.rst b/docs/developer_info/CSIT_Macroflow_developer_info.rst
new file mode 100644 (file)
index 0000000..d8c52a4
--- /dev/null
@@ -0,0 +1,153 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2022 Huawei Technologies Co., Ltd.
+
+SO CSIT (Macroflow)
+========================
+
+Ensure you have a healthy ONAP Deployment running. The following components will be required/used as part of this guide:
+
+- SO
+- SDC
+- AAI
+- DMAAP
+- SDNC
+- MultiCloud
+
+What is Macroflow?
+-----------------
+
+The SO building blocks are a set of database-driven, configurable and generic process steps to be leveraged through several actions defined as 'Macro' flows. For each of the macro flows, there are a set of actions to be performed which are implemented as building blocks - which then implement generic logic to handle the orchestration of services and various type of resources orchestrated by ONAP, as well as their corresponding actions.
+
+**Macroflow** method allows the user to build and send only one request to instantiate all objects : Service, VNFs, VFModules and Networks.
+
+How to run CSIT Macroflow?
+--------------------------
+
+The follow steps are to be installed and run on an Ubuntu 18.04 (desktop) installation.
+Later versions of Ubuntu and Java may work for the tests.
+
+**Prerequisite:**
+Install Java 11, Maven, docker, docker-compose
+
+Following steps need to be followed to run the CSIT Macroflow:
+
+First pull the CSIT repo from Gerrit, either with or without the hooks
+
+… code-block::
+
+    git clone "https://gerrit.onap.org/r/integration/csit"
+or
+
+.. code-block::
+
+    git clone "https://gerrit.onap.org/r/integration/csit" && (cd "csit" && mkdir -p .git/hooks && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit.onap.org/r/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
+    
+Once this is downloaded a few more installations are required.
+
+Install pip (if required)
+
+.. code-block::
+
+    sudo apt install python-pip
+
+Install Robot Framework through pip
+
+.. code-block::
+
+    pip install robotframework
+
+Run Script
+
+Once all of this is done, then the tests should be run by calling the run-csit.sh script and giving it the location of our test folder (csit/plans/so/macroflow).
+
+From the csit projects root folder run the following command:
+
+.. code-block::
+    
+    ./run-csit.sh plans/so/macroflow
+    
+This should successfully run the CSIT Macroflow
+
+The run-csit.sh will automatically set up a Robot environment for you, and execute the test plan defined in the plans/so/macroflow directory.
+
+If you look at the contents of the plans/so/macroflow you will see the following:
+
+**setup.sh:** the shell script that starts all the necessary docker containers required by this test plan, as well as passing the necessary environment variables to Robot.
+**testplan.txt:** the text file listing, in order, the test suites that should be executed by Robot for this particular test plan. This allows you to refactor test suites to be reused by multiple test plans as necessary.
+**teardown.sh:** the shell script that kills all the docker containers that were started by this test plan.
+**docker-compose.yml:** This lists all the requrired docker.
+
+How to run tests against specific SO versions
+--------------------------------------------
+It is possible to run the CSIT Macroflow suite against local docker images although it is not the default. Through this method specific versions of SO can be tested.
+
+There are two changes required to make this work.
+
+1. The env file, located at [containing folder]/csit/plans/so/macroflow/config/env, first needs to be changed. The DOCKER_ENVIROMENT needs to be changed from "remote" to "local". Also the TAG value might need to be changed. This Tag relates to the version of images being used. Make sure the cnf-adapter image version also need to be changed here.
+
+2. Secondly all of the required docker images must be present on system.
+
+This should be enough to run the CSIT Macroflow test suite locally.
+
+CSIT Macroflow Tests High Level Scenarios
+---------------------------------------------------
+
+**Step 1:**
+
+Perform Configuration / Setup Steps prior to running tests
+
+**Step 2:**
+
+Onoboard the Macroflow Csar Package to complete the distribution from sdc-controller. This will be done by RoboFramework itlself. ASDC saves both heat and helm info into mso catalogdb.
+
+**Step 3:**
+
+Once the distribution done, next Instantiation will be executed for Macrolfow. RoboFramework is used to trigger the Instantiation flow. In this case, API handler receives the call and fetches required information from mso catalogdb.
+
+**Step 4:**
+
+Bpmn-Infra is called and fetches required information from mso catalogdb and executes all the selected building blocks which will call cnf-adapter or openstack adapter on the basis of usecase whether it is Macroflow Heat or Macroflow Helm.
+
+**Step 5:**
+
+Bpmn-Infra also fetches and updates Action infromation to the AAI-Simulator and SDNC-Simulator
+
+**Step 6:**
+
+Cnf-Adapter will then call to Multicloud (Multicloud-Simulator) and complete the Execution of Macroflow.
+
+Follow the diagram in the image below to understand the step
+
+.. image:: ../images/Architecture_flow.png
+
+What are the tests doing?
+-------------------------
+There are three tests currently being run "Distribute Service Template", "Invoke Service Instantiation".
+
+**Distribute Service Template**
+
+As the name would suggest the aim for the "Distribute Service Template" test is to distribute a service template within the SDC controller pod. Once a http session of the SDC controller is created a post request can be made to it. This post requests sends binary data from "serviceBasicVfCnfnotification.json" for Macroflow heat and "serviceBasicVfCnfWithHelm.json" for Macroflow helm. These json files contain the information of resources and artifacts required to distribute a service. These json file gather information from the Csar package which resides in the plans/so/macroflow/config/distribution-test-zip directory. Once this post request is sent, the response status code is checked to see if it is 200. If the code is not equal to 200 then the test is thought to be a failure.
+
+**Invoke Service Instantiation**
+
+The aim of the "Invoke Service Instantiation" test is to invoke the service distributed to the sdc controller in the previous test. A http session of the api handler pod is created. This session is sent a post request containing "macroflow.json" for Macroflow heat and "MacroflowWithHelm.json" for Macroflow helm. Once these request are made the response is checked if it a valid code is returned.  A for loop is used to continually make calls to check the orchestration request for both the request, to check the status of service instantiation. Only once this orchestration returns either a fail or success, will we break out of the for loop. Once outside the for loop a final statement is used to check if service has been successfully instantiated.
+
+Troubleshooting
+---------------
+There are a number of simple issues relating from Python and its libraries
+
+A correct installation of the robot framework to run our tests requiring python and the following pip libraries.
+
+- robotframework
+- robotframework-extendedselenium2library
+- robotframework-httplibrary
+- robotframework-onap
+- robotframework-requests
+- robotframework-selenium2library
+
+To make sure each of the previous libraries is installed run the following command
+
+.. code-block::
+
+    pip -list
index e684c6c..d62503e 100644 (file)
@@ -58,132 +58,132 @@ Path:- /docker-config/volumes/so/config/api-handler-infra/onapheat/override.yaml
 
 .. code-block:: bash
 
- server:
-    port: 8080
-    tomcat:
-        max-threads: 50
- ssl-enable: false
-
- mso:
-  msoKey: 07a7159d3bf51a0e53be7a8f89699be7
-  logPath: logs
-  site-name: onapheat
-  adapters:
-    requestDb:
-      endpoint: http://request-db-adapter:8083
-      auth: Basic YnBlbDpwYXNzd29yZDEk
-  catalog:
-    db:
-      spring:
-        endpoint: http://catalog-db-adapter:8082
-  db:
-    auth: Basic YnBlbDpwYXNzd29yZDEk
-  config:
-    path: /src/main/resources/
-  infra:
-    default:
-      alacarte:
-        orchestrationUri: /mso/async/services/ALaCarteOrchestrator
-        recipeTimeout: 180
-        testApi: VNF_API
-      service:
-        macro:
-          default:
-            testApi: GR_API
-  camundaURL: http://bpmn-infra:8081
-  camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A
-  async:
-    core-pool-size: 50
-    max-pool-size: 50
-    queue-capacity: 500
-  sdc:
-    client:
-      auth: F3473596C526938329DF877495B494DC374D1C4198ED3AD305EA3ADCBBDA1862
-    activate:
-      instanceid: test
-      userid: cs0008
-    endpoint: http://c1.vm1.mso.simpledemo.onap.org:28090
-  tenant:
-    isolation:
-      retry:
-        count: 3
-  aai:
-    endpoint: https://aai.api.simpledemo.onap.org:8443
-    auth: 2630606608347B7124C244AB0FE34F6F
-  extApi:
-    endpoint: http://nbi.onap:8080/nbi/api/v3
-  so:
-    operational-environment:
-      dmaap:
-        username: testuser
-        password: VjR5NDcxSzA=
-        host: http://c1.vm1.mso.simpledemo.onap.org:28090
-        auth: 51EA5414022D7BE536E7516C4D1A6361416921849B72C0D6FC1C7F262FD9F2BBC2AD124190A332D9845A188AD80955567A4F975C84C221EEA8243BFD92FFE6896CDD1EA16ADD34E1E3D47D4A
-      publisher:
-        topic: com.att.ecomp.mso.operationalEnvironmentEvent
-
- spring:
-  datasource:
-    hikari:
-      jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb
-      username: cataloguser
-      password: catalog123
-      driver-class-name: org.mariadb.jdbc.Driver
-      pool-name: catdb-pool
-      registerMbeans: true
-  jpa:
-      show-sql: true
-      hibernate:
-        dialect: org.hibernate.dialect.MySQL5Dialect
-        ddl-auto: validate
-        naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
-        enable-lazy-load-no-trans: true
-  jersey:
-    type: filter
-
-  security:
-    usercredentials:
-    -
-      username: sitecontrol
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: SiteControl-Client
-    -
-      username: gui
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: GUI-Client
-    -
-      username: infraportal
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: InfraPortal-Client
-    -
-      username: InfraPortalClient
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: InfraPortal-Client
-    -
-      username: bpel
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: BPEL-Client
-    -
-      username: mso_admin
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: ACTUATOR
-
- request:
-  datasource:
-    hikari:
-      jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb
-      username: requestuser
-      password: request123
-      driver-class-name: org.mariadb.jdbc.Driver
-      pool-name: reqdb-pool
-      registerMbeans: true
- org:
-  onap:
-    so:
-      cloud-owner: CloudOwner
+     server:
+        port: 8080
+        tomcat:
+            max-threads: 50
+     ssl-enable: false
+    
+     mso:
+      msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+      logPath: logs
+      site-name: onapheat
       adapters:
-        network:
-          encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7
+        requestDb:
+          endpoint: http://request-db-adapter:8083
+          auth: Basic YnBlbDpwYXNzd29yZDEk
+      catalog:
+        db:
+          spring:
+            endpoint: http://catalog-db-adapter:8082
+      db:
+        auth: Basic YnBlbDpwYXNzd29yZDEk
+      config:
+        path: /src/main/resources/
+      infra:
+        default:
+          alacarte:
+            orchestrationUri: /mso/async/services/ALaCarteOrchestrator
+            recipeTimeout: 180
+            testApi: VNF_API
+          service:
+            macro:
+              default:
+                testApi: GR_API
+      camundaURL: http://bpmn-infra:8081
+      camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A
+      async:
+        core-pool-size: 50
+        max-pool-size: 50
+        queue-capacity: 500
+      sdc:
+        client:
+          auth: F3473596C526938329DF877495B494DC374D1C4198ED3AD305EA3ADCBBDA1862
+        activate:
+          instanceid: test
+          userid: cs0008
+        endpoint: http://c1.vm1.mso.simpledemo.onap.org:28090
+      tenant:
+        isolation:
+          retry:
+        count: 3
+      aai:
+        endpoint: https://aai.api.simpledemo.onap.org:8443
+        auth: 2630606608347B7124C244AB0FE34F6F
+      extApi:
+        endpoint: http://nbi.onap:8080/nbi/api/v3
+      so:
+        operational-environment:
+          dmaap:
+            username: testuser
+            password: VjR5NDcxSzA=
+            host: http://c1.vm1.mso.simpledemo.onap.org:28090
+            auth: 51EA5414022D7BE536E7516C4D1A6361416921849B72C0D6FC1C7F262FD9F2BBC2AD124190A332D9845A188AD80955567A4F975C84C221EEA8243BFD92FFE6896CDD1EA16ADD34E1E3D47D4A
+          publisher:
+            topic: com.att.ecomp.mso.operationalEnvironmentEvent
+    
+     spring:
+      datasource:
+        hikari:
+          jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb
+          username: cataloguser
+          password: catalog123
+          driver-class-name: org.mariadb.jdbc.Driver
+          pool-name: catdb-pool
+          registerMbeans: true
+      jpa:
+          show-sql: true
+          hibernate:
+            dialect: org.hibernate.dialect.MySQL5Dialect
+            ddl-auto: validate
+            naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+            enable-lazy-load-no-trans: true
+      jersey:
+        type: filter
+    
+      security:
+        usercredentials:
+        -
+          username: sitecontrol
+          password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+          role: SiteControl-Client
+        -
+          username: gui
+          password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+          role: GUI-Client
+        -
+          username: infraportal
+          password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+          role: InfraPortal-Client
+        -
+          username: InfraPortalClient
+          password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+          role: InfraPortal-Client
+        -
+          username: bpel
+          password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+          role: BPEL-Client
+        -
+          username: mso_admin
+          password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+          role: ACTUATOR
+    
+     request:
+      datasource:
+        hikari:
+          jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb
+          username: requestuser
+          password: request123
+          driver-class-name: org.mariadb.jdbc.Driver
+          pool-name: reqdb-pool
+          registerMbeans: true
+     org:
+      onap:
+        so:
+          cloud-owner: CloudOwner
+          adapters:
+            network:
+              encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7
 
 
 
@@ -245,8 +245,8 @@ Example Output:
 .. code-block:: bash
 
 
- [
-  {
   [
+    {
       "Id": "sha256:2573165483e9ac87826da9c08984a9d0e1d93a90c681b22d9b4f90ed579350dc",
       "RepoTags": [
           "onap/so/api-handler-infra:1.3.0-SNAPSHOT",
@@ -360,5 +360,5 @@ Example Output:
               "sha256:2163a1f989859fdb3af6e253b74094e92a0fc1ee59f5eb959971f94eb1f98094"
           ]
       }
-  }
- ]
+     }
   ]
diff --git a/docs/developer_info/E2E_Network_Slicing_Understanding.rst b/docs/developer_info/E2E_Network_Slicing_Understanding.rst
new file mode 100644 (file)
index 0000000..169dd64
--- /dev/null
@@ -0,0 +1,111 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2021 Wipro Ltd.
+
+E2E Network Slicing
+===================
+The objective of this use case is to realize **End-to-End 5G Network
+Slicing** using ONAP. An End-to-End Network Slice consists of RAN (Radio
+Access Network), Transport Network (TN) and Core Network (CN) slice
+sub-nets. This use case intends to demonstrate the modeling,
+orchestration (life cycle and resources) and assurance of a network
+slice which are implemented in alignment with relevant standards.
+
+Overall High level view for ONAP-based Slice Management
+=======================================================
+
+Architecture Choice
+-------------------
+
+3GPP(TS 28.801) defines three layer slice management functions which include:
+
+CSMF(Communication Service Management Function):
+
+- Responsible for translating the communication service related requirement to network slice related requirements.
+
+- Communicate with Network Slice Management Function (NSMF).
+
+NSMF(Network Slice Management Function):
+
+- Responsible for management and orchestration of NSI.
+
+- Derive network slice subnet related requirements from network slice related requirements.
+
+- Communicate with the Network Slice Subnet Management Function (NSSMF) and Communication Service Management Function.
+
+NSSMF(Network Slice Subnet Management Function):
+
+- Responsible for management and orchestration of NSSI.
+
+- Communicate with the NSMF.
+
+.. image:: ../images/e2e-network-slicing-architecture.png
+
+To realize the three layers of the slice management function, we need to decide whether to implement CSMF, NSMF or NSMF within ONAP, or use the external CSMF, NSMF or NSSMF. This implies that for ONAP-based network slice management, we have different choices from an architectural perspective:
+
+1. Implement CSMF, NSMF, NSSMF all within ONAP;
+
+2. Connect an external CSMF from the Northbound, Implement NSMF and NSSMF within ONAP;
+
+3. Connect an external CSMF from the Northbound, Implement NSMF within ONAP, Connect a 3rd party NSSMF from the Southbound;
+
+4. Implement CSMF, NSMF within ONAP, Connect a 3rd party NSSMF from then Southbound.
+
+5. Use external CSMF and NSMF, only implement NSSMF within ONAP.
+
+.. image:: ../images/architecture-choices-e2e-slicing.png
+
+Slice Management Functions - Realization in SO
+----------------------------------------------
+
+- CSMF and NSMF is realized within ONAP (enhancement in Frankfurt functionality), and the NB interfaces is standardized using ExtAPI.
+
+- All 3 NSSMFs shall be realized within ONAP (From Guilin).
+
+- ONAP acting as NSMF shall also interact with external RAN and Transport NSSMF using 3GPP APIs
+
+- CSMF reliazed within SO receives service requirements from EXT-API, which translates service requirements to slice profile(NST selection) and sends request to NSMF for slice allocation.
+
+- NSMF reliazed within SO receives request for slice allocation (slice profile, S-NSSAI, NST) and determines slice instantiation/modification (with OOF) to fulfil the slice allocation request.
+
+- NSSMF reliazed within SO receive information from NSMF & trigger RAN/Core/Transport NSSMF for orchestration actions.
+
+Network Slice Instance (NSI) Life Cycle View
+--------------------------------------------
+
+Design and pre-provision: Creation of necessary slice/slice sub-net templates. Creation, activation, deactivation and termination of NSI, including its constituent slice sub-nets (RAN, Core   and Transport)
+
+3GPP Specification (3GPP TS 28.530) describes management aspects of a Network Slice Instance, which can be described by the four phases:
+
+Preparation: The preparation phase includes network slice design, network slice capacity planning, on-boarding and evaluation of the network functions, preparing the network environment and   other necessary preparations required to be done before the creation of an NSI
+
+Commisioning: NSI provisioning in the commissioning phase includes creation of the NSI. During NSI creation all needed resources are allocated and configured to satisfy the network slice      requirements. The creation of an NSI can include creation and/or modification of the NSI constituents
+
+Operation: The Operation phase includes the activation, supervision, performance reporting (e.g. for KPI monitoring), resource capacity planning, modification,and de-activation of an NSI.
+
+Decommissioning: Network slice instance provisioning in the decommissioning phase includes decommissioning of non-shared constituents if required and removing the NSI specific configuration   from the shared constituents. After the decommissioning phase, the NSI is terminated and does not exist anymore. The ONAP-based NSI lifecycle management will finally provide the demonstration of all these phases.
+
+The ONAP-based NSI lifecycle management will finally provide the demonstration of all these phases.
+
+.. image:: ../images/lifecycle-of-network-slice-instance.png
+
+Support for Option1 &Option2 in E2E Network Slicing
+---------------------------------------------------
+
+ONAP E2E Network Slicing option 1 and 2 differs on the RAN and FH/BH relationship.
+
+- In option 1, RAN NSSMF will decide FH/MH requirements and send to TN side, so RAN NSST will nest FH/MH NSST, and slice profile requirements will contain not only RAN side requirements but also FH/MH.
+
+Template design for option 1: https://wiki.onap.org/display/DW/Template+Design+for+Option+1
+
+.. image:: ../images/slicing-option1.png
+
+- In option 2, FH and MH are independent requirments when doing E2E requirements decomposition. Detailed background of option 1 and 2, please see  E2E Network Slicing Use Case in R7 Guilin.
+
+Template design for option 2: https://wiki.onap.org/display/DW/Template+Design+for+Option2
+
+.. image:: ../images/slicing-option2.png
+
+3 domain combination solution -Endpoint
+---------------------------------------
+In order to enable 3 subnet connectivity, making end-to-end forwarding and control plane interacting, in slicing services, we need slicing interworking identifier and information to tell how  RAN and Core connect with TN. Slicing interworking identifier(in ONAP is vlan Id, allocated by NSMF) is used to isolate differerent service datas, and identify the unique slicing service      across RAN, TN and Core, 1 S-NSSAI will need to be assigned with 1 slicing interworking identifier(vlan Id). The slicing interworking information is used as bridges to connect RAN/Core and TN,it should be RAN/Core side outgress and TN ingress, like port, ipAddress, next hops and etc.
diff --git a/docs/developer_info/ETSI_CSIT_NFVO_VNFM.rst b/docs/developer_info/ETSI_CSIT_NFVO_VNFM.rst
new file mode 100644 (file)
index 0000000..3bc8393
--- /dev/null
@@ -0,0 +1,227 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2022 Ericsson Software Technologies
+
+SO ETSI CSIT (NFVO and VNFM)
+============================
+This guide will go through the CSIT of the ETSI NFVO and VNFM.
+
+Ensure you have a healthy ONAP Deployment running. The following components will be required/used as part of this guide:
+
+- SO
+- SDC
+- AAI
+- DMAAP
+- Modeling
+
+What is ETSI?
+-------------
+The European Telecommunications Standards Institute (ETSI) produces globally-applicable standards
+for Information and Communications Technologies. ETSI  set out standards covering the functionalities
+of the interfaces specified on the reference points, which use the acronym NFV-SOL
+(standing for “NFV Solutions”). As of ONAPs Dublin release the  SO SVNFM adapter supports
+SOL003 standards for Create, Instantiate, Terminate and Delete operations with Granting, Subscription
+and Notification. As of ONAP Honolulu release, the SO ETSI NFVO sub-component supports
+SOL005 (NBI) and SOL003 (SBI) standards for Create, Instantiate, Terminate and Delete NS and VNF
+(through the SOL003 Adapter) operations.
+
+How to Run CSIT Tests
+---------------------
+The follow steps are to install and run on an Ubuntu 18.04 (desktop) installation.
+Later versions of Ubuntu and Java may work for the tests.
+
+First pull the CSIT repo from Gerrit, either with or without the hooks
+
+.. code-block::
+
+    git clone "https://gerrit.onap.org/r/integration/csit"
+
+or
+
+.. code-block::
+
+    git clone "https://gerrit.onap.org/r/integration/csit" && (cd "csit" && mkdir -p .git/hooks && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit.onap.org/r/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
+
+Once this is downloaded a few more installations are required.
+
+Install pip (if required)
+
+.. code-block::
+
+    sudo apt install python-pip
+
+Install Robot Framework through pip
+
+.. code-block::
+
+    pip install robotframework
+
+Run Script
+
+Once all of this is done, then the tests should be run by calling the run-csit.sh script and giving it the location of our test folder (csit/plans/so/integration-etsi-testing).
+From the csit projects root folder run the following command:
+
+.. code-block::
+
+    ./run-csit.sh plans/so/integration-etsi-testing
+
+This should successfully run the ETSI CSIT suite
+
+How to run tests againt specific SO versions
+--------------------------------------------
+It is possible to run the ETSI CSIT suite against local docker images although it is not the default.
+Through this method specific versions of SO can be tested.
+There are two changes required to make this work.
+The env file, located at [containing folder]/csit/plans/so/integration-etsi-testing/config/env,
+first needs to be changed. The DOCKER_ENVIROMENT needs to be changed from "remote" to "local".
+Also the TAG value might need to be changed. This Tag relates to the version of images being used.
+
+Secondly all of the required docker images must be present on system.
+
+This should be enough to run the ETSI CSIT test suite locally.
+
+ETSI NFVO Automated CSIT Tests High Level Scenarios
+---------------------------------------------------
+**Step 1:**
+
+Perform Configuration / Setup Steps prior to running tests
+
+**Step 2:**
+
+Onboard SOL004 Package and SOL007 directly into ETSI Catalog using ROBOT framework
+
+**Step 3:**
+
+ETSI Catalog Gets Package from SDC Simulator (New: ETSI Catalog and Modeling ETSI Catalog DB will need to be set up and spun up for CSIT. May be some impact on SDC Simulator here)
+
+**Step 4:**
+
+ETSI Catalog Stores Package in its Modeling ETSI Catalog DB
+
+**Step 5:**
+
+ROBOT framework used to trigger NS LCM requests, e.g., INSTANTIATE NS
+
+**Step 6:**
+
+ETSI NFVO NS LCM gets required data from ETSI Catalog, e.g., Get and Parse NSD
+
+**Step 7:**
+
+If e.g., a CREATE NS task, ETSI NFVO NS LCM checks to see if already exists in ETSI NFVO DB
+
+**Step 8:**
+
+Create Generic VNF and connect to Service Instance in A&AI Simulator (May be some impact on A&AI Simulator here)
+
+**Step 9:**
+
+Instantiate VNF through SOL003 Adapter
+
+**Step 10:**
+
+SOL003 Adapter processes requests through A&AI and (May be some impact on A&AI Simulator here)
+
+**Step 11:**
+
+SOL003 Adapter processes requests through ETSI-Catalog
+
+**Step 12:**
+
+SOL003 Adapter sends notification to SOL003 NBI, etc.
+
+What are the tests doing?
+-------------------------
+There are three tests currently being run "Distribute Service Template", "Invoke Service Instantiation",
+"Invoke NS Instantiation", "Delete NS Instance", "Invoke VNF Instantiation", "Delete VNF Instance" and
+"Delete Service Instance".
+
+Distribute Service Template
+
+As the name would suggest the aim for the "Distribute Service Template" test is to distribute a service
+template within the SDC controller pod. Once a http session of the SDC controller is created a post request
+can be made to it. This post requests sends binary data from "distributeServiceTemplate.json".
+This json file contains resources and artifacts required to distribute a service. Once this post request
+is sent, the response status code is checked to see if it is 200. If the code is not equal to 200 then
+the test is thought to be a failure.
+
+Invoke Service Instantiation
+
+The aim of the "Invoke Service Instantiation" test is to invoke the service distributed to the sdc controller
+in the previous test. A http session of the api handler pod is created. This session is sent a post request
+containing "serviceInstantiationRequest.json". Once this request is made the response is checked if it
+a valid code is returned.  A for loop is used to continually make calls to check the orchestration request,
+to check the status of service instantiation. Only once this orchestration returns either a fail or success,
+will we break out of the for loop.Once outside the for loop a final statement is used to check if service
+has been successfully instantiated.
+
+Invoke NS Instance
+
+The aim of "Invoke NS Instantiation" test is to now instantiate the NS that relates to service in the
+previous test. This test requires the ID of the service instance created in the previous test. If this is
+not provided then the test will fail from the get go. Once again a http session of the api handler pod is
+created. Similarly a post request using the json data within "nsInstantiationRequest.json".
+Once this request is made if it returns a success code then the test moves on to a for loop. Within this
+for a loop an orchestration request is made each time, when this request signals that either the instantiation
+request has failed or fully succeeded then the loop is escaped. The test will either be a pass or fail depending
+on this final orchestration request.
+
+Delete NS Instance
+
+This test will delete the NS Instance created in the previous test. Both the ID of the NS instance created
+in the previous test and the service instance created in the test before that. If either of these values is
+not provided then the test will fail. This test once again makes use of a session of the api handler pod.
+A post request is made using the data from  "nsDeleteRequest.json". Once this request is made if it returns
+a success code then the test moves on to a for loop. Within this for a loop an orchestration request is made
+each time, when this request signals that either the instantiation request has failed or fully succeeded
+then the loop is escaped. The test will either be a pass or fail depending on this final orchestration request.
+
+Invoke VNF Instance
+
+The aim of "Invoke VNF Instantiation" test is to now instantiate the VNF that relates to service in
+the previous test. This test requires the ID of the service instance created in the previous test.
+If this is not provided then the test will fail from the get go. Once again a http session of the
+api handler pod is created. Similarly a post request using the json data within "vnfInstantiationRequest.json".
+Once this request is made if it returns a success code then the test moves on to a for loop. Within this
+for a loop an orchestration request is made each time, when this request signals that either the instantiation
+request has failed or fully succeeded then the loop is escaped. The test will either be a pass or fail
+depending on this final orchestration request.
+
+Delete VNF Instance
+
+This test will delete the VNF Instance created in the previous test. Both the ID of the vnf instance created
+in the previous test and the service instance created in the test before that. If either of these values is
+not provided then the test will fail. This test once again makes use of a session of the api handler pod.
+A post request is made using the data from  "vnfDeleteRequest.json". Once this request is made if it returns
+a success code then the test moves on to a for loop. Within this for a loop an orchestration request is made
+each time, when this request signals that either the instantiation request has failed or fully succeeded then
+the loop is escaped. The test will either be a pass or fail depending on this final orchestration request.
+
+Delete Service Instance
+
+This test will delete the service instance created in earlier test. To delete the service the ID of previously
+ created Service Instance is required, if this is not supplied then the test will fail before starting.
+ A post request is then made to the API handler containing data from "serviceDeleteRquest.json".
+ Once this request is made if it returns a success code then the test moves on to a for loop.
+ Within this for a loop an orchestration request is made each time, when this request signals that either
+ the instantiation request has failed or fully succeeded then the loop is escaped. The test will either be
+ a pass or fail depending on this final orchestration request.
+
+Troubleshooting
+---------------
+There are a number of simple issues relating from Python and its libraries
+
+A correct installation of the robot framework to run our tests requiring python and the following pip libraries.
+
+- robotframework
+- robotframework-extendedselenium2library
+- robotframework-httplibrary
+- robotframework-onap
+- robotframework-requests
+- robotframework-selenium2library
+
+To make sure each of the previous libraries is installed run the following command
+
+.. code-block::
+
+    pip -list
\ No newline at end of file
index e174133..11b5152 100644 (file)
@@ -15,6 +15,7 @@ SO Developer Information
    Camunda_Cockpit_Community_Edition.rst
    Camunda_Cockpit_Enterprise_Edition.rst
    Camunda_Modeler.rst
+   CSIT_Macroflow_developer_info.rst
    BPMN_Project_Structure.rst
    BPMN_Main_Process_Flows.rst
    BPMN_Subprocess_Process_Flows.rst
diff --git a/docs/images/Architecture_flow.png b/docs/images/Architecture_flow.png
new file mode 100644 (file)
index 0000000..1121925
Binary files /dev/null and b/docs/images/Architecture_flow.png differ
diff --git a/docs/images/SO-NFVO-Architecture-1.png b/docs/images/SO-NFVO-Architecture-1.png
new file mode 100644 (file)
index 0000000..dd04a7b
Binary files /dev/null and b/docs/images/SO-NFVO-Architecture-1.png differ
diff --git a/docs/images/SO-SOL003-Adapter-Architecture-1.png b/docs/images/SO-SOL003-Adapter-Architecture-1.png
new file mode 100644 (file)
index 0000000..932d5d1
Binary files /dev/null and b/docs/images/SO-SOL003-Adapter-Architecture-1.png differ
diff --git a/docs/images/SO_Architecture_2.png b/docs/images/SO_Architecture_2.png
new file mode 100644 (file)
index 0000000..45ffd95
Binary files /dev/null and b/docs/images/SO_Architecture_2.png differ
diff --git a/docs/images/architecture-choices-e2e-slicing.png b/docs/images/architecture-choices-e2e-slicing.png
new file mode 100644 (file)
index 0000000..b240215
Binary files /dev/null and b/docs/images/architecture-choices-e2e-slicing.png differ
diff --git a/docs/images/e2e-network-slicing-architecture.png b/docs/images/e2e-network-slicing-architecture.png
new file mode 100644 (file)
index 0000000..922419d
Binary files /dev/null and b/docs/images/e2e-network-slicing-architecture.png differ
diff --git a/docs/images/lifecycle-of-network-slice-instance.png b/docs/images/lifecycle-of-network-slice-instance.png
new file mode 100644 (file)
index 0000000..0959783
Binary files /dev/null and b/docs/images/lifecycle-of-network-slice-instance.png differ
diff --git a/docs/images/slicing-option1.png b/docs/images/slicing-option1.png
new file mode 100644 (file)
index 0000000..e19a257
Binary files /dev/null and b/docs/images/slicing-option1.png differ
diff --git a/docs/images/slicing-option2.png b/docs/images/slicing-option2.png
new file mode 100644 (file)
index 0000000..945c7c5
Binary files /dev/null and b/docs/images/slicing-option2.png differ
index 58902f3..4299041 100644 (file)
@@ -14,6 +14,127 @@ The SO provides the highest level of service orchestration in the ONAP architect
 Release Notes
 =============
 
+Version: 1.10.0
+==============
+
+    :Release Date: 2022-04-08
+
+SO Release Image Versions
+--------------------------
+ - so-bpmn-infra
+
+    :Version: 1.10.0
+
+ - so-catalog-db-adapter
+
+    :Version: 1.10.0
+
+ - so-admin-cockpit
+
+    :Version: 1.8.3
+
+ - so-nssmf-adapter
+
+    :Version: 1.9.1
+
+ - so-openstack-adapter
+
+    :Version: 1.10.0
+
+ - so-request-db-adapter
+
+    :Version: 1.10.0
+
+ - so-sdc-controller
+
+    :Version: 1.10.0
+
+ - so-sdnc-adapter
+
+    :Version: 1.10.0
+
+ - so-sol003-adapter
+
+    :Version: 1.8.2
+
+ - so-api-handler
+
+    :Version: 1.10.0
+
+ - so-etsi-nfvo-ns-lcm
+
+    :Version: 1.8.2
+
+ - so-oof-adapter
+
+    :Version: 1.8.3
+
+ - so-cnf-adapter
+
+    :Version: 1.10.0
+
+Release Purpose
+----------------
+SO Jakarta Release.
+The key deliverable for this release is refactoring SO for better internal architecture.
+
+
+**Epics**
+
+*  `REQ-890 <https://jira.onap.org/browse/REQ-890>`_ - ONAP CNF orchestration - Jakarta Enhancements
+*  `REQ-1041 <https://jira.onap.org/browse/REQ-1041>`_ - VNF LCM Support in SO
+*  `SO-3802 <https://jira.onap.org/browse/SO-3802>`_ - Global Requirements Approval
+*  `SO-3826 <https://jira.onap.org/browse/SO-3826>`_ - SO impacts for E2E Network Slicing in Jakarta Release
+
+**Stories**
+
+The full list of implemented tasks is available on `JIRA Jakarta STORY <https://jira.onap.org/browse/SO-3748?jql=project%20%3D%20%22Service%20Orchestrator%22%20%20AND%20issuetype%20%3D%20story%20AND%20fixVersion%20%3D%20%22Jakarta%20Release%22>`_
+
+
+**Tasks**
+
+The full list of implemented tasks is available on `JIRA Jakarta TASKS <https://jira.onap.org/browse/SO-3930?jql=project%20%3D%20%22Service%20Orchestrator%22%20%20AND%20issuetype%20%3D%20Task%20AND%20fixVersion%20%3D%20%22Jakarta%20Release%22>`_
+
+**Bug Fixes**
+
+The full list of fixed bugs is available on `JIRA Jakarta BUGS 
+<https://jira.onap.org/browse/SO-3908?jql=project%20%3D%20%22Service%20Orchestrator%22%20%20AND%20issuetype%20%3D%20Bug%20AND%20fixVersion%20%3D%20%22jakarta%20Release%22>`_
+
+Security Notes
+--------------
+
+*Fixed Security Issues*
+
+*  `SO-3735 <https://jira.onap.org/browse/SO-3735>`_ 
+*  `SO-3825 <https://jira.onap.org/browse/SO-3825>`_
+*  `SO-3846 <https://jira.onap.org/browse/SO-3846>`_
+
+
+Quick Links:
+
+- `SO project page <https://wiki.onap.org/display/DW/Service+Orchestrator+Project>`__
+- `Passing Badge information for SDC <https://bestpractices.coreinfrastructure.org/en/projects/1702>`__
+
+**Known Issues**
+
+*  `SO-3237 <https://jira.onap.org/browse/SO-3237>`_ - Exposed HTTP port. 
+*  `SO-3745 <https://jira.onap.org/browse/SO-3745>`_ - SO images contain 1 GPLv3 lib
+
+**Upgrade Notes**
+
+       N/A
+
+**Deprecation Notes**
+
+       SO modules Ve-Vnfm-adapter and appc-orchestrator are deprectaed since istanbul release.
+
+**Other**
+
+       N/A
+***************************************************************************************
+
+
+
 Version: 1.9.2
 ==============
 
index 74a3b7a..3b3441a 100644 (file)
@@ -1 +1,3 @@
 lfdocs-conf
+sphinx>=4.2.0  # BSD
+sphinx-rtd-theme>=1.0.0  # MIT
index 12051fb..1696445 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2022 Samsung Electronics
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -48,9 +49,6 @@ public class AAIObjectTypeTest {
         AAIObjectType genericVnf2 = AAIFluentTypeBuilder.network().genericVnf("test2").build();
 
         assertEquals(genericVnf2, genericVnf);
-
-        assertEquals(genericVnf, Types.GENERIC_VNF);
-
     }
 
     @Test
index 99c0fc2..5bf33b4 100644 (file)
@@ -369,16 +369,7 @@ public class OrchestrationRequests {
                 }
 
             } catch (IOException e) {
-                logger.error("Exception occurred", e);
-                ErrorLoggerInfo errorLoggerInfo =
-                        new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
-                                .build();
-                ValidateException validateException =
-                        new ValidateException.Builder("Mapping of request to JSON object failed : ",
-                                HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
-                                        .errorInfo(errorLoggerInfo).build();
-
-                throw validateException;
+                logger.error(String.format("Failed to parse request (id: %s) : ", request.getRequestId()), e);
             }
         }
         request.setRequestDetails(requestDetails);
index cddb1ad..531d87c 100644 (file)
@@ -33,7 +33,10 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
@@ -841,7 +844,11 @@ public class RequestHandlerUtils extends AbstractRestHandler {
             if (params.containsKey("service")) {
                 Service service = serviceMapper(params);
 
-                addUserParams(userParams, service.getInstanceParams());
+                // Filter out non-string params for backward compatibility
+                Map<String, String> svcStrParams = service.getInstanceParams().stream().map(Map::entrySet)
+                        .flatMap(Set::stream).filter(e -> e.getValue() instanceof String)
+                        .collect(Collectors.toMap(Entry::getKey, e -> (String) e.getValue()));
+                userParams.putAll(svcStrParams);
 
                 for (Networks network : service.getResources().getNetworks()) {
                     addUserParams(userParams, network.getInstanceParams());
index ed4a52a..4aa9cd0 100644 (file)
@@ -432,6 +432,24 @@ public class ServiceInstances extends AbstractRestHandler {
                 requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
     }
 
+    @POST
+    @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/upgradeCnf")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Operation(description = "Upgrade CNF instance", responses = @ApiResponse(
+            content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+    @Transactional
+    public Response cnfUpgrade(String request, @PathParam("version") String version,
+            @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
+            @Context ContainerRequestContext requestContext) throws ApiException {
+        String requestId = requestHandlerUtils.getRequestId(requestContext);
+        HashMap<String, String> instanceIdMap = new HashMap<>();
+        instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+        instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+        return serviceInstances(request, Action.upgradeCnf, instanceIdMap, version, requestId,
+                requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+    }
+
     @PUT
     @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
     @Consumes(MediaType.APPLICATION_JSON)
index 798604e..67a19c0 100644 (file)
@@ -65,6 +65,17 @@ public class BuildingBlockRollback implements Serializable {
     @Column(name = "ROLLBACK_ACTION", length = 200)
     private String rollbackAction;
 
+    public BuildingBlockRollback() {}
+
+    public BuildingBlockRollback(Integer id, String buildingBlockName, String action, String rollbackBuildingBlockName,
+            String rollbackAction) {
+        this.id = id;
+        this.buildingBlockName = buildingBlockName;
+        this.action = action;
+        this.rollbackBuildingBlockName = rollbackBuildingBlockName;
+        this.rollbackAction = rollbackAction;
+    }
+
     public Integer getId() {
         return id;
     }
index db800b2..cf1b188 100644 (file)
@@ -1424,3 +1424,27 @@ CREATE TABLE IF NOT EXISTS `building_block_rollback` (
     `ROLLBACK_ACTION` varchar(200) NULL,
     PRIMARY KEY (`ID`)
 )  ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO building_block_rollback(BUILDING_BLOCK_NAME,ACTION,ROLLBACK_BUILDING_BLOCK_NAME,ROLLBACK_ACTION)
+VALUES ("ActivateNetworkBB",NULL,"DeactivateNetworkBB",NULL),
+("ActivatePnfBB",NULL,"DeactivatePnfBB",NULL),
+("ActivateServiceInstanceBB",NULL,"DeactivateServiceInstanceBB",NULL),
+("ActivateVfModuleBB",NULL,"DeactivateVfModuleBB",NULL),
+("ActivateVnfBB",NULL,"DeactivateVnfBB",NULL),
+("ActivateVolumeGroupBB",NULL,"DeactivateVolumeGroupBB",NULL),
+("AssignNetworkBB",NULL,"UnassignNetworkBB",NULL),
+("AssignServiceInstanceBB",NULL,"UnassignServiceInstanceBB",NULL),
+("AssignVfModuleBB",NULL,"UnassignVfModuleBB",NULL),
+("AssignVnfBB",NULL,"UnassignVnfBB",NULL),
+("AssignVolumeGroupBB",NULL,"UnassignVolumeGroupBB",NULL),
+("CreateNetworkBB",NULL,"DeleteNetworkBB",NULL),
+("CreateNetworkCollectionBB",NULL,"DeleteNetworkCollectionBB",NULL),
+("CreateVfModuleBB",NULL,"DeleteVfModuleBB",NULL),
+("CreateVolumeGroupBB",NULL,"DeleteVolumeGroupBB",NULL),
+("VNFSetInMaintFlagActivity",NULL,"VNFUnsetInMaintFlagActivity",NULL),
+("VNFSetClosedLoopDisabledFlagActivity",NULL,"VNFUnsetClosedLoopDisabledFlagActivity",NULL),
+("VNFLockActivity",NULL,"VNFUnlockActivity",NULL),
+("VNFStopActivity",NULL,"VNFStartActivity",NULL),
+("VNFQuiesceTrafficActivity",NULL,"VNFResumeTrafficActivity",NULL),
+("EtsiVnfInstantiateBB", null, "EtsiVnfDeleteBB", null),
+("AddFabricConfigurationBB", null, "DeleteFabricConfigurationBB", null);
diff --git a/releases/1.10.0.yaml b/releases/1.10.0.yaml
new file mode 100644 (file)
index 0000000..726d5e0
--- /dev/null
@@ -0,0 +1,22 @@
+
+---
+distribution_type: 'container'
+container_release_tag: '1.10.0'
+project: 'so'
+log_dir: 'so-maven-docker-stage-master/1043/'
+ref: 'ffb0aa14936fae9bb3c9d2a11b311d294b1186d0'
+containers:
+    - name: 'so/catalog-db-adapter'
+      version: '1.10.0-20220324T0419'
+    - name: 'so/request-db-adapter'
+      version: '1.10.0-20220324T0419'
+    - name: 'so/openstack-adapter'
+      version: '1.10.0-20220324T0419'
+    - name: 'so/sdnc-adapter'
+      version: '1.10.0-20220324T0419'
+    - name: 'so/sdc-controller'
+      version: '1.10.0-20220324T0419'
+    - name: 'so/bpmn-infra'
+      version: '1.10.0-20220324T0419'
+    - name: 'so/api-handler-infra'
+      version: '1.10.0-20220324T0419'
index fc16125..9a66f75 100644 (file)
@@ -24,7 +24,7 @@ package org.onap.so.client.sniro;
 
 
 import static org.apache.commons.lang3.StringUtils.*;
-import java.util.LinkedHashMap;
+import java.util.Map;
 import org.json.JSONObject;
 import org.onap.so.client.exception.BadResponseException;
 import org.slf4j.Logger;
@@ -38,12 +38,14 @@ public class SniroValidator {
 
     private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class);
 
+    private static final String MESSAGE_NOT_PROVIDED = "error message not provided";
+
     /**
      * Validates the synchronous homing response from sniro manager
      *
      * @throws BadResponseException
      */
-    public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
+    public void validateDemandsResponse(Map<String, Object> response) throws BadResponseException {
         logger.debug("Validating Sniro Managers synchronous response");
         if (!response.isEmpty()) {
             JSONObject jsonResponse = new JSONObject(response);
@@ -54,10 +56,10 @@ public class SniroValidator {
                 } else {
                     String message = jsonResponse.getString("statusMessage");
                     if (isNotBlank(message)) {
-                        logger.debug("Sniro Managers response indicates failed: " + message);
+                        logger.debug("Sniro Managers response indicates failed: {}", message);
                     } else {
                         logger.debug("Sniro Managers response indicates failed: no status message provided");
-                        message = "error message not provided";
+                        message = MESSAGE_NOT_PROVIDED;
                     }
                     throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message);
                 }
@@ -67,7 +69,7 @@ public class SniroValidator {
             }
         } else {
             logger.debug("Sniro Managers synchronous response is empty");
-            throw new BadResponseException("Sniro Managers synchronous response i is empty");
+            throw new BadResponseException("Sniro Managers synchronous response is empty");
         }
     }
 
@@ -85,11 +87,11 @@ public class SniroValidator {
             } else {
                 String message = jsonResponse.getJSONObject("serviceException").getString("text");
                 if (isNotBlank(message)) {
-                    logger.debug("Sniro Managers response contains a service exception: " + message);
+                    logger.debug("Sniro Managers response contains a service exception: {}", message);
                 } else {
                     logger.debug(
                             "Sniro Managers response contains a service exception: no service exception text provided");
-                    message = "error message not provided";
+                    message = MESSAGE_NOT_PROVIDED;
                 }
                 throw new BadResponseException(
                         "Sniro Managers asynchronous response contains a service exception: " + message);
@@ -106,7 +108,7 @@ public class SniroValidator {
      *
      * @throws BadResponseException
      */
-    public void validateReleaseResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
+    public void validateReleaseResponse(Map<String, Object> response) throws BadResponseException {
         logger.debug("Validating Sniro Conductors response");
         if (!response.isEmpty()) {
             String status = (String) response.get("status");
@@ -116,10 +118,10 @@ public class SniroValidator {
                 } else {
                     String message = (String) response.get("message");
                     if (isNotBlank(message)) {
-                        logger.debug("Sniro Conductors response indicates failed: " + message);
+                        logger.debug("Sniro Conductors response indicates failed: {}", message);
                     } else {
                         logger.debug("Sniro Conductors response indicates failed: error message not provided");
-                        message = "error message not provided";
+                        message = MESSAGE_NOT_PROVIDED;
                     }
                     throw new BadResponseException(
                             "Sniro Conductors synchronous response indicates failed: " + message);
index 5f9be78..eaea1ab 100644 (file)
 
 package org.onap.so.client.oof;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import org.apache.logging.log4j.util.Strings;
 import org.junit.Test;
 import org.onap.so.client.exception.BadResponseException;
 
@@ -55,4 +58,41 @@ public class OofValidatorTest {
         map.put("statusMessage", "a");
         new OofValidator().validateDemandsResponse(map);
     }
+
+    @Test
+    public void validateSolution_success() throws Exception {
+        String json = "{\"value\" : \"test1\"}";
+        new OofValidator().validateSolution(json);
+    }
+
+    @Test
+    public void validateSolution_EmptyResponse() {
+        try {
+            new OofValidator().validateSolution("");
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("oofs asynchronous response is empty");
+        }
+    }
+
+    @Test
+    public void validateSolution_serviceExceptionWithMessage() {
+        String json = "{\"serviceException\" : {\"text\" : \"serviceExceptionOccurred\"}}";
+        try {
+            new OofValidator().validateSolution(json);
+            fail("Exception should be thrown");
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("serviceExceptionOccurred");
+        }
+    }
+
+    @Test
+    public void validateSolution_serviceExceptionWithEmptyMessage() {
+        String json = "{\"serviceException\" : {\"text\" : \"\"}}";
+        try {
+            new OofValidator().validateSolution(json);
+            fail("Exception should be thrown");
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("error message not provided");
+        }
+    }
 }
diff --git a/so-optimization-clients/src/test/java/org/onap/so/client/sniro/SniroValidatorTest.java b/so-optimization-clients/src/test/java/org/onap/so/client/sniro/SniroValidatorTest.java
new file mode 100644 (file)
index 0000000..9ad22ce
--- /dev/null
@@ -0,0 +1,150 @@
+package org.onap.so.client.sniro;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.so.client.exception.BadResponseException;
+
+public class SniroValidatorTest {
+
+    @Test
+    public void validateDemandsResponse_success() throws BadResponseException {
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("requestStatus", "accepted");
+        new SniroValidator().validateDemandsResponse(testMap);
+    }
+
+    @Test
+    public void validateDemandsResponse_emptyResponse() {
+        try {
+            new SniroValidator().validateDemandsResponse(new LinkedHashMap<>());
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Managers synchronous response is empty");
+        }
+    }
+
+    @Test
+    public void validateDemandsResponse_responseWithErrorMessage() {
+        String message = "An error occurred";
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("requestStatus", "not_accepted");
+        testMap.put("statusMessage", message);
+        try {
+            new SniroValidator().validateDemandsResponse(testMap);
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Managers synchronous response indicates failed: " + message);
+        }
+    }
+
+    @Test
+    public void validateDemandsResponse_responseWithoutMessage() {
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("requestStatus", "not_accepted");
+        testMap.put("statusMessage", "");
+        try {
+            new SniroValidator().validateDemandsResponse(testMap);
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("error message not provided");
+        }
+    }
+
+    @Test
+    public void validateDemandsResponse_responseWithoutRequestStatus() {
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("statusMessage", "");
+        try {
+            new SniroValidator().validateDemandsResponse(testMap);
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Managers synchronous response does not contain: request status");
+        }
+    }
+
+    @Test
+    public void validateSolution_success() throws BadResponseException {
+        SniroValidator.validateSolution("{statusMessage:key}");
+    }
+
+    @Test
+    public void validateSolution_emptyResponse() {
+        try {
+            SniroValidator.validateSolution("");
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Managers asynchronous response is empty");
+        }
+    }
+
+    @Test
+    public void validateSolution_errorResponseWithoutMessage() {
+        try {
+            SniroValidator.validateSolution("{\"serviceException\":{\"text\":\"\"}}");
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains(
+                    "Sniro Managers asynchronous response contains a service exception: error message not provided");
+        }
+    }
+
+    @Test
+    public void validateSolution_errorResponseWithErrorMessage() {
+        String message = "An error occurred";
+        try {
+            SniroValidator.validateSolution("{\"serviceException\":{\"text\":\"" + message + "\"}}");
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage())
+                    .contains("Sniro Managers asynchronous response contains a service exception: " + message);
+        }
+    }
+
+    @Test
+    public void validateReleaseResponse_success() throws BadResponseException {
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("status", "success");
+        new SniroValidator().validateReleaseResponse(testMap);
+    }
+
+    @Test
+    public void validateReleaseResponse_emptyResponse() {
+        try {
+            new SniroValidator().validateReleaseResponse(new LinkedHashMap<>());
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Conductors response is empty");
+        }
+    }
+
+    @Test
+    public void validateReleaseResponse_errorResponseWithErrorMessage() {
+        String message = "An error occurred";
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("status", "failed");
+        testMap.put("message", message);
+        try {
+            new SniroValidator().validateReleaseResponse(testMap);
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Conductors synchronous response indicates failed: " + message);
+        }
+    }
+
+    @Test
+    public void validateReleaseResponse_errorResponseWithNoMessage() {
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("status", "failed");
+        testMap.put("message", "");
+        try {
+            new SniroValidator().validateReleaseResponse(testMap);
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage())
+                    .contains("Sniro Conductors synchronous response indicates failed: error message not provided");
+        }
+    }
+
+    @Test
+    public void validateReleaseResponse_responseWithoutStatus() {
+        Map<String, Object> testMap = new LinkedHashMap<>();
+        testMap.put("statusMessage", "");
+        try {
+            new SniroValidator().validateReleaseResponse(testMap);
+        } catch (BadResponseException e) {
+            assertThat(e.getMessage()).contains("Sniro Conductors synchronous response does not contain: status");
+        }
+    }
+}
index ccc7b61..f6bcc5a 100644 (file)
@@ -3,8 +3,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major=1
-minor=9
-patch=2
+minor=11
+patch=0
 
 base_version=${major}.${minor}.${patch}