Merge "Fix dateformat for APPC HealthCheck"
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Wed, 28 Jul 2021 09:23:37 +0000 (09:23 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 28 Jul 2021 09:23:37 +0000 (09:23 +0000)
120 files changed:
adapters/mso-adapter-utils/pom.xml
adapters/mso-adapter-utils/src/test/resources/logback-test.xml
adapters/mso-adapters-rest-interface/pom.xml
adapters/mso-catalog-db-adapter/pom.xml
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
adapters/mso-openstack-adapters/pom.xml
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
adapters/mso-requests-db-adapter/pom.xml
adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
adapters/mso-sdnc-adapter/pom.xml
adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml
adapters/pom.xml
adapters/so-appc-orchestrator/pom.xml
adapters/so-appc-orchestrator/src/test/resources/logback-test.xml
asdc-controller/pom.xml
asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
asdc-controller/src/test/resources/download/service-pnfservice.csar
asdc-controller/src/test/resources/download/service-vnfservice.csar
asdc-controller/src/test/resources/logback-test.xml
bpmn/MSOCommonBPMN/pom.xml
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy
bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
bpmn/MSOCoreBPMN/pom.xml
bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java
bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml
bpmn/mso-infrastructure-bpmn/pom.xml
bpmn/pom.xml
bpmn/so-bpmn-building-blocks/pom.xml
bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml
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/DoAllocateAccessNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.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/DoModifyAccessNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.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/DoAllocateCoreNonSharedSliceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml
bpmn/so-bpmn-infrastructure-flows/pom.xml
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml
bpmn/so-bpmn-tasks/pom.xml
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImpl.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
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/ExecutionPlan.java [new file with mode: 0644]
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/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/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasksTest.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java [new file with mode: 0644]
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/UserParamsServiceTraversalTest.java
bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignVnfAndPnf.json [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/resources/logback-test.xml [new file with mode: 0644]
common/pom.xml
common/src/main/java/org/onap/so/security/HttpHeaderForwarderConfig.java [new file with mode: 0644]
common/src/main/java/org/onap/so/security/HttpHeaderForwarderHandlerInterceptor.java [new file with mode: 0644]
common/src/main/java/org/onap/so/security/HttpHeaderForwarderRequestInterceptor.java [new file with mode: 0644]
common/src/main/java/org/onap/so/security/SoNoAuthWebSecurityConfigurerAdapter.java
common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
common/src/main/java/org/onap/so/serviceinstancebeans/Pnfs.java
common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
common/src/test/resources/logback-test.xml
cxf-logging/pom.xml
cxf-logging/src/test/resources/logback-test.xml
deployment-configs/pom.xml
graph-inventory/aai-client/pom.xml
graph-inventory/aai-client/src/test/resources/logback-test.xml [new file with mode: 0644]
graph-inventory/fluent-builder-maven-plugin/pom.xml
graph-inventory/pom.xml
mso-api-handlers/mso-api-handler-common/pom.xml
mso-api-handlers/mso-api-handler-infra/pom.xml
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
mso-api-handlers/mso-requests-db-repositories/pom.xml
mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml
mso-api-handlers/mso-requests-db/pom.xml
mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml
mso-api-handlers/pom.xml
mso-catalog-db/pom.xml
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
mso-catalog-db/src/test/resources/logback-test.xml
packages/docker/pom.xml
packages/pom.xml
pom.xml
so-optimization-clients/pom.xml
so-sdn-clients/pom.xml
so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java [moved from so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java with 74% similarity]
so-sdn-clients/src/test/resources/logback-test.xml [new file with mode: 0644]
so-simulator/pom.xml
so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java
so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java
so-simulator/src/test/resources/log4j.properties
version.properties

index f7d16b2..2573d4e 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <groupId>org.onap.so.adapters</groupId>
   <artifactId>mso-adapter-utils</artifactId>
index 3873b2c..ca600b5 100644 (file)
   ============LICENSE_END=========================================================
   -->
 
-<configuration >
-  
-  
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
-    </encoder>
-  </appender>
+<configuration>
 
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n
+            </pattern>
+        </encoder>
+    </appender>
 
-  <logger name="com.att.eelf.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+    <logger name="com.att.eelf.audit" level="info" additivity="false">
         <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="com.att.eelf.error" level="trace" additivity="false">
-       <appender-ref ref="STDOUT" />
-  </logger> 
-       <logger name="org.onap" level="${so.log.level:-DEBUG}"
-               additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-  <root level="info">
-    <appender-ref ref="STDOUT" />
-  </root>
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="trace" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+    
+    <root level="info">
+        <appender-ref ref="STDOUT" />
+    </root>
+
 
 </configuration>
index 5e589b8..d48eed5 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <groupId>org.onap.so.adapters</groupId>
   <artifactId>mso-adapters-rest-interface</artifactId>
index 89ef373..dbae239 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <groupId>org.onap.so.adapters</groupId>
   <artifactId>mso-catalog-db-adapter</artifactId>
index c64ec25..afe6528 100644 (file)
@@ -17,10 +17,12 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
 ('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'DEFAULT', '*'),
 ('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'DEFAULT', '*'),
 ('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'DEFAULT', '*'),
+('VNF-Macro-Create', 'createInstance', 'Vnf', false,true, '7','7', 'DEFAULT', '*'),
 ('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'DEFAULT', '*'),
 ('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'DEFAULT', '*'),
 ('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', '*'),
 ('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'DEFAULT', '*'),
 ('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'DEFAULT', '*'),
 ('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'DEFAULT', '*'),
@@ -36,8 +38,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
 --
 --  northbound_request_ref_lookup for updateInstance (Macro Flow)
 --
-INSERT INTO northbound_request_ref_lookup(ID, REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE)
-VALUES (500, 'Vnf', 'VNF-Macro-Modify', 'updateInstance', 0, 7, 7, 1, 'k8scloudowner4', '*');
+INSERT INTO northbound_request_ref_lookup(REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE)
+VALUES ('Vnf', 'VNF-Macro-Modify', 'updateInstance', 0, 7, 7, 1, 'k8scloudowner4', '*');
 
 
 INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
@@ -111,6 +113,37 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
 ('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '6', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '7', 'AssignPnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '8', 'WaitForPnfReadyBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '9', 'ActivatePnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '10', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '11', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '12', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '13', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '14', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '15', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '16', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '17', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Create', '18', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Create' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '10', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '11', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '12', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Macro-Delete', '13', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'DEFAULT')),
 ('VNF-Macro-Recreate', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'DEFAULT')),
@@ -220,10 +253,10 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
 --
 --  orchestration_flow_reference for updateInstance (Macro Flow)
 --
-insert into orchestration_flow_reference (id,COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID,SCOPE,ACTION)
-values (901, 'VNF-Macro-Modify',1,'ControllerExecutionBB',1,500,'vnf','config-assign');
-insert into orchestration_flow_reference (id,COMPOSITE_ACTION,SEQ_NO,FLOW_NAME,FLOW_VERSION,NB_REQ_REF_LOOKUP_ID,SCOPE,ACTION)
-values (902, 'VNF-Macro-Modify',2,'ControllerExecutionBB',1,500,'vnf','config-deploy');
+insert into orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, SCOPE, ACTION, NB_REQ_REF_LOOKUP_ID)
+values ('VNF-Macro-Modify', 1, 'ControllerExecutionBB', 1, 'vnf', 'config-assign', (SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'k8scloudowner4'));
+insert into orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, SCOPE, ACTION, NB_REQ_REF_LOOKUP_ID)
+values ('VNF-Macro-Modify', 2, 'ControllerExecutionBB', 1, 'vnf', 'config-deploy', (SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'k8scloudowner4'));
 
 
 INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES
@@ -955,5 +988,7 @@ VALUES
 
 UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-assign' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigAssignVnfBB';
 UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-deploy' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigDeployVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-assign' WHERE COMPOSITE_ACTION = 'VNF-Macro-Create' and FLOW_NAME = 'ConfigAssignVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-deploy' WHERE COMPOSITE_ACTION = 'VNF-Macro-Create' and FLOW_NAME = 'ConfigDeployVnfBB';
 UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='HealthCheck' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
 UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vfmodule', ACTION='ScaleOutReconfiguration' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
index 97a4503..7c795ee 100644 (file)
@@ -1,46 +1,47 @@
 <configuration>
 
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-  <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
-
-  <logger name="com.att.ecomp.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="com.att.eelf.error" level="WARN" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-    <appender-ref ref="STDOUT" />
-    <appender-ref ref="test" />
-  </logger>
-
-  <logger name="org.flywaydb" level="DEBUG" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  <logger name="org.hibernate" level="DEBUG" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="ch.vorburger" level="WARN" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-
-
-  <root level="WARN">
-    <appender-ref ref="STDOUT" />
-    <appender-ref ref="test" />
-  </root>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
+
+    <logger name="com.att.ecomp.audit" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="WARN" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+        <appender-ref ref="test" />
+    </logger>
+
+    <logger name="org.flywaydb" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+    <logger name="org.hibernate" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="ch.vorburger" level="WARN" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+    
+    <root level="WARN">
+        <appender-ref ref="STDOUT" />
+        <appender-ref ref="test" />
+    </root>
 
 
 </configuration>
\ No newline at end of file
index aa6e504..983ec13 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>mso-openstack-adapters</artifactId>
   <packaging>jar</packaging>
index 31da330..dfb3075 100644 (file)
@@ -24,12 +24,15 @@ package org.onap.so.adapters.tasks.orchestration;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXB;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.mutable.MutableBoolean;
 import org.camunda.bpm.client.task.ExternalTask;
 import org.camunda.bpm.client.task.ExternalTaskService;
@@ -66,6 +69,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
 import com.woorea.openstack.heat.model.Stack;
 
 @Component
@@ -318,14 +322,16 @@ public class PollService extends ExternalTaskUtils {
         success.setTrue();
     }
 
-    protected Optional<String> findRequestType(String xmlString) {
+    protected Optional<String> findRequestType(final String xmlString) {
         try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            org.w3c.dom.Document doc;
-            doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY);
+
+            final DocumentBuilder builder = factory.newDocumentBuilder();
+            final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)));
             return Optional.of(doc.getDocumentElement().getNodeName());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             logger.error("Error Finding Request Type", e);
             return Optional.empty();
         }
index 4636a91..b9e86b0 100644 (file)
@@ -2,13 +2,16 @@ package org.onap.so.adapters.tasks.orchestration;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXB;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.ws.Holder;
+import org.apache.commons.lang3.StringUtils;
 import org.camunda.bpm.client.task.ExternalTask;
 import org.camunda.bpm.client.task.ExternalTaskService;
 import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
@@ -24,6 +27,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
 
 @Component
 public class RollbackService extends ExternalTaskUtils {
@@ -110,14 +114,16 @@ public class RollbackService extends ExternalTaskUtils {
         }
     }
 
-    protected Optional<String> findRequestType(String xmlString) {
+    protected Optional<String> findRequestType(final String xmlString) {
         try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            org.w3c.dom.Document doc;
-            doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY);
+
+            final DocumentBuilder builder = factory.newDocumentBuilder();
+            final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)));
             return Optional.of(doc.getDocumentElement().getNodeName());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             logger.error("Error Finding Request Type", e);
             return Optional.empty();
         }
index 9b2badd..4fc4263 100644 (file)
@@ -24,14 +24,17 @@ package org.onap.so.adapters.tasks.orchestration;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXB;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.ws.Holder;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.mutable.MutableBoolean;
 import org.camunda.bpm.client.task.ExternalTask;
 import org.camunda.bpm.client.task.ExternalTaskService;
@@ -59,6 +62,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
 
 @Component
 public class StackService extends ExternalTaskUtils {
@@ -342,14 +346,16 @@ public class StackService extends ExternalTaskUtils {
 
     }
 
-    protected Optional<String> findRequestType(String xmlString) {
+    protected Optional<String> findRequestType(final String xmlString) {
         try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            org.w3c.dom.Document doc;
-            doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY);
+
+            final DocumentBuilder builder = factory.newDocumentBuilder();
+            final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)));
             return Optional.of(doc.getDocumentElement().getNodeName());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             logger.error("Error Finding Request Type", e);
             return Optional.empty();
         }
index 8bfa6d8..a2cf7db 100644 (file)
@@ -18,8 +18,8 @@
   ============LICENSE_END=========================================================
   -->
 
-<configuration >
+<configuration>
+
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
             <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
         </encoder>
     </appender>
 
+    <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
 
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
 
-  <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
-  
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-
+    <logger name="org.reflections" level="ERROR" />
 
-  <root level="WARN">
-    <appender-ref ref="STDOUT" />
-  </root>
+    <root level="WARN">
+        <appender-ref ref="STDOUT" />
+    </root>
 
 </configuration>
index 45acf24..f627295 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <groupId>org.onap.so.adapters</groupId>
   <artifactId>mso-requests-db-adapter</artifactId>
index a63bd27..c676d7f 100644 (file)
@@ -1,48 +1,48 @@
 <configuration>
-       <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-               <encoder>
-                       <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
-               </encoder>
-       </appender>
-
-       <appender name="test"
-               class="org.onap.so.adapters.requestsdb.application.TestAppender" />
-
-       <logger name="com.att.ecomp.audit" level="info" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-       <logger name="com.att.eelf.metrics" level="info" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-       <logger name="com.att.eelf.error" level="WARN" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-       <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-               <appender-ref ref="STDOUT" />
-               <appender-ref ref="test" />
-       </logger>
-       
-       <logger name="org.flywaydb" level="DEBUG" additivity="false">
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <appender name="test" class="org.onap.so.adapters.requestsdb.application.TestAppender" />
+
+    <logger name="com.att.ecomp.audit" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="WARN" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
         <appender-ref ref="STDOUT" />
+        <appender-ref ref="test" />
     </logger>
-       
-
-       <logger name="ch.vorburger" level="WARN" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-  
-  <logger name="org.hibernate" level="DEBUG" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-       
-
-       <root level="WARN">
-               <appender-ref ref="STDOUT" />
-               <appender-ref ref="test" />
-       </root>
 
+    <logger name="org.flywaydb" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+
+    <logger name="ch.vorburger" level="WARN" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.hibernate" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+
+    <root level="WARN">
+        <appender-ref ref="STDOUT" />
+        <appender-ref ref="test" />
+    </root>
 
 </configuration>
\ No newline at end of file
index 62ba731..2befd5c 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>mso-sdnc-adapter</artifactId>
   <properties>
index 3a3e57a..0b44f79 100644 (file)
@@ -18,8 +18,8 @@
   ============LICENSE_END=========================================================
   -->
 
-<configuration >
+<configuration>
+
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
             <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
     </appender>
 
 
-  <logger name="com.att.eelf.audit" level="INFO" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
+    <logger name="com.att.eelf.audit" level="INFO" additivity="false">
         <appender-ref ref="STDOUT" />
-  </logger>
+    </logger>
 
-  <logger name="com.att.eelf.error" level="WARN" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
-  
-   <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
+    <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
 
-  <root level="WARN">
-    <appender-ref ref="STDOUT" />
-  </root>
+    <logger name="com.att.eelf.error" level="WARN" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+    <root level="WARN">
+        <appender-ref ref="STDOUT" />
+    </root>
 
 </configuration>
index ee48021..66a3752 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>adapters</artifactId>
index 2e4a442..a02df8c 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>adapters</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <groupId>org.onap.so.adapters</groupId>
   <artifactId>so-appc-orchestrator</artifactId>
index 8a9e705..eaf5a9c 100644 (file)
@@ -1,31 +1,32 @@
 <configuration>
-  
-  
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-
-  <logger name="com.att.ecomp.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+
+    <logger name="com.att.ecomp.audit" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="trace" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.onap" level="${so.log.level:-WARN}" additivity="false">
         <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="com.att.eelf.error" level="trace" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
-  
-       <logger name="org.onap" level="${so.log.level:-WARN}" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-  <root level="WARN">
-    <appender-ref ref="STDOUT" />
-  </root>
-  
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+    
+    <root level="WARN">
+        <appender-ref ref="STDOUT" />
+    </root>
+
 </configuration>
\ No newline at end of file
index 0eef01d..d539e65 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>asdc-controller</artifactId>
   <name>asdc-controller</name>
index da7aad4..bc4434a 100644 (file)
@@ -1471,13 +1471,30 @@ public class ToscaResourceInstaller {
                 generateNamingValue = "true".equalsIgnoreCase(generateNaming);
             }
             service.setOnapGeneratedNaming(generateNamingValue);
-            service.setBlueprintName(serviceMetadata.getValue(CDS_MODEL_NAME));
-            service.setBlueprintVersion(serviceMetadata.getValue(CDS_MODEL_VERSION));
-            service.setSkipPostInstConf(Boolean.valueOf(serviceMetadata.getValue(SKIP_POST_INST_CONF)));
-            service.setControllerActor(serviceMetadata.getValue(CONTROLLER_ACTOR));
-        }
-
 
+            List<Input> serviceInputs = toscaResourceStructure.getSdcCsarHelper().getServiceInputs();
+            logger.debug("serviceInputs: {} " + serviceInputs);
+            if (!serviceInputs.isEmpty()) {
+                serviceInputs.forEach(input -> {
+                    if (CDS_MODEL_NAME.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : null;
+                        service.setBlueprintName(value);
+                    }
+                    if (CDS_MODEL_VERSION.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : null;
+                        service.setBlueprintVersion(value);
+                    }
+                    if (CONTROLLER_ACTOR.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : null;
+                        service.setControllerActor(value);
+                    }
+                    if (SKIP_POST_INST_CONF.equalsIgnoreCase(input.getName())) {
+                        String value = input.getDefault() != null ? input.getDefault().toString() : "false";
+                        service.setSkipPostInstConf(Boolean.valueOf(value));
+                    }
+                });
+            }
+        }
         toscaResourceStructure.setCatalogService(service);
         return service;
     }
index e488211..bf327f5 100644 (file)
@@ -36,6 +36,7 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -571,6 +572,36 @@ public class ToscaResourceInstallerTest extends BaseTest {
         doReturn(namingPolicy).when(metadata).getValue("namingPolicy");
         doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming");
 
+        ISdcCsarHelper iSdcCsarHelper = mock(ISdcCsarHelper.class);
+        List<Input> serviceInputs = new ArrayList<Input>();
+
+        LinkedHashMap<String, Object> value = new LinkedHashMap<String, Object>();
+        value.put("controller_actor", "SO-REF-DATA");
+        value.put("type", "string");
+        Input input = new Input("controller_actor", value, null);
+        serviceInputs.add(0, input);
+
+        value = new LinkedHashMap<String, Object>();
+        value.put("cds_model_version", "v1.4.0");
+        value.put("type", "string");
+        input = new Input("cds_model_version", value, null);
+        serviceInputs.add(1, input);
+
+        value = new LinkedHashMap<String, Object>();
+        value.put("cds_model_name", "Blueprint140");
+        value.put("type", "string");
+        input = new Input("cds_model_name", value, null);
+        serviceInputs.add(2, input);
+
+        value = new LinkedHashMap<String, Object>();
+        value.put("skip_post_instantiation_configuration", "false");
+        value.put("type", "boolean");
+        input = new Input("skip_post_instantiation_configuration", value, null);
+        serviceInputs.add(3, input);
+
+        doReturn(iSdcCsarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+        doReturn(serviceInputs).when(iSdcCsarHelper).getServiceInputs();
+
         Service service = toscaInstaller.createService(toscaResourceStructure, resourceStructure);
 
         assertNotNull(service);
index 89d24a1..a026c7a 100644 (file)
Binary files a/asdc-controller/src/test/resources/download/service-pnfservice.csar and b/asdc-controller/src/test/resources/download/service-pnfservice.csar differ
index 25d2ebd..1dcfb59 100644 (file)
Binary files a/asdc-controller/src/test/resources/download/service-vnfservice.csar and b/asdc-controller/src/test/resources/download/service-vnfservice.csar differ
index d74de50..75b2523 100644 (file)
@@ -1,7 +1,5 @@
 <configuration>
 
-
-
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
             <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
     </logger>
 
     <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-    
+        <appender-ref ref="STDOUT" />
+    </logger>
 
     <logger name="ch.vorburger" level="WARN" additivity="false">
         <appender-ref ref="STDOUT" />
     </logger>
 
+    <logger name="org.reflections" level="ERROR" />
+
     <root level="WARN">
         <appender-ref ref="STDOUT" />
     </root>
 
-
 </configuration>
\ No newline at end of file
index c051aac..d5c9f05 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>MSOCommonBPMN</artifactId>
   <name>MSOCommonBPMN</name>
     <dependency>
       <groupId>commons-beanutils</groupId>
       <artifactId>commons-beanutils</artifactId>
-      </dependency>
+    </dependency>
     <dependency>
       <!-- Needed for InMemoryH2Test -->
       <groupId>com.h2database</groupId>
index 5cbadd6..83d1f52 100644 (file)
@@ -1054,8 +1054,18 @@ public class BBInputSetup implements JavaDelegate {
             if (requestDetails.getOwningEntity() != null)
                 owningEntity = mapperLayer.mapRequestOwningEntity(requestDetails.getOwningEntity());
 
-            Service service =
-                    bbInputSetupUtils.getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId());
+            String modelVersionId = requestDetails.getModelInfo().getModelVersionId();
+
+            if (ModelType.vnf == requestDetails.getModelInfo().getModelType()) {
+                for (RelatedInstanceList relatedInstanceList : requestDetails.getRelatedInstanceList()) {
+                    if (ModelType.service == relatedInstanceList.getRelatedInstance().getModelInfo().getModelType()) {
+                        modelVersionId = relatedInstanceList.getRelatedInstance().getModelInfo().getModelVersionId();
+                        break;
+                    }
+                }
+            }
+
+            Service service = bbInputSetupUtils.getCatalogServiceByModelUUID(modelVersionId);
             if (service == null) {
                 service = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID(
                         requestDetails.getModelInfo().getModelVersion(),
index 3438c79..235b621 100644 (file)
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.scripts
 
 
 import static org.mockito.Mockito.*
-
 import org.camunda.bpm.engine.ProcessEngineServices
 import org.camunda.bpm.engine.RepositoryService
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
@@ -48,10 +47,10 @@ public class SDNCAdapterTest {
        }
 
 
-       String workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
+       String workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns="com:att:sdnctl:l3api"
+                                                 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
                                                  xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"
-                                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                                                 xmlns="com:att:sdnctl:l3api">
+                                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <sdncadapterworkflow:response-data>
       <tag0:CallbackHeader>
          <tag0:RequestId>testRequestId</tag0:RequestId>
index 9088d1a..90f73dc 100644 (file)
@@ -24,7 +24,7 @@
   <root level="WARN">
     <appender-ref ref="STDOUT" />
   </root>
-
+  <logger name="org.reflections" level="ERROR" />
   <logger name="wiremock.org" level="ERROR" />
 
 </configuration>
\ No newline at end of file
index b6aead3..4b19663 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>MSOCoreBPMN</artifactId>
index da096e5..79a4c54 100644 (file)
@@ -49,6 +49,7 @@ import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
@@ -87,44 +88,47 @@ public final class XmlTool {
      * @throws SAXException
      * @throws XPathExpressionException
      */
-    public static String normalize(Object xml) throws IOException, TransformerException, ParserConfigurationException,
-            SAXException, XPathExpressionException {
+    public static String normalize(final Object xml) throws IOException, TransformerException,
+            ParserConfigurationException, SAXException, XPathExpressionException {
 
         if (xml == null) {
             return null;
         }
 
-        Source xsltSource = new StreamSource(new StringReader(readResourceFile("normalize-namespaces.xsl")));
+        final Source xsltSource = new StreamSource(new StringReader(readResourceFile("normalize-namespaces.xsl")));
 
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+        final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
         dbFactory.setNamespaceAware(true);
         dbFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
         dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
-        DocumentBuilder db = dbFactory.newDocumentBuilder();
-        InputSource source = new InputSource(new StringReader(String.valueOf(xml)));
-        Document doc = db.parse(source);
+        final DocumentBuilder db = dbFactory.newDocumentBuilder();
+        final InputSource source = new InputSource(new StringReader(String.valueOf(xml)));
+        final Document doc = db.parse(source);
 
         // Start of code to remove whitespace outside of tags
-        XPath xPath = XPathFactory.newInstance().newXPath();
-        NodeList nodeList = (NodeList) xPath.evaluate("//text()[normalize-space()='']", doc, XPathConstants.NODESET);
+        final XPath xPath = XPathFactory.newInstance().newXPath();
+        final NodeList nodeList =
+                (NodeList) xPath.evaluate("//text()[normalize-space()='']", doc, XPathConstants.NODESET);
 
         for (int i = 0; i < nodeList.getLength(); ++i) {
-            Node node = nodeList.item(i);
+            final Node node = nodeList.item(i);
             node.getParentNode().removeChild(node);
         }
         // End of code to remove whitespace outside of tags
 
         // the factory pattern supports different XSLT processors
-        TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        final TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+        transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, StringUtils.EMPTY);
         transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-        Transformer transformer = transformerFactory.newTransformer(xsltSource);
+        final Transformer transformer = transformerFactory.newTransformer(xsltSource);
 
         transformer.setOutputProperty(OutputKeys.INDENT, "yes");
         transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
         transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
 
-        StringWriter writer = new StringWriter();
+        final StringWriter writer = new StringWriter();
         transformer.transform(new DOMSource(doc), new StreamResult(writer));
         return writer.toString().trim();
     }
@@ -220,7 +224,7 @@ public final class XmlTool {
      * @return the contents of the modified XML document as a String or null/empty if the modification failed.
      * @throws IOException, TransformerException, ParserConfigurationException, SAXException
      */
-    public static Optional<String> modifyElement(String xml, String elementTag, String newValue)
+    public static Optional<String> modifyElement(final String xml, final String elementTag, final String newValue)
             throws IOException, TransformerException, ParserConfigurationException, SAXException {
 
         if (xml == null || xml.isEmpty()) {
@@ -228,15 +232,15 @@ public final class XmlTool {
             return Optional.empty();
         }
 
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+        final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
         dbFactory.setNamespaceAware(true);
         dbFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
         dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
-        DocumentBuilder db = dbFactory.newDocumentBuilder();
-        InputSource source = new InputSource(new StringReader(xml));
-        Document doc = db.parse(source);
+        final DocumentBuilder db = dbFactory.newDocumentBuilder();
+        final InputSource source = new InputSource(new StringReader(xml));
+        final Document doc = db.parse(source);
 
-        Node modNode = doc.getElementsByTagName(elementTag).item(0);
+        final Node modNode = doc.getElementsByTagName(elementTag).item(0);
         if (modNode == null) {
             // did not find the specified element to be modified, return empty
             // System.out.println("Did not find element tag " + elementTag + " in XML");
@@ -245,9 +249,12 @@ public final class XmlTool {
             modNode.setTextContent(newValue);
         }
 
-        TransformerFactory transformerFactory = TransformerFactory.newInstance();
-        Transformer transformer = transformerFactory.newTransformer();
-        StringWriter writer = new StringWriter();
+        final TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+        transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, StringUtils.EMPTY);
+
+        final Transformer transformer = transformerFactory.newTransformer();
+        final StringWriter writer = new StringWriter();
         transformer.transform(new DOMSource(doc), new StreamResult(writer));
         // return the modified String representation of the XML
         return Optional.of(writer.toString().trim());
index 02ac437..20b0dce 100644 (file)
   ============LICENSE_END=========================================================
   -->
 
-<configuration >
-  
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
-    </encoder>
-  </appender>
+<configuration>
 
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n
+            </pattern>
+        </encoder>
+    </appender>
 
-  <logger name="com.att.eelf.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+    <logger name="com.att.eelf.audit" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
         <appender-ref ref="STDOUT" />
-  </logger>
+    </logger>
 
-  <logger name="com.att.eelf.error" level="trace" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
-       <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-  <root level="info">
-    <appender-ref ref="STDOUT" />
-  </root>
+    <logger name="com.att.eelf.error" level="trace" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+    
+    <root level="info">
+        <appender-ref ref="STDOUT" />
+    </root>
 
 </configuration>
index aa76782..1f11453 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>mso-infrastructure-bpmn</artifactId>
index 7b7135f..6a61ed1 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>bpmn</artifactId>
   <name>BPMN Subsystem</name>
@@ -15,7 +15,7 @@
     <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version>
     <h2.version>1.4.196</h2.version>
     <groovy.version>2.5.3</groovy.version>
-    <saxon.version>9.5.1-8</saxon.version>
+    <saxon.version>10.5</saxon.version>
     <xmlunit.version>2.4.0</xmlunit.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
index a08fc61..9e1d109 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-bpmn-building-blocks</artifactId>
index c080bc9..c0b24d9 100644 (file)
@@ -27,5 +27,6 @@
   </root>
 
   <logger name="wiremock.org" level="DEBUG" />
+  <logger name="org.reflections" level="ERROR" />
 
 </configuration>
\ No newline at end of file
index c6a4ffc..846af27 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-bpmn-infrastructure-common</artifactId>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
     </dependency>
- <dependency>
-    <groupId>org.apache.cxf</groupId>
-    <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
-    <version>3.4.2</version>
-</dependency>
   <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
+      <version>3.4.2</version>
+    </dependency>
     <dependency>
       <groupId>com.h2database</groupId>
       <artifactId>h2</artifactId>
index 2c1fa64..540358f 100644 (file)
@@ -176,9 +176,9 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
        org.onap.aai.domain.yang.SliceProfile ANNF_SliceProfile = new SliceProfile()
        org.onap.aai.domain.yang.SliceProfile TNFH_SliceProfile = new SliceProfile()
        org.onap.aai.domain.yang.SliceProfile TNMH_SliceProfile = new SliceProfile()
-       ANNF_SliceProfile = createSliceProfile("AN-NF", execution)
-       TNFH_SliceProfile = createSliceProfile("TN-FH",execution)
-       TNMH_SliceProfile = createSliceProfile("TN-MH",execution)
+       ANNF_SliceProfile = createSliceProfile("AN_NF", execution)
+       TNFH_SliceProfile = createSliceProfile("TN_FH",execution)
+       TNMH_SliceProfile = createSliceProfile("TN_MH",execution)
        
        ANNF_SliceProfiles.getSliceProfile().add(ANNF_SliceProfile)
        TNFH_SliceProfiles.getSliceProfile().add(TNFH_SliceProfile)
@@ -194,13 +194,13 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
        String serviceStatus = "deactivated"
        ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
        String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
-       ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+        ANNF_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
        String serviceRole = "slice-profile-instance"
        ANNF_sliceProfileInstance.setServiceRole(serviceRole)
         ArrayList<String> snssaiList = execution.getVariable("snssaiList")
        String snssai = snssaiList.get(0)
        ANNF_sliceProfileInstance.setEnvironmentContext(snssai)
-       ANNF_sliceProfileInstance.setWorkloadContext("AN-NF")    
+       ANNF_sliceProfileInstance.setWorkloadContext("AN_NF")    
        ANNF_sliceProfileInstance.setSliceProfiles(ANNF_SliceProfiles)
        String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel")
        ANNF_sliceProfileInstance.setServiceFunction(serviceFunctionAnnf)
@@ -214,10 +214,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
        TNFH_sliceProfileInstance.setServiceType(serviceType)
        TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
        serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList")
-       TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+        TNFH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
        TNFH_sliceProfileInstance.setServiceRole(serviceRole)
        TNFH_sliceProfileInstance.setEnvironmentContext(snssai)
-       TNFH_sliceProfileInstance.setWorkloadContext("TN-FH")
+       TNFH_sliceProfileInstance.setWorkloadContext("TN_FH")
        TNFH_sliceProfileInstance.setSliceProfiles(TNFH_SliceProfiles)
        String serviceFunctionTnFH = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "resourceSharingLevel")
        TNFH_sliceProfileInstance.setServiceFunction(serviceFunctionTnFH)
@@ -231,10 +231,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
        TNMH_sliceProfileInstance.setServiceType(serviceType)
        TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
        serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList")
-       TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+        TNMH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
        TNMH_sliceProfileInstance.setServiceRole(serviceRole)
        TNMH_sliceProfileInstance.setEnvironmentContext(snssai)
-       TNMH_sliceProfileInstance.setWorkloadContext("TN-MH")
+       TNMH_sliceProfileInstance.setWorkloadContext("TN_MH")
        TNMH_sliceProfileInstance.setSliceProfiles(TNMH_SliceProfiles)
        String serviceFunctionTnMH = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "resourceSharingLevel")
        TNMH_sliceProfileInstance.setServiceFunction(serviceFunctionTnMH)
@@ -267,7 +267,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
        SliceProfile result = new SliceProfile()
        Map<String,Object> profile
        switch(domainType) {
-               case "AN-NF":
+               case "AN_NF":
                        profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - cSReliabilityMeanTime, cSAvailabilityTarget, terminalDensity, msgSizeByte
                        result.setJitter(profile.get("jitter"))
                        result.setLatency(profile.get("latency"))
@@ -288,7 +288,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
                        result.setExpDataRate(profile.get("expDataRate"))
                        result.setProfileId(execution.getVariable("ANNF_sliceProfileId"))
                        break
-               case "TN-FH":
+               case "TN_FH":
                        profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) 
                        result.setJitter(profile.get("jitter"))
                        result.setLatency(profile.get("latency"))
@@ -296,7 +296,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
                        result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
                        result.setProfileId(execution.getVariable("TNFH_sliceProfileId"))
                        break
-               case "TN-MH":
+               case "TN_MH":
                        profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
                        result.setJitter(profile.get("jitter"))
                        result.setLatency(profile.get("latency"))
@@ -361,7 +361,8 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
                        if(domainType.equals("TN_FH")) {
                                serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
                                serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
-                               serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
+                               serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNFH_modelName"))
+                               serviceInfo.addProperty("sst",  execution.getVariable("sst"))
                                allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid"))
                                allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
                                Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
@@ -373,7 +374,8 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
                        }else if(domainType.equals("TN_MH")) {
                                serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
                                serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
-                               serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
+                               serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNMH_modelName"))
+                               serviceInfo.addProperty("sst",  execution.getVariable("sst"))
                                allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid"))
                                allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
                                Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
@@ -383,26 +385,40 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
                                endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
                                connectionLinksList.add(endpoints)
                        }
-                       
-                       //Connection links
-                       connectionLinks.add("connectionLinks", connectionLinksList)
-                       transportSliceNetworksList.add(connectionLinks)
-                       allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
                }else if(action.equals("modify-allocate")) {
+                        JsonObject endpoints = new JsonObject()
                        if(domainType.equals("TN_FH")) {
                                allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
                                allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
                                allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
                                serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
                                 serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+                                Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
+                                sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+                                allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
+                                endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_RU"))
+                                endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN"))
+                                connectionLinksList.add(endpoints)
                        }else if(domainType.equals("TN_MH")) {
                                allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
                                allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
                                allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
                                serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
                                 serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+                                Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
+                                sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+                                allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
+                                endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG"))
+                                endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
+                                connectionLinksList.add(endpoints)
                        }
                }
+
+                //Connection links
+                connectionLinks.add("connectionLinks", connectionLinksList)
+                transportSliceNetworksList.add(connectionLinks)
+                allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
+
                JsonParser parser = new JsonParser()
                String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo")
                allocateTnNssi.add("nsiInfo",(JsonObject) parser.parse(nsiInfo))
index 567c703..f3fca05 100644 (file)
@@ -53,6 +53,7 @@ import org.onap.aaiclient.client.aai.AAINamespaceConstants
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aai.domain.yang.NetworkPolicy
 import org.onap.aai.domain.yang.NetworkRoute
+import org.json.JSONArray
 
 class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
 
@@ -85,7 +86,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                                        " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
                                        " jobId - "+execution.getVariable("jobId")+
                                        " sliceParams - "+execution.getVariable("sliceParams")+
-                                       " servicename - "+ execution.getVariable("servicename"))
+                                       " servicename - "+ execution.getVariable("servicename")+
+                                        " sst - "+ execution.getVariable("sst"))
 
                        //validate slice subnet inputs
 
@@ -101,7 +103,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                        String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
                        def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
                        def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList"))
-                       def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList"))
+                        String jsonArray = jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList")
+                        List<Integer> list = new ArrayList<>();
+                        JSONArray arr = new JSONArray(jsonArray);
+                        for (int i = 0; i < arr.length(); i++) {
+                                 int s = (int) arr.get(i);
+                                 list.add(s);
+                        }
+                        def coverageAreaTAList = list;
 
                        if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty)
                        || (coverageAreaTAList.empty)) {
@@ -131,16 +140,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                        execution.setVariable("job_timeout", 10)
                        
                        //set BH end point
-                       List<String> BH_endPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
-                       logger.debug("BH end points list : "+BH_endPoints)
-                       if(BH_endPoints.empty) {
-                               msg = "End point info is empty"
-                               logger.debug(msg)
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                       }else {
-                               execution.setVariable("bh_endpoint", BH_endPoints.get(0))
-                       }
-                       
+                       def BH_endPoints = jsonUtil.getJsonValue(sliceParams, "endPoint")
+                        logger.debug("BH end points list : "+BH_endPoints)
+                        if(isBlank(BH_endPoints)) {
+                                msg = "End point info is empty"
+                                logger.debug(msg)
+                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                        }else {
+                                execution.setVariable("bh_endpoint", BH_endPoints)
+                        }
+
                } catch(BpmnError e) {
                        throw e
                } catch(Exception ex) {
@@ -261,6 +270,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                String requestId = execution.getVariable("msoRequestId")
                String messageType = "NSISelectionResponse"
                Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+                profileInfo.put("sST",execution.getVariable("sst"))
                String modelUuid = execution.getVariable("modelUuid")
                String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
                String modelName = execution.getVariable("ranModelName")
@@ -377,8 +387,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                serviceInfo.addProperty("nssiId", execution.getVariable("RANServiceInstanceId"))
                serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
                serviceInfo.addProperty("nssiName", execution.getVariable("servicename"))
-               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
-               serviceInfo.addProperty("sST", sST)
+                serviceInfo.addProperty("sST", execution.getVariable("sst"))
                serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
                serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
                serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
@@ -475,6 +484,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(execution.getVariable("RanConstituentSliceProfiles"))
                anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
                Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
+               profileInfo.put("sST",execution.getVariable("sst"))
                String modelUuid = execution.getVariable("ANNF_modelUuid")
                String modelInvariantUuid = execution.getVariable("ANNF_modelInvariantUuid")
                String modelName = execution.getVariable("ANNF_modelName")
@@ -518,6 +528,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                                ServiceDecomposition serviceDecomposition = execution.getVariable("ANNF_ServiceDecomposition")
                                serviceDecomposition.setServiceInstance(serviceInstance);
                                execution.setVariable("ANNF_ServiceDecomposition", serviceDecomposition)
+                                execution.setVariable("modifyAction","allocate")
                                execution.setVariable("isRspRanNfNssi", true)
                        }else {
                                logger.debug("No solutions returned from OOF .. Create new RAN NF NSSI")
@@ -544,17 +555,18 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                String sliceInstanceName = execution.getVariable("servicename")
                ANServiceInstance.setServiceInstanceName(sliceInstanceName)
                String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
-               ANServiceInstance.setServiceType(serviceType)
+                ANServiceInstance.setServiceType(execution.getVariable("sst"))
                String serviceStatus = "deactivated"
                ANServiceInstance.setOrchestrationStatus(serviceStatus)
                String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
-               ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+                ANServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
                String serviceRole = "nssi"
                ANServiceInstance.setServiceRole(serviceRole)
-               List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+                List<String> snssaiList = execution.getVariable("snssaiList")
                String snssai = snssaiList.get(0)
-               ANServiceInstance.setEnvironmentContext(snssai)
-               ANServiceInstance.setWorkloadContext("AN")
+               //ANServiceInstance.setEnvironmentContext(snssai)
+                ANServiceInstance.setEnvironmentContext("an") //Network Type
+               ANServiceInstance.setWorkloadContext("AN") //domain Type
                
                logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
                String msg = ""
@@ -610,7 +622,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                String sliceInstanceName = execution.getVariable("servicename")
                ANServiceInstance.setServiceInstanceName(sliceInstanceName)
                String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
-               ANServiceInstance.setServiceType(serviceType)
+                ANServiceInstance.setServiceType(execution.getVariable("sst"))
                String serviceStatus = "deactivated"
                ANServiceInstance.setOrchestrationStatus(serviceStatus)
                String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
@@ -630,19 +642,19 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
                //create RAN NF NSSI
                ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId"))
-               sliceInstanceName = execution.getVariable("ANNF_modelName")
+               sliceInstanceName = "nssi_"+execution.getVariable("ANNF_modelName")
                ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
-               ANNFServiceInstance.setServiceType(serviceType)
+               ANNFServiceInstance.setServiceType(execution.getVariable("sst"))
                ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
                serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
-               ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+                ANNFServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
                ANNFServiceInstance.setServiceRole(serviceRole)
                snssaiList = execution.getVariable("snssaiList")
                snssai = snssaiList.get(0)
                ANNFServiceInstance.setEnvironmentContext(snssai)
                 ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid"))
                 ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid"))
-               ANNFServiceInstance.setWorkloadContext("AN-NF")
+               ANNFServiceInstance.setWorkloadContext("AN_NF")
                String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel")
                ANNFServiceInstance.setServiceFunction(serviceFunctionAnnf)
                logger.debug("completed AN service instance build "+ ANNFServiceInstance.toString())
@@ -720,8 +732,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                execution.setVariable("esrInfo", esrInfo.toString())
                JsonObject serviceInfo = new JsonObject()
                serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
-               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
-               serviceInfo.addProperty("sST", sST)
+                serviceInfo.addProperty("sST", execution.getVariable("sst"))
                serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
                serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
                serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
@@ -902,7 +913,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                String requestId = execution.getVariable("msoRequestId")
                Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
                sliceProfile.put("sliceProfileId", execution.getVariable("ANNF_sliceProfileInstanceId"))
-               sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+               sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSession"))
                sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
                sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
 
@@ -912,11 +923,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                JsonObject commonHeader = new JsonObject()
                JsonObject payload = new JsonObject()
                JsonObject payloadInput = new JsonObject()
-               commonHeader.addProperty("TimeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
+               commonHeader.addProperty("timeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
                commonHeader.addProperty("api-ver", "1.0")
+                commonHeader.addProperty("originator-id", "testing")
                commonHeader.addProperty("request-id", requestId)
                commonHeader.addProperty("sub-request-id", "1")
-               commonHeader.add("request-track", new JsonObject())
                commonHeader.add("flags", new JsonObject())
                Gson jsonConverter = new Gson() 
                payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
@@ -924,6 +935,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                payloadInput.addProperty("NSIID", execution.getVariable("nsiId"))
                payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId"))
                payloadInput.addProperty("callbackURL", callbackUrl)
+                payloadInput.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               payloadInput.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
                payloadInput.add("additionalproperties", new JsonObject())
                payload.add("input", payloadInput)
                input.add("common-header", commonHeader)
@@ -948,8 +961,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
                String bh_routeId = UUID.randomUUID().toString()
                execution.setVariable("tranportEp_ID_bh", bh_routeId)
                String role = "CU"
-               String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
-               String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+                String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "ipAddress")
+                String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "logicInterfaceId")
                String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
                NetworkRoute bh_ep = new NetworkRoute()
                bh_ep.setRouteId(bh_routeId)
index a1afe9a..2801c11 100644 (file)
@@ -94,12 +94,12 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
         execution.setVariable("networkServiceModelUuid", networkServiceModelUuid)
         String sliceParams = execution.getVariable("sliceParams")
         logger.debug("sliceParams "+sliceParams)
-        List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
+        String bhEndPoints = jsonUtil.getJsonValue(sliceParams, "endPoint")
         if(bhEndPoints.empty) {
             logger.debug("End point info is empty")
             exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty")
         }else {
-            execution.setVariable("bh_endpoint", bhEndPoints.get(0))
+            execution.setVariable("bh_endpoint", bhEndPoints)
         }
         logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice:::  preProcessRequest ****")
     }
@@ -130,6 +130,10 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
                 logger.debug(msg)
                 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
             }
+            //set shared or non shared value from sliceProfile object in request
+            String additionalParams = execution.getVariable("sliceParams")
+            //Get resourceSharingLevel from sliceProfile
+            String serviceFunction = jsonUtil.getJsonValue(additionalParams, "sliceProfile.resourceSharingLevel")
             String serviceInstanceName = "nssi_"+execution.getVariable("nsstName")
             ServiceInstance si = new ServiceInstance()
             si.setServiceInstanceId(execution.getVariable("nssiServiceInstanceId"))
@@ -141,6 +145,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
             si.setModelVersionId(execution.getVariable("modelUuid"))
             si.setEnvironmentContext(environmentContext)
             si.setWorkloadContext(workloadContext)
+            si.setServiceFunction(serviceFunction)
             logger.debug("AAI service Instance Request Payload : "+si.toString())
             AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
             getAAIClient().create(uri, si)
@@ -225,7 +230,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
         logger.debug(("Service Vnfs JSON: "+jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs")))
         List serviceVnfs = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs"))
         String networkServiceVnfJson = serviceVnfs.get(0)
-        String vnfInstanceName = (jsonUtil.getJsonValue(networkServiceVnfJson, "modelInfo.modelInstanceName")).trim() ?: ""
+        String vnfInstanceName = (jsonUtil.getJsonValue(networkServiceVnfJson, "modelInfo.modelInstanceName")).replace(" ","") ?: ""
         execution.setVariable("vnfInstanceName", vnfInstanceName)
     }
 
@@ -420,8 +425,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
         String bh_routeId = UUID.randomUUID().toString()
         execution.setVariable("coreEp_ID_bh", bh_routeId)
         String role = "CN"
-        String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
-        String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+        String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "ipAddress")
+        String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "logicInterfaceId")
         String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
         NetworkRoute bh_ep = new NetworkRoute()
         logger.debug("bh_endpoint: {}, bh_routeId: {}, cnIpAddress: {}, role: {}, LogicalLinkId: {}, nextHopInfo: {}, bh_ep: {}", bh_endpoint, bh_routeId, cnIpAddress, role, LogicalLinkId, nextHopInfo, bh_ep)
index b3c99c6..61528de 100644 (file)
@@ -80,14 +80,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: preProcessRequest ****")
         //Get NSSI Solutions
         String nssisolutions = execution.getVariable("solutions")
-
-        //Get First Object
-        List<String> nssiSolutionList = jsonUtil.StringArrayToList(nssisolutions)
-
-        logger.debug("nssiSolutionList : "+nssiSolutionList)
-
-        String nssiId = jsonUtil.getJsonValue(nssiSolutionList.get(0), "NSSIId")
-        logger.debug("NSSIId  : "+nssiId)
+        String nssiId = jsonUtil.getJsonValue(nssisolutions, "NSSIId")
 
         if (isBlank(nssiId)) {
             String msg = "solution nssiId is null"
@@ -98,12 +91,20 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         }
 
         String sNssaiListAsString = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "snssaiList")
-        logger.debug("sNssaiListAsString "+sNssaiListAsString)
         List<String> sNssaiList = jsonUtil.StringArrayToList(sNssaiListAsString)
-        logger.debug("sNssaiList "+sNssaiList)
         String sNssai = sNssaiList.get(0)
         execution.setVariable("sNssai", sNssai)
-        logger.debug("sNssai: "+sNssai)
+
+        //Setting this value in Map
+        Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+        spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
+        spiWithsNssaiAndOrchStatus.put("status", "created")
+
+        List <Map<String, Object>> spiWithsNssaiAndOrchStatusList = new ArrayList<>();
+        spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+
+        execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList)
+        logger.debug("service Profile's NSSAI And Orchestration Status:  "+spiWithsNssaiAndOrchStatus)
 
         String serviceType = execution.getVariable("subscriptionServiceType")
         execution.setVariable("serviceType", serviceType)
@@ -125,79 +126,77 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         String networkServiceInstanceId =""
         if(nsi.isPresent()) {
             List<Relationship> relationshipList = nsi.get().getRelationshipList()?.getRelationship()
-            List spiWithsNssaiAndOrchStatusList = new ArrayList<>()
+
+            List spiWithsNssaiAndOrchStatusList = execution.getVariable("snssaiAndOrchStatusList")
+
+            if(spiWithsNssaiAndOrchStatusList == null) {
+                spiWithsNssaiAndOrchStatusList = new ArrayList<>();
+            }
 
             for (Relationship relationship : relationshipList) {
                 String relatedTo = relationship.getRelatedTo()
-                if (relatedTo == "service-instance") {
+                if ("service-instance".equals(relatedTo)) {
                     List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                     List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
                     for (RelationshipData relationshipData : relationshipDataList) {
-                        if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+                        if ("service-instance.service-instance-id".equals(relationshipData.getRelationshipKey())) {
                             logger.debug("**** service-instance.service-instance-id 1 :: getServiceInstanceRelationships  :: "+ relationshipData.getRelationshipValue())
-                            execution.setVariable("networkServiceInstanceId", relationshipData.getRelationshipValue())
-                        }
-                    }
-                    for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
-                        if (relatedToProperty.getPropertyKey() == "service-instance.service-instance-name") {
-                            execution.setVariable("networkServiceInstanceName", relatedToProperty.getPropertyValue())
-                        }
-                    }
-                }
-                //If related to is allotted-Resource
-                if (relatedTo == "allotted-resource") {
-                    //get slice Profile Instance Id from allotted resource in list by nssi
-                    List<String> sliceProfileInstanceIdList = new ArrayList<>()
-                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
-                    for (RelationshipData relationshipData : relationshipDataList) {
-                        if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
-                            sliceProfileInstanceIdList.add(relationshipData.getRelationshipValue())
-                        }
-                    }
-                    for (String sliceProfileServiceInstanceId : sliceProfileInstanceIdList) {
-                        String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai"
-
-                        //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId
-                        AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg)
-                        Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class)
-                        if (sliceProfileServiceInstance.isPresent()) {
-                            String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus()
-                            String sNssai = sliceProfileServiceInstance.get().getSliceProfiles().getSliceProfile().get(0).getSNssai()
-                            if(sNssai.equals(execution.getVariable("sNssai"))) {
-                                orchestrationStatus = execution.getVariable("oStatus")
-                                //Slice Profile Service Instance to be updated in AAI
-                                execution.setVariable("sliceProfileServiceInstance", sliceProfileServiceInstance)
-                            }
 
-                            Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
-                            spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
-                            spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus)
-                            spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
-                            logger.debug("service Profile's NSSAI And Orchestration Status:  "+spiWithsNssaiAndOrchStatus)
+                            //Query Every related Service Instance From AAI by service Instance ID
+                            AAIResultWrapper instanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, relationshipData.getRelationshipValue(), "No Instance Present")
+                            Optional<ServiceInstance> relatedServiceInstance = instanceWrapper.asBean(ServiceInstance.class)
+                            if (relatedServiceInstance.isPresent()) {
+                                ServiceInstance relatedServiceInstanceObj = relatedServiceInstance.get()
+
+                                String role = relatedServiceInstanceObj.getServiceRole();
+
+                                if(role == null || role.isEmpty()) {
+                                    networkServiceInstanceId = relatedServiceInstanceObj.getServiceInstanceId()
+                                    networkServiceInstanceName = relatedServiceInstanceObj.getServiceInstanceName()
+
+                                    logger.debug("networkServiceInstanceId: {} networkServiceInstanceName: {} ",networkServiceInstanceId, networkServiceInstanceName)
+
+                                    execution.setVariable("networkServiceInstanceId", networkServiceInstanceId)
+                                    execution.setVariable("networkServiceInstanceName", networkServiceInstanceName)
+
+                                } else if("slice-profile-instance".equals(role)) {
+
+                                    String orchestrationStatus= relatedServiceInstanceObj.getOrchestrationStatus()
+                                    String sNssai = relatedServiceInstanceObj.getEnvironmentContext()
+                                    if(sNssai.equals(execution.getVariable("sNssai"))) {
+                                        orchestrationStatus = execution.getVariable("oStatus")
+                                        //Slice Profile Service Instance to be updated in AAI
+                                        execution.setVariable("sliceProfileServiceInstance", relatedServiceInstanceObj)
+                                    }
+
+                                    Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+                                    spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
+                                    spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus)
+                                    spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+                                    logger.debug("service Profile's NSSAI And Orchestration Status:  "+spiWithsNssaiAndOrchStatus)
+                                }
+
+                           }
                         }
+
                     }
+
                 }
             }
             execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList)
         }
-
         logger.debug("NSSI Id: ${serviceInstanceId}, network Service Instance Id: ${networkServiceInstanceId}, serviceName: ${networkServiceInstanceName}")
-
         //Get ServiceInstance Relationships
         getServiceInstanceRelationships(execution)
-
         //Get Vnf Relationships
         getVnfRelationships(execution)
 
         logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getNetworkInstanceAssociatedWithNssiId ****")
-    }
+       }
 
     private void getServiceInstanceRelationships(DelegateExecution execution) {
-
-        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
-
+        logger.debug(Prefix +" **** Enter DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
         String serviceInstanceId = execution.getVariable("networkServiceInstanceId")
-
         String errorMsg = "query Network Service Instance from AAI failed"
         AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
         Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
@@ -208,47 +207,45 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
             List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship()
             for (Relationship relationship : relationshipList) {
                 String relatedTo = relationship.getRelatedTo()
-                if (relatedTo == "owning-entity") {
+                if (("owning-entity").equals(relatedTo)) {
                     List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                     for (RelationshipData relationshipData : relationshipDataList) {
-                        if (relationshipData.getRelationshipKey() == "owning-entity.owning-entity-id") {
+                        if (("owning-entity.owning-entity-id").equals(relationshipData.getRelationshipKey())) {
                             execution.setVariable("owningEntityId", relationshipData.getRelationshipValue())
                         }
                     }
-                } else if (relatedTo == "generic-vnf") {
+                } else if (("generic-vnf").equals(relatedTo)) {
                     List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                     List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
 
                     //Get VnfId
                     for (RelationshipData relationshipData : relationshipDataList) {
-                        if (relationshipData.getRelationshipKey() == "generic-vnf.vnf-id") {
+                        if (("generic-vnf.vnf-id").equals(relationshipData.getRelationshipKey())) {
                             execution.setVariable("vnfId", relationshipData.getRelationshipValue())
                         }
                     }
-
                     //Get Vnf Name Check If necessary
                     for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
-                        if (relatedToProperty.getPropertyKey() == "generic-vnf.vnf-name") {
+                        if (("generic-vnf.vnf-name").equals(relatedToProperty.getPropertyKey())) {
                             execution.setVariable("vnfName", relatedToProperty.getPropertyValue())
                         }
                     }
-                } else if (relatedTo == "project") {
+                } else if (("project").equals(relatedTo)) {
                     List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                     for (RelationshipData relationshipData : relationshipDataList) {
-                        if (relationshipData.getRelationshipKey() == "project.project-name") {
+                        if (("project.project-name").equals(relationshipData.getRelationshipKey())) {
                             execution.setVariable("projectName", relationshipData.getRelationshipValue())
                         }
                     }
                 }
             }
-
-            logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
+            logger.debug(Prefix +" **** Exit DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
         }
     }
 
     private void getVnfRelationships(DelegateExecution execution) {
 
-        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
+        logger.debug(Prefix +" **** Enter DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
         String msg = "query Generic Vnf from AAI failed"
         try {
             AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId')))
@@ -261,33 +258,34 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
                 List<Relationship> relationshipList = vnf.get().getRelationshipList()?.getRelationship()
                 for (Relationship relationship : relationshipList) {
                     String relatedTo = relationship.getRelatedTo()
-                    if (relatedTo == "tenant") {
+                    if (("tenant").equals(relatedTo)) {
                         List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                         for (RelationshipData relationshipData : relationshipDataList) {
-                            if (relationshipData.getRelationshipKey() == "tenant.tenant-id") {
+                            if (("tenant.tenant-id").equals(relationshipData.getRelationshipKey())) {
                                 execution.setVariable("tenantId", relationshipData.getRelationshipValue())
                             }
                         }
-                    } else if (relatedTo == "cloud-region") {
+                    } else if (("cloud-region").equals(relatedTo)) {
                         List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+
                         for (RelationshipData relationshipData : relationshipDataList) {
-                            if (relationshipData.getRelationshipKey() == "cloud-region.cloud-owner") {
+                            if (("cloud-region.cloud-owner").equals(relationshipData.getRelationshipKey())) {
                                 execution.setVariable("cloudOwner", relationshipData.getRelationshipValue())
-                            } else if (relationshipData.getRelationshipKey() == "cloud-region.cloud-region-id") {
+                            } else if (("cloud-region.cloud-region-id").equals(relationshipData.getRelationshipKey())) {
                                 execution.setVariable("lcpCloudRegionId", relationshipData.getRelationshipValue())
                             }
                         }
-                    } else if (relatedTo == "platform") {
+                    } else if (("platform").equals(relatedTo)) {
                         List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                         for (RelationshipData relationshipData : relationshipDataList) {
-                            if (relationshipData.getRelationshipKey() == "platform.platform-name") {
+                            if (("platform.platform-name").equals(relationshipData.getRelationshipKey())) {
                                 execution.setVariable("platformName", relationshipData.getRelationshipValue())
                             }
                         }
-                    } else if (relatedTo == "line-of-business") {
+                    } else if (("line-of-business").equals(relatedTo)) {
                         List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
                         for (RelationshipData relationshipData : relationshipDataList) {
-                            if (relationshipData.getRelationshipKey() == "line-of-business.line-of-business-name") {
+                            if (("line-of-business.line-of-business-name").equals(relationshipData.getRelationshipKey())) {
                                 execution.setVariable("lineOfBusinessName", relationshipData.getRelationshipValue())
                             }
                         }
@@ -301,9 +299,16 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
             logger.debug(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
-        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
+        logger.debug(Prefix +" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
     }
 
+       /**
+        * query AAI
+        * @param execution
+        * @param aaiObjectName
+        * @param instanceId
+        * @return AAIResultWrapper
+        */
     private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) {
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****")
         String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -344,9 +349,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
     public void prepareSOMacroRequestPayload(DelegateExecution execution) {
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
         String json = execution.getVariable("serviceVnfs")
-        logger.debug(">>>> json "+json)
         List<Object> vnfList = mapper.readValue(json, List.class);
-        logger.debug("vnfList:  "+vnfList)
         Map<String,Object> serviceMap = mapper.readValue(execution.getVariable("serviceModelInfo"), Map.class);
         ModelInfo serviceModelInfo = new ModelInfo()
         serviceModelInfo.setModelType(ModelType.service)
@@ -354,19 +357,12 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         serviceModelInfo.setModelVersionId(serviceMap.get("modelUuid"))
         serviceModelInfo.setModelName(serviceMap.get("modelName"))
         serviceModelInfo.setModelVersion(serviceMap.get("modelVersion"))
-        logger.debug("serviceModelInfo:  "+serviceModelInfo)
         //List of Vnfs
         List<Object> vnfModelInfoList = new ArrayList<>()
 
         Map vnfMap = vnfList.get(0)
-        ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
-        vnfModelInfo.setModelCustomizationId(vnfModelInfo.getModelCustomizationUuid())
-        vnfModelInfo.setModelVersionId(vnfModelInfo.getModelId())
-        logger.debug("vnfModelInfo "+vnfModelInfo)
-
         //List of VFModules
         List<Map<String, Object>> vfModuleList = vnfMap.get("vfModules")
-        logger.debug("vfModuleList "+vfModuleList)
 
         //List of VfModules
         List<ModelInfo> vfModelInfoList = new ArrayList<>()
@@ -376,16 +372,17 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
             ModelInfo vfModelInfo = vfModule.get("modelInfo")
             vfModelInfo.setModelCustomizationId(vfModelInfo.getModelCustomizationUuid())
             vfModelInfo.setModelVersionId(vfModelInfo.getModelId())
-            logger.debug("vfModelInfo "+vfModelInfo)
             vfModelInfoList.add(vfModelInfo)
         }
+
+        String networkServiceInstanceName = execution.getVariable("networkServiceInstanceName")
         //RequestInfo
         RequestInfo requestInfo = new RequestInfo()
 
         //Dummy Product FamilyId
         requestInfo.setProductFamilyId("test1234")
         requestInfo.setSource("VID")
-        requestInfo.setInstanceName(execution.getVariable("networkServiceInstanceName"))
+        requestInfo.setInstanceName(networkServiceInstanceName)
         requestInfo.setSuppressRollback(false)
         requestInfo.setRequestorId("NBI")
 
@@ -395,10 +392,13 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         serviceParams.add(serviceParamsValues)
 
         //Cloud Configuration
+        String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId")
+        String tenantId = execution.getVariable("tenantId")
+        String cloudOwner = execution.getVariable("cloudOwner")
         CloudConfiguration cloudConfiguration = new CloudConfiguration()
-        cloudConfiguration.setLcpCloudRegionId(execution.getVariable("lcpCloudRegionId"))
-        cloudConfiguration.setTenantId(execution.getVariable("tenantId"))
-        cloudConfiguration.setCloudOwner(execution.getVariable("cloudOwner"))
+        cloudConfiguration.setLcpCloudRegionId(lcpCloudRegionId)
+        cloudConfiguration.setTenantId(tenantId)
+        cloudConfiguration.setCloudOwner(cloudOwner)
 
         //VFModules List
         List<Map<String, Object>> vfModules = new ArrayList<>()
@@ -415,8 +415,6 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         }
 
         //Vnf intsanceParams
-        Map<String, Object> sliceProfile = mapper.readValue(execution.getVariable("sliceProfile"), Map.class);
-
         List<Map<String, Object>> vnfInstanceParamsList = new ArrayList<>()
         String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution)
 
@@ -425,13 +423,17 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         vnfInstanceParamsList.add(supportedNssai)
 
         Platform platform = new Platform()
-               String platformName = execution.getVariable("platformName")
+        String platformName = execution.getVariable("platformName")
         platform.setPlatformName(platformName)
 
         LineOfBusiness lineOfbusiness = new LineOfBusiness()
         String lineOfBusinessName = execution.getVariable("lineOfBusinessName")
         lineOfbusiness.setLineOfBusinessName(lineOfBusinessName)
 
+        ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
+        vnfModelInfo.setModelCustomizationId(vnfModelInfo.getModelCustomizationUuid())
+        vnfModelInfo.setModelVersionId(vnfModelInfo.getModelId())
+
         //Vnf Values
         Map<String, Object> vnfValues = new LinkedHashMap<>()
         vnfValues.put("lineOfBusiness", lineOfbusiness)
@@ -449,9 +451,10 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         serviceResources.put("vnfs", vnfModelInfoList)
 
         //Service Values
+        String serviceInstanceName = execution.getVariable("networkServiceInstanceName")
         Map<String, Object> serviceValues = new LinkedHashMap<>()
         serviceValues.put("modelInfo", serviceModelInfo)
-        serviceValues.put("instanceName", execution.getVariable("networkServiceInstanceName"))
+        serviceValues.put("instanceName", serviceInstanceName)
         serviceValues.put("resources", serviceResources)
         serviceValues.put("instanceParams", serviceParams)
 
@@ -469,22 +472,26 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         userParams.add(userParamsValues)
 
         //Request Parameters
+        String serviceType = execution.getVariable("serviceType")
         RequestParameters requestParameters = new RequestParameters()
         requestParameters.setaLaCarte(false)
-        requestParameters.setSubscriptionServiceType(execution.getVariable("serviceType"))
+        requestParameters.setSubscriptionServiceType(serviceType)
         requestParameters.setUserParams(userParams)
 
         //SubscriberInfo
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
         SubscriberInfo subscriberInfo = new SubscriberInfo()
-        subscriberInfo.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+        subscriberInfo.setGlobalSubscriberId(globalSubscriberId)
 
         //Owning Entity
+        String owningEntityId = execution.getVariable("owningEntityId")
         OwningEntity owningEntity = new OwningEntity()
-        owningEntity.setOwningEntityId(execution.getVariable("owningEntityId"))
+        owningEntity.setOwningEntityId(owningEntityId)
 
         //Project
+        String projectName = execution.getVariable("projectName")
         Project project = new Project()
-        project.setProjectName(execution.getVariable("projectName"))
+        project.setProjectName(projectName)
 
         RequestDetails requestDetails = new RequestDetails()
         requestDetails.setModelInfo(serviceModelInfo)
@@ -500,17 +507,16 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         String requestPayload = mapper.writeValueAsString(requestDetailsMap)
         logger.debug("requestDetails "+requestPayload)
         execution.setVariable("requestPayload", requestPayload)
+
         logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
     }
 
     private String prepareVnfInstanceParamsJson(DelegateExecution execution) {
-        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
+        logger.debug(Prefix +" **** Enter DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
         List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList")
         Map<String, Object> nSsai= new LinkedHashMap<>()
         nSsai.put("sNssai", instanceParamsvalues)
         String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
-        //SupportedNssai
-        logger.debug("****  supportedsNssaiJson**** "+supportedsNssaiJson)
         logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
         return supportedsNssaiJson
     }
@@ -519,9 +525,13 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: sendPutRequestToSOMacro ****")
         try {
             String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
-            String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId")
+            String networkServiceInstanceId = execution.getVariable("networkServiceInstanceId")
+            String vnfId = execution.getVariable("vnfId")
+            String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+networkServiceInstanceId+"/vnfs/"+vnfId
             String requestBody = execution.getVariable("requestPayload")
-            String encodeString = "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=="
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+            String encodeString = utils.getBasicAuth(basicAuth, msoKey)
             logger.debug("msoEndpoint: "+msoEndpoint +"  "+ "url: "+url  +" requestBody: "+requestBody +"  "+ "encodeString: "+encodeString)
             HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
             httpClient.addAdditionalHeader("Authorization", encodeString)
@@ -531,24 +541,28 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         } catch (BpmnError e) {
             throw e
         } catch (any) {
-            String msg = Prefix+" Exception in DoAllocateCoreSharedSlice " + any.getCause()
+            String msg = Prefix+" Exception in DoAllocate Shared " + any.getCause()
             logger.error(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
         logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: sendPostRequestToSOMacro ****")
     }
 
+       /**
+        * Handle SO Response for PUT and prepare update operation status
+        * @param execution
+        */
     private void handleSOResponse(Response httpResponse, DelegateExecution execution){
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: handleSOResponse ****")
+
         int soResponseCode = httpResponse.getStatus()
         logger.debug("soResponseCode : "+soResponseCode)
 
         if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
             String soResponse = httpResponse.readEntity(String.class)
             logger.debug("soResponse: "+soResponse)
-            logger.debug("soResponse JsonUtil: "+jsonUtil.getJsonValue(soResponse, "requestReferences.requestId"))
-            def macroOperationId = jsonUtil.getJsonValue(soResponse, "requestReferences.requestId")
-            def requestSelfLink = jsonUtil.getJsonValue(soResponse, "requestReferences.requestSelfLink")
+            String macroOperationId = jsonUtil.getJsonValue(soResponse, "requestReferences.requestId")
+            String requestSelfLink = jsonUtil.getJsonValue(soResponse, "requestReferences.requestSelfLink")
             execution.setVariable("macroOperationId", macroOperationId)
             execution.setVariable("requestSelfLink", requestSelfLink)
             execution.setVariable("isSOTimeOut", "no")
@@ -564,10 +578,11 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
     public void getSOPUTProgress(DelegateExecution execution) {
         logger.debug(Prefix+ " **** Enter DoAllocateCoreSharedSlice ::: getSOPUTProgress ****")
         String url= execution.getVariable("requestSelfLink")
-        logger.debug("url  "+url)
         HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
-               //Hardcoding for now, will be updated in next patch
-        httpClient.addAdditionalHeader("Authorization", "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==")
+        String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+        String basicAuth =  UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+        String encodeString = utils.getBasicAuth(basicAuth, msoKey)
+        httpClient.addAdditionalHeader("Authorization", encodeString)
         httpClient.addAdditionalHeader("Accept", "application/json")
         Response httpResponse = httpClient.get()
         logger.debug("httpResponse "+httpResponse)
@@ -586,71 +601,80 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
         logger.debug(Prefix+ " **** Exit DoAllocateCoreSharedSlice ::: getSOPUTProgress ****")
     }
 
-    public void timeDelay(DelegateExecution execution) {
+    public void timeDelay() {
         try {
             logger.debug(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay going to sleep for 5 sec")
             Thread.sleep(5000)
-            logger.debug("**** DoAllocateCoreNonSharedSlice ::: timeDelay wakeup after 5 sec")
+            logger.debug("**** DoActivateCoreNSSI ::: timeDelay wakeup after 5 sec")
         } catch(InterruptedException e) {
             logger.error(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay exception" + e)
         }
-    }
+       }
 
     void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
 
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
         //Prepare Update Status for PUT failure and success
-        if("COMPLETED".equals(execution.getVariable("requestState"))) {
+        if(execution.getVariable("isTimeOut").equals("YES")) {
+            logger.debug("TIMEOUT - SO PUT Failure")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+        } else {
             execution.setVariable("progress", "100")
             execution.setVariable("status", "finished")
-            execution.setVariable("operationContent", "AllocteCoreNSSI successful.")
-            logger.debug("Success ,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
-        } else {
-            logger.debug("SO PUT Failure")
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+            execution.setVariable("operationContent", "AllocteCoreNSSI Shared successful.")
+            logger.debug("prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
         }
         setResourceOperationStatus(execution)
         logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
     }
 
+       /**
+        * prepare ResourceOperation status
+        * @param execution
+        * @param operationType
+        */
     private void setResourceOperationStatus(DelegateExecution execution) {
         logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
-        String serviceId = execution.getVariable("nssiId")
+        String serviceId = execution.getVariable("nsiId")
         String jobId = execution.getVariable("jobId")
-        String nsiId = execution.getVariable("nsiId")
-        String operationType = execution.getVariable("operationType")
-               logger.debug("serviceId: "+serviceId +"  "+ " jobId: "+jobId +"  "+ " nsiId: "+nsiId+" nssiId: "+nssiId+" operationType: "+operationType)
+        String nssiId = execution.getVariable("nssiId")
+        String operationType = "ALLOCATE"
+        String modelUuid= execution.getVariable("modelUuid")
         ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
         resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setJobId(jobId)
         resourceOperationStatus.setOperationId(jobId)
-        resourceOperationStatus.setResourceTemplateUUID(nsiId)
-               resourceOperationStatus.setResourceInstanceID(nssiId)
+        resourceOperationStatus.setResourceTemplateUUID(modelUuid)
+        resourceOperationStatus.setResourceInstanceID(nssiId)
         resourceOperationStatus.setOperType(operationType)
-        resourceOperationStatus.setStatus("finished")
-        resourceOperationStatus.setProgress("100")
-        resourceOperationStatus.setStatusDescription("Core Allocate successful")
+        resourceOperationStatus.setStatus(execution.getVariable("status"))
+        resourceOperationStatus.setProgress(execution.getVariable("progress"))
+        resourceOperationStatus.setStatusDescription(execution.getVariable("statusDescription"))
         requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
         logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
     }
 
     void prepareFailedOperationStatusUpdate(DelegateExecution execution){
         logger.debug(Prefix + " **** Enter DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
-        String serviceId = execution.getVariable("nsiId")
+         String serviceId = execution.getVariable("nsiId")
         String jobId = execution.getVariable("jobId")
-        String nsiId = execution.getVariable("nsiId")
+        String nssiId = execution.getVariable("nssiId")
         String operationType = "ALLOCATE"
-        logger.debug("serviceId: "+serviceId +"  "+ " jobId: "+jobId +"  "+ " nsiId: "+nsiId+" operationType: "+operationType)
+        //modelUuid
         String modelUuid= execution.getVariable("modelUuid")
+        logger.debug("serviceId: {}, jobId: {}, nssiId: {}, operationType: {}.", serviceId, jobId, nssiId, operationType)
         ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
         resourceOperationStatus.setServiceId(serviceId)
         resourceOperationStatus.setJobId(jobId)
         resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceInstanceID(nssiId)
         resourceOperationStatus.setResourceTemplateUUID(modelUuid)
         resourceOperationStatus.setOperType(operationType)
         resourceOperationStatus.setProgress("0")
         resourceOperationStatus.setStatus("failed")
-        resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
+        resourceOperationStatus.setStatusDescription("Core NSSI Shared Allocate Failed")
         requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
         logger.debug(Prefix + " **** Exit DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
     }
-}
\ No newline at end of file
+}
+
index 9221067..dd16851 100644 (file)
@@ -297,7 +297,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
             List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
 
             for (String linkStr : linkStrList) {
-                String linkId = jsonUtil.getJsonValue(linkStr, "id")
+                String linkId = jsonUtil.getJsonValue(linkStr, "name")
                 if (isBlank(linkId)) {
                     linkId = "tn-nssmf-" + UUID.randomUUID().toString()
                 }
index 8695946..8859af2 100644 (file)
@@ -28,6 +28,8 @@ import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
 import org.onap.so.bpmn.common.scripts.OofUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
 import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.beans.nsmf.PerfReqEmbb
+import org.onap.so.beans.nsmf.PerfReq
 import org.onap.so.db.request.beans.ResourceOperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -47,6 +49,9 @@ import org.onap.aai.domain.yang.Relationship
 import org.onap.aai.domain.yang.ServiceInstance
 import org.onap.aai.domain.yang.SliceProfile
 import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.aaiclient.client.aai.entities.uri.AAISimplePluralUri
 import com.fasterxml.jackson.annotation.JsonInclude
 import com.fasterxml.jackson.databind.SerializationFeature
@@ -231,8 +236,28 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
                Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("RANSliceProfile"), Map.class)
                 ServiceInstance ranSliceProfileInstance = execution.getVariable("ranSliceProfileInstance")
                 profileInfo.put("sST",ranSliceProfileInstance.getServiceType())
-                profileInfo.put("snssaiList",ranSliceProfileInstance.getEnvironmentContext())
-                profileInfo.put("plmnIdList",ranSliceProfileInstance.getServiceInstanceLocationId())
+                profileInfo.put("snssaiList",execution.getVariable("snssaiList"))
+                profileInfo.put("plmnIdList",Arrays.asList(ranSliceProfileInstance.getServiceInstanceLocationId()))
+                profileInfo.put("uEMobilityLevel",profileInfo.get("ueMobilityLevel"))
+                profileInfo.put("cSAvailabilityTarget",profileInfo.get("csAvailabilityTarget"))
+                profileInfo.put("maxNumberofPDUSession",profileInfo.get("maxNumberOfPDUSession"))
+                profileInfo.put("maxNumberofUEs",profileInfo.get("maxNumberOfUEs"))
+
+                PerfReq perfReq = new PerfReq();
+                List<PerfReqEmbb> perfReqEmbbs = new ArrayList<>();
+                PerfReqEmbb perfReqEmbb = new PerfReqEmbb();
+                perfReqEmbb.setExpDataRateDL(profileInfo.get("expDataRateDL"));
+                perfReqEmbb.setExpDataRateUL(profileInfo.get("expDataRateUL"));
+                perfReqEmbbs.add(perfReqEmbb);
+                perfReq.setPerfReqEmbbList(perfReqEmbbs);
+                profileInfo.put("perfReq",perfReq)
+
+                profileInfo.remove("maxNumberOfUEs")
+                profileInfo.remove("resourceVersion")
+                profileInfo.remove("csAvailabilityTarget")
+                profileInfo.remove("ueMobilityLevel")
+                profileInfo.remove("maxNumberOfPDUSession")
+                profileInfo.remove("profileId")
                 String modelUuid = ranSliceProfileInstance.getModelVersionId()
                 String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId()
                String modelName = execution.getVariable("servicename")
@@ -308,23 +333,25 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
                logger.debug("getNssisFromAai ranConstituentNssis : "+ranConstituentNssis.toString())
                ranConstituentNssis.each { key, val -> 
                        switch(key) {
-                               case "AN-NF":
+                               case "AN_NF":
                                        execution.setVariable("ANNF_NSSI", val.getServiceInstanceId())
                                        execution.setVariable("ANNF_nssiName", val.getServiceInstanceName())
                                         execution.setVariable("ANNF_modelInvariantUuid", val.getModelInvariantId())
                                        execution.setVariable("ANNF_modelUuid", val.getModelVersionId())
                                        break
-                               case "TN-FH":
+                               case "TN_FH":
                                        execution.setVariable("TNFH_NSSI", val.getServiceInstanceId())
                                        execution.setVariable("TNFH_nssiName", val.getServiceInstanceName())
                                         execution.setVariable("TNFH_modelInvariantUuid", val.getModelInvariantId())
                                        execution.setVariable("TNFH_modelUuid", val.getModelVersionId())
+                                        getConnectionLinks(execution, key, val)
                                        break
-                               case "TN-MH":
+                               case "TN_MH":
                                        execution.setVariable("TNMH_NSSI", val.getServiceInstanceId())
                                        execution.setVariable("TNMH_nssiName", val.getServiceInstanceName())
                                         execution.setVariable("TNMH_modelInvariantUuid", val.getModelInvariantId())
                                        execution.setVariable("TNMH_modelUuid", val.getModelVersionId())
+                                        getConnectionLinks(execution, key, val)
                                        break
                                default:
                                        logger.error("No expected match found for current domainType "+ key)
@@ -333,6 +360,50 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
                }
                
        }
+
+        private void getConnectionLinks(DelegateExecution execution, String domainType, ServiceInstance instance) {
+                AllottedResources allottedResources = instance.getAllottedResources()
+                               if(allottedResources == null) {
+                               String msg = "AllottedResourceFromAAI doesn't exist. " + instance
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+                               }
+
+                List<AllottedResource> AllottedResourceList = allottedResources.getAllottedResource()
+                for(AllottedResource allottedResource : AllottedResourceList) {
+                List<Relationship> relationshipList = allottedResource.getRelationshipList().getRelationship()
+                    for (Relationship relationship : relationshipList) {
+                        String relatedTo = relationship.getRelatedTo()
+                        if (relatedTo.toLowerCase() == "logical-link") {
+                                String relatioshipurl = relationship.getRelatedLink()
+                                String logicalLinkId=
+                                                relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                                AAIResourcesClient client = new AAIResourcesClient()
+                                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+                                if (!client.exists(uri)) {
+                                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                        "Resource was not found in aai: ${logicalLinkId}")
+                                }
+                                AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+                                Optional<org.onap.aai.domain.yang.LogicalLink> resource = wrapper01.asBean(org.onap.aai.domain.yang.LogicalLink.class)
+                                if (resource.isPresent()) {
+                                        org.onap.aai.domain.yang.LogicalLink logicalLinkInstance = resource.get()
+                                        if(domainType.equalsIgnoreCase("TN-FH"))
+                                        {
+                                        execution.setVariable("tranportEp_ID_RU",logicalLinkInstance.getLinkName())
+                                        execution.setVariable("tranportEp_ID_DUIN",logicalLinkInstance.getLinkName2())
+                                        }
+                                        else if(domainType.equalsIgnoreCase("TN-MH"))
+                                        {
+                                        execution.setVariable("tranportEp_ID_DUEG",logicalLinkInstance.getLinkName())
+                                        execution.setVariable("tranportEp_ID_CUIN",logicalLinkInstance.getLinkName2())
+                                        }
+                                }
+                        }
+                    }
+                }
+        }
+
        def createSliceProfiles = { DelegateExecution execution ->
                logger.debug(Prefix+"createSliceProfiles method start")
                anNssmfUtils.createSliceProfilesInAai(execution)
@@ -446,8 +517,6 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
                JsonObject serviceInfo = new JsonObject()
                
                serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
-               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
-               serviceInfo.addProperty("sST", sST)
                serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
                serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
                serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
@@ -506,13 +575,13 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
                logger.debug("getSliceProfilesFromAai ranConstituentSliceProfiles : "+ranConstituentSliceProfiles.toString())
                ranConstituentSliceProfiles.each { key, val ->
                        switch(key) {
-                               case "AN-NF":
+                               case "AN_NF":
                                        execution.setVariable("ANNF_sliceProfileInstanceId", val.getServiceInstanceId())
                                        break
-                               case "TN-FH":
+                               case "TN_FH":
                                        execution.setVariable("TNFH_sliceProfileInstanceId", val.getServiceInstanceId())
                                        break
-                               case "TN-MH":
+                               case "TN_MH":
                                        execution.setVariable("TNMH_sliceProfileInstanceId", val.getServiceInstanceId())
                                        break
                                default:
@@ -655,7 +724,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
                                                        "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
                                }
-                               AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class)
+                               AAIResultWrapper wrapper01 = client01.get(uri01.depth(Depth.TWO), NotFoundException.class)
                                Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
                                if (serviceInstance.isPresent()) {
                                        ServiceInstance instance = serviceInstance.get()
index bb8e516..10846d4 100644 (file)
@@ -28,6 +28,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.core.json.JsonUtils
 import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.Gson
 import com.google.gson.JsonObject
 import com.google.gson.JsonParser
 import java.time.Instant
@@ -114,7 +115,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
                logger.debug(Prefix+"createSdnrRequest method start")
                String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
                String modifyAction = execution.getVariable("modifyAction")
-               String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl)
+               String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "instantiateRANSlice", callbackUrl)
                execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
                execution.setVariable("createNSSI_timeout", "PT10M")
                execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
@@ -152,7 +153,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
                if(action.equals("allocate")) {
                        sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
                        sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
-                       sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+                       sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSession"))
                        sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
                        sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
                        action = "modify-"+action
@@ -174,9 +175,12 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
                commonHeader.addProperty("request-id", requestId)
                commonHeader.addProperty("sub-request-id", "1")
                commonHeader.add("flags", new JsonObject())
-               payloadInput.addProperty("sliceProfile", sliceProfile.toString())
+                Gson jsonConverter = new Gson()
+                payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
                payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID"))
                payloadInput.addProperty("callbackURL", callbackUrl)
+                payloadInput.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               payloadInput.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
                payload.add("input", payloadInput)
                input.add("common-header", commonHeader)
                input.addProperty("action", action)
index 9440b42..25cb2f5 100644 (file)
@@ -24,7 +24,11 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import groovy.json.JsonSlurper
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.*
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
@@ -38,7 +42,9 @@ import org.onap.so.db.request.beans.ResourceOperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import static org.apache.commons.lang3.StringUtils.*
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+import static org.apache.commons.lang3.StringUtils.isNotBlank
 
 public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
     String Prefix = "TNMOD_"
@@ -150,26 +156,31 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
         AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
         try {
-            if (resourceClient.exists(ssServiceuri)) {
-                ServiceInstance ss = resourceClient.get(ServiceInstance.class, ssServiceuri)
-
-                AllottedResources ars = ss.getAllottedResources()
-                List<AllottedResource> arList = ars.getAllottedResource()
-                List<String> arIdList = new ArrayList<>()
-                Map<String, String> policyMap = new HashMap<>()
-                Map<String, List<String>> logicalLinksMap = new HashMap<>()
-                for (AllottedResource ar : arList) {
-                    String arId = ar.getId()
-                    arIdList.add(arId)
-                    String policyId = tnNssmfUtils.getPolicyIdFromAr(execution, serviceInstanceId, arId, true)
-                    policyMap.put(arId, policyId)
-                    List<String> logicalLinkList = tnNssmfUtils.getLogicalLinkNamesFromAr(execution,
-                            serviceInstanceId, arId, true)
-                    logicalLinksMap.put(arId, logicalLinkList)
+            Optional<ServiceInstance> ssOpt = resourceClient.get(ServiceInstance.class, ssServiceuri)
+            if (ssOpt.isPresent()) {
+                ServiceInstance ss = ssOpt.get()
+                AllottedResources ars = tnNssmfUtils.getAllottedResourcesFromAai(execution, serviceInstanceId, true)
+                if (ars != null) {
+                    List<AllottedResource> arList = ars.getAllottedResource()
+                    List<String> arIdList = new ArrayList<>()
+                    Map<String, String> policyMap = new HashMap<>()
+                    Map<String, List<String>> logicalLinksMap = new HashMap<>()
+                    for (AllottedResource ar : arList) {
+                        String arId = ar.getId()
+                        arIdList.add(arId)
+                        String policyId = tnNssmfUtils.getPolicyIdFromAr(execution, serviceInstanceId, arId, true)
+                        policyMap.put(arId, policyId)
+                        List<String> logicalLinkList = tnNssmfUtils.getLogicalLinkNamesFromAr(execution,
+                                serviceInstanceId, arId, true)
+                        logicalLinksMap.put(arId, logicalLinkList)
+                    }
+                    execution.setVariable("arIdList", arIdList)
+                    execution.setVariable("arPolicyMap", policyMap)
+                    execution.setVariable("arLogicalLinkMap", logicalLinksMap)
+                } else {
+                    logger.error("ERROR: getExistingServiceInstance: getAllottedResources() returned null. ss=" + ss
+                            .toString())
                 }
-                execution.setVariable("arIdList", arIdList)
-                execution.setVariable("arPolicyMap", policyMap)
-                execution.setVariable("arLogicalLinkMap", logicalLinksMap)
             } else {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
                         "associate allotted resource for service :" + serviceInstanceId)
@@ -177,7 +188,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
         } catch (BpmnError e) {
             throw e;
         } catch (Exception ex) {
-            String msg = "Exception in getServiceInstance. " + ex.getMessage()
+            String msg = "Exception in getExistingServiceInstance. " + ex.getMessage()
             logger.debug(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
@@ -195,6 +206,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
             //ss.setServiceInstanceId(ssInstanceId)
             String serviceStatus = "modified"
             ss.setOrchestrationStatus(serviceStatus)
+            ss.setEnvironmentContext("tn")
             AAIResourcesClient client = getAAIClient()
             AAIResourceUri uri = AAIUriFactory.createResourceUri(
                     AAIFluentTypeBuilder.business()
@@ -279,14 +291,15 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
 
     void updateLogicalLinksInNetwork(DelegateExecution execution, String networkJsonStr) {
         try {
-            String arId = getValidArId(jsonUtil.getJsonValue(networkJsonStr, "id"))
+            String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
             String linkArrayStr = jsonUtil.getJsonValue(networkJsonStr, "connectionLinks")
             updateLogicalLinksInAr(execution, arId, linkArrayStr)
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
-                    "Exception in updateLogicalLinksInNetwork" + ex.getMessage())
+            String msg = String.format("ERROR: updateLogicalLinksInNetwork: exception: %s", ex.getMessage())
+            logger.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
         }
     }
 
@@ -351,7 +364,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
         try {
             int maxBw = getMaxBw(execution)
 
-            String arId = getValidArId(jsonUtil.getJsonValue(networkJsonStr, "id"))
+            String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
             Map<String, String> policyMap = execution.getVariable("arPolicyMap")
             String policyId = policyMap.get(arId)
             if (isBlank(policyId)) {
@@ -365,8 +378,9 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
-                    "Exception in updateNetworkPolicy" + ex.getMessage())
+            String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage())
+            logger.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
         }
     }
 
@@ -428,7 +442,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
         try {
             String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
 
-            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "modify")
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "update")
 
             execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
             logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
@@ -483,6 +497,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
         ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
                 jobId, nsiId, operType, status, progress, statusDescription)
 
+        logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
         requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
     }
 
index 4624cda..fc21ed4 100644 (file)
@@ -22,17 +22,19 @@ package org.onap.so.bpmn.infrastructure.scripts
 
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResources
 import org.onap.aai.domain.yang.LogicalLink
 import org.onap.aai.domain.yang.NetworkPolicy
 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.AAIVersion
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.Relationships
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.Activities
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -47,7 +49,7 @@ import org.slf4j.LoggerFactory
 import static org.apache.commons.lang3.StringUtils.isBlank
 
 class TnNssmfUtils {
-    static final String AAI_VERSION = "v23"
+    static final String AAI_VERSION = AAIVersion.LATEST
     private static final Logger logger = LoggerFactory.getLogger(TnNssmfUtils.class);
 
 
@@ -91,6 +93,9 @@ class TnNssmfUtils {
             case "deactivate":
                 reqAction = "DeactivateTransportSliceInstance"
                 break
+            case "update":
+                reqAction = "ModifyTransportSliceInstance"
+                break
             default:
                 reqAction = svcAction
         }
@@ -433,7 +438,7 @@ class TnNssmfUtils {
             return null
         }
 
-        return si.modelVersionId()
+        return si.getModelVersionId()
     }
 
     AAIResourceUri buildNetworkPolicyUri(String networkPolicyId) {
@@ -456,6 +461,52 @@ class TnNssmfUtils {
         return allottedResourceUri
     }
 
+    AAIPluralResourceUri buildAllottedResourcesUri(DelegateExecution execution, String serviceInstanceId) {
+
+        AAIPluralResourceUri arsUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                        .customer(execution.getVariable("globalSubscriberId"))
+                        .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+                        .serviceInstance(serviceInstanceId)
+                        .allottedResources())
+
+        return arsUri
+    }
+
+    AllottedResources getAllottedResourcesFromAai(DelegateExecution execution, String serviceInstanceId, boolean exceptionOnErr) {
+        AllottedResources res
+        try {
+            AAIResourcesClient client = new AAIResourcesClient()
+
+            AAIPluralResourceUri arsUri = buildAllottedResourcesUri(execution, serviceInstanceId)
+
+            //AAIResultWrapper wrapperAllotted = client.get(arsUri, NotFoundException.class)
+            //Optional<AllottedResources> allAllotted = wrapperAllotted.asBean(AllottedResources.class)
+            //AllottedResources allottedResources = allAllotted.get()
+
+            Optional<AllottedResources> arsOpt = client.get(AllottedResources.class, arsUri)
+            if (arsOpt.isPresent()) {
+                res = arsOpt.get()
+                return res
+            } else {
+                String msg = String.format("ERROR: getAllottedResourcesFromAai: ars not found. nssiId=%s", serviceInstanceId)
+                logger.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+            }
+        } catch (BpmnError e) {
+            if (exceptionOnErr) {
+                throw e;
+            }
+        } catch (Exception ex) {
+            if (exceptionOnErr) {
+                String msg = String.format("ERROR: getAllottedResourcesFromAai: %s", ex.getMessage())
+                logger.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+            }
+        }
+
+        return res
+    }
 
     String getPolicyIdFromAr(DelegateExecution execution, String serviceInstanceId,
                              String arId, boolean exceptionOnErr) {
@@ -464,15 +515,15 @@ class TnNssmfUtils {
             AAIResourcesClient client = new AAIResourcesClient()
 
             AAIResourceUri arUri = buildAllottedResourceUri(execution, serviceInstanceId, arId)
-            List<AAIResourceUri> logicalLinkUriList = getRelationshipUriListInAai(execution, arUri,
+            List<AAIResourceUri> policyUriList = getRelationshipUriListInAai(execution, arUri,
                     AAIFluentTypeBuilder.Types.NETWORK_POLICY, exceptionOnErr)
-            for (AAIResourceUri logicalLinkUri : logicalLinkUriList) {
-                Optional<NetworkPolicy> policyOpt = client.get(NetworkPolicy.class, logicalLinkUri)
+            for (AAIResourceUri policyUri : policyUriList) {
+                Optional<NetworkPolicy> policyOpt = client.get(NetworkPolicy.class, policyUri)
                 if (policyOpt.isPresent()) {
                     NetworkPolicy policy = policyOpt.get()
                     return policy.getNetworkPolicyId()
                 } else {
-                    String msg = String.format("ERROR: getLogicalLinkNamesFromAr: logicalLinkUri=%s", logicalLinkUri)
+                    String msg = String.format("ERROR: getPolicyIdFromAr: arUri=%s", policyUri)
                     logger.error(msg)
                     exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
                 }
@@ -483,7 +534,7 @@ class TnNssmfUtils {
             }
         } catch (Exception ex) {
             if (exceptionOnErr) {
-                String msg = String.format("ERROR: getLogicalLinkNamesFromAr: %s", ex.getMessage())
+                String msg = String.format("ERROR: getPolicyIdFromAr: %s", ex.getMessage())
                 logger.error(msg)
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
             }
@@ -494,7 +545,8 @@ class TnNssmfUtils {
 
 
     List<AAIResourceUri> getRelationshipUriListInAai(DelegateExecution execution,
-                                                     AAIResourceUri uri, Activities.Info info,
+                                                     AAIResourceUri uri,
+                                                     Object info,
                                                      boolean exceptionOnErr) {
         AAIResourcesClient client = new AAIResourcesClient()
         AAIResultWrapper wrapper = client.get(uri);
index fa1cef2..dfbf93e 100644 (file)
@@ -64,7 +64,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
                         "sourceModelUuid"            : "f3666c56-744e-4055-9f4a-0726460898e0"
                 }"""
 
-               String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoints\": [{\r\n\t\t\"IpAdress\": \"\",\r\n\t\t\"LogicalLinkId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t}],\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}"""
+               String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoint\": {\r\n\t\t\"ipAdress\": \"\",\r\n\t\t\"logicalInterfaceId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t},\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}"""
 
         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
         when(mockExecution.getVariable("networkServiceModelInfo")).thenReturn(networkServiceModelInfo)
@@ -122,6 +122,8 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
         ObjectMapper objectMapper = new ObjectMapper()
         Map<String, Object> serviceCharacteristic = objectMapper.readValue(sliceProfile, Map.class);
 
+        //provide mock vnfInstance name
+        when(mockExecution.getVariable("vnfInstanceName")).thenReturn("vf00")
         DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
         List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(mockExecution, serviceCharacteristic)
         assertEquals(expectedList, characteristicList)
index 9068692..34945b9 100644 (file)
@@ -59,17 +59,12 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
     @Test
     void testPreProcessRequest(){
 
-        String solutions = """ [
-          {
-            "invariantUUID": "y7685f64-5717-4562-b3fc-2c963f66afa6",
-            "UUID": "8u785f64-5717-4562-b3fc-2c963f66afa6",
-            "NSSIName": "embb-core-ser",
-            "NSSIId": "f4485f64-5717-4562-b3fc-2c963f66afa6",
-            "matchLevel": {
-            "blob":"content"
-             }
-          }
-        ]"""
+    String solutions = """ {
+    "NSSIId": "11c0c52a-d748-48aa-86e3-c783cbf5026f",
+    "invariantUUID": "8ebba719-f815-47e3-8473-c5f0db801356",
+    "NSSIName": "nssi_CN_NSST",
+    "UUID": "70e2b55b-8dca-4ff3-8f47-374c2965b731"
+     }"""
         String sliceProfile = "{\r\n      \"snssaiList\": [ \r\n        \"001-100001\"\r\n      ],\r\n      \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n      \"plmnIdList\": [\r\n        \"460-00\",\r\n        \"460-01\"\r\n      ],\r\n      \"perfReq\": {\r\n        \"perfReqEmbbList \": [\r\n          {\r\n            \"activityFactor\": 50\r\n          }\r\n        ]\r\n      },\r\n      \"maxNumberofUEs\": 200, \r\n      \"coverageAreaTAList\": [ \r\n        \"1\",\r\n        \"2\",\r\n        \"3\",\r\n        \"4\"\r\n      ],\r\n      \"latency\": 2,\r\n      \"resourceSharingLevel\": \"non-shared\" \r\n    }"
 
         setUpBaseMockData()
@@ -81,13 +76,13 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
 
         Mockito.verify(mockExecution, times(1)).setVariable(eq("nssiId"), captor.capture())
         def nssiId = captor.getValue()
-        assertEquals("f4485f64-5717-4562-b3fc-2c963f66afa6", nssiId)
+        assertEquals("11c0c52a-d748-48aa-86e3-c783cbf5026f", nssiId)
 
         Mockito.verify(mockExecution, times(1)).setVariable(eq("sNssai"), captor.capture())
         def sNssai = captor.getValue()
         assertEquals("001-100001", sNssai)
 
-        Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
+        Mockito.verify(mockExecution,times(4)).setVariable(captor.capture() as String, captor.capture())
         List<ExecutionEntity> values = captor.getAllValues()
         assertNotNull(values)
     }
@@ -155,6 +150,14 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
         //Check Vnf
         when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
 
+        Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+        spiWithsNssaiAndOrchStatus.put("snssai", "01-5C83F071")
+        spiWithsNssaiAndOrchStatus.put("status", "activated")
+        List <Map<String, Object>> spiWithsNssaiAndOrchStatusList = new ArrayList<>();
+        spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+        //snssaiAndOrchStatusList
+        when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(spiWithsNssaiAndOrchStatusList)
+
         AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(mockExecution.getVariable("vnfId")))
         when(client.exists(resourceUri3)).thenReturn(true)
         AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf())
@@ -197,10 +200,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
         snssaiMap.put("snssai", "01-5C83F071")
         snssaiMap.put("status", "activated")
         snssaiList.add(snssaiMap)
-        Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
-        snssaiMap1.put("snssai", "01-5B179BD4")
-        snssaiMap1.put("status", "activated")
-        snssaiList.add(snssaiMap1)
+
         assertEquals(snssaiList, captor.getValue())
 
         //Verify Project
@@ -227,12 +227,12 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
     void setUpBaseMockData() {
 
         String sliceParams ="""{
-                                       "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
-                                       "snssaiList": [
-                                                                       "01-5B179BD4"
-                                                               ],
-                                       "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
-                               }"""
+                    "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+                    "snssaiList": [
+                                    "01-5B179BD4"
+                                ],
+                    "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
+                }"""
 
         when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be")
         when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
@@ -247,55 +247,55 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
 
     String mockQueryNS() {
         return """
-                       {
-       "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
-       "service-instance-name": "nsi_DemoEmbb",
-       "environment-context": "General_Revenue-Bearing",
-       "workload-context": "Production",
-       "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
-       "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
-       "resource-version": "1599228110527",
-       "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
-       "orchestration-status": "Assigned",
-       "relationship-list": {
-               "relationship": [{
-                       "related-to": "owning-entity",
-                       "relationship-label": "org.onap.relationships.inventory.BelongsTo",
-                       "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
-                       "relationship-data": [{
-                               "relationship-key": "owning-entity.owning-entity-id",
-                               "relationship-value": "OE-generic"
-                       }]
-               }, {
-                       "related-to": "generic-vnf",
-                       "relationship-label": "org.onap.relationships.inventory.ComposedOf",
-                       "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
-                       "relationship-data": [{
-                               "relationship-key": "generic-vnf.vnf-id",
-                               "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
-                       }],
-                       "related-to-property": [{
-                               "property-key": "generic-vnf.vnf-name",
-                               "property-value": "vfwuctest 0"
-                       }]
-               }, {
-                       "related-to": "project",
-                       "relationship-label": "org.onap.relationships.inventory.Uses",
-                       "related-link": "/aai/v19/business/projects/project/Project-generic",
-                       "relationship-data": [{
-                               "relationship-key": "project.project-name",
-                               "relationship-value": "Project-generic"
-                       }]
-               }]
-       }
+                 {
+    "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
+    "service-instance-name": "nsi_DemoEmbb",
+    "environment-context": "General_Revenue-Bearing",
+    "workload-context": "Production",
+    "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
+    "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
+    "resource-version": "1599228110527",
+    "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
+    "orchestration-status": "Assigned",
+    "relationship-list": {
+        "relationship": [{
+            "related-to": "owning-entity",
+            "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+            "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
+            "relationship-data": [{
+                "relationship-key": "owning-entity.owning-entity-id",
+                "relationship-value": "OE-generic"
+            }]
+        }, {
+            "related-to": "generic-vnf",
+            "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+            "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
+            "relationship-data": [{
+                "relationship-key": "generic-vnf.vnf-id",
+                "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
+            }],
+            "related-to-property": [{
+                "property-key": "generic-vnf.vnf-name",
+                "property-value": "vfwuctest 0"
+            }]
+        }, {
+            "related-to": "project",
+            "relationship-label": "org.onap.relationships.inventory.Uses",
+            "related-link": "/aai/v19/business/projects/project/Project-generic",
+            "relationship-data": [{
+                "relationship-key": "project.project-name",
+                "relationship-value": "Project-generic"
+            }]
+        }]
+    }
 }
-               """
+        """
     }
 
     String mockQueryVnf() {
 
         return """
-               {
+        {
   "vnf-id": "eeb66c6f-36bd-47ad-8294-48f46b1aa912",
   "vnf-name": "vfwuctest 0",
   "vnf-type": "vfwuctest/null",
@@ -379,7 +379,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
     }]
   }
 }
-               """
+        """
     }
 
     String mockQuerySliceServiceReturn(){
@@ -414,7 +414,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
         "property-value": "nsi_DemoEmbb"
       }]
     },
-       {
+    {
       "related-to": "allotted-resource",
       "relationship-label": "org.onap.relationships.inventory.Uses",
       "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0d3d3cce-46a8-486d-816a-954e71697c4e/allotted-resources/allotted-resource/d63c241a-4c0b-4294-b4c3-5a57421a1769",
@@ -461,7 +461,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
         "property-value": "Allotted_DemoEmbb"
       }]
     }
-       ]
+    ]
   }
 }
                 """
index 38a2ef6..7a8d2a1 100644 (file)
@@ -1,7 +1,5 @@
 <configuration>
 
-
-
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
             <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
@@ -10,7 +8,6 @@
         </encoder>
     </appender>
 
-
     <logger name="com.att.ecomp.audit" level="info" additivity="false">
         <appender-ref ref="STDOUT" />
     </logger>
     <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
         <appender-ref ref="STDOUT" />
     </logger>
-    
 
     <logger name="ch.vorburger" level="WARN" additivity="false">
         <appender-ref ref="STDOUT" />
     </logger>
-    
-    <logger name="AUDIT" level="info" additivity="true">        
+
+    <logger name="AUDIT" level="info" additivity="true">
         <appender-ref ref="STDOUT" />
     </logger>
 
+    <logger name="org.reflections" level="ERROR" />
+
     <root level="WARN">
         <appender-ref ref="STDOUT" />
     </root>
 
-
 </configuration>
\ No newline at end of file
index 0602522..4e44d94 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-bpmn-infrastructure-flows</artifactId>
index 07077a1..4012467 100644 (file)
@@ -77,7 +77,8 @@ nss.sendSyncResponse(execution)</bpmn:script>
         <camunda:in source="jobId" target="jobId" />
         <camunda:in source="sliceParams" target="sliceParams" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
-        <camunda:in source="servicename" target="servicename" />
+       <camunda:in source="servicename" target="servicename" />
+       <camunda:in source="sst" target="sst" />
       </bpmn:extensionElements>
       <bpmn:incoming>Flow_1kk0exp</bpmn:incoming>
       <bpmn:outgoing>Flow_09b50tn</bpmn:outgoing>
@@ -105,7 +106,8 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
         <camunda:in source="jobId" target="jobId" />
         <camunda:in source="sliceParams" target="sliceParams" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
-        <camunda:in source="servicename" target="servicename" />
+       <camunda:in source="servicename" target="servicename" />
+       <camunda:in source="sst" target="sst" />
       </bpmn:extensionElements>
       <bpmn:incoming>Flow_1fij4ds</bpmn:incoming>
       <bpmn:outgoing>Flow_1coedjo</bpmn:outgoing>
index 9b44901..9df7398 100644 (file)
@@ -353,7 +353,7 @@ nss.createModifyNssiQueryJobStatus(execution)</bpmn:script>
         <camunda:in source="modifyRanNssiJobId" target="jobId" />
         <camunda:in source="modifySliceParams" target="sliceParams" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
-        <camunda:in source="servicename" target="servicename" />
+        <camunda:in source="ranModelName" target="servicename" />
       </bpmn:extensionElements>
       <bpmn:incoming>Flow_10j50jb</bpmn:incoming>
       <bpmn:outgoing>Flow_05s0wso</bpmn:outgoing>
@@ -500,7 +500,7 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
-        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="RANNFServiceInstanceId" target="serviceInstanceID" />
         <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
         <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
         <camunda:in source="snssaiList" target="snssaiList" />
index 88902d1..4d9de6c 100644 (file)
@@ -170,12 +170,28 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
       <bpmn:outgoing>Flow_163kxug</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def allocateNssi = new DoAllocateCoreSharedSlice()
-allocateNssi.timeDelay(execution)</bpmn:script>
+allocateNssi.timeDelay()</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_163kxug" sourceRef="Activity_1qm4des" targetRef="Activity_0ge2y0l" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateCoreSharedSlice">
+      <bpmndi:BPMNEdge id="Flow_163kxug_di" bpmnElement="Flow_163kxug">
+        <di:waypoint x="630" y="380" />
+        <di:waypoint x="534" y="380" />
+        <di:waypoint x="534" y="321" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1lzv4jo_di" bpmnElement="Flow_1lzv4jo">
+        <di:waypoint x="680" y="306" />
+        <di:waypoint x="680" y="340" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="591" y="299" width="78" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15lksyg_di" bpmnElement="Flow_15lksyg">
+        <di:waypoint x="705" y="281" />
+        <di:waypoint x="778" y="281" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1nn15tq_di" bpmnElement="Flow_1nn15tq">
         <di:waypoint x="420" y="256" />
         <di:waypoint x="420" y="200" />
@@ -259,22 +275,6 @@ allocateNssi.timeDelay(execution)</bpmn:script>
           <dc:Bounds x="207" y="179" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_15lksyg_di" bpmnElement="Flow_15lksyg">
-        <di:waypoint x="705" y="281" />
-        <di:waypoint x="778" y="281" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1lzv4jo_di" bpmnElement="Flow_1lzv4jo">
-        <di:waypoint x="680" y="306" />
-        <di:waypoint x="680" y="340" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="603" y="315" width="78" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_163kxug_di" bpmnElement="Flow_163kxug">
-        <di:waypoint x="630" y="380" />
-        <di:waypoint x="534" y="380" />
-        <di:waypoint x="534" y="321" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
         <dc:Bounds x="248" y="102" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -329,12 +329,6 @@ allocateNssi.timeDelay(execution)</bpmn:script>
           <dc:Bounds x="380" y="315.5" width="80" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1boyqt9_di" bpmnElement="Gateway_1boyqt9" isMarkerVisible="true">
-        <dc:Bounds x="655" y="256" width="50" height="50" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1iksno7_di" bpmnElement="Activity_1qm4des">
-        <dc:Bounds x="630" y="340" width="100" height="80" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_08h38js_di" bpmnElement="Activity_08h38js" isExpanded="true">
         <dc:Bounds x="250" y="440" width="781" height="196" />
       </bpmndi:BPMNShape>
@@ -369,6 +363,12 @@ allocateNssi.timeDelay(execution)</bpmn:script>
       <bpmndi:BPMNShape id="Activity_1btidug_di" bpmnElement="Activity_1btidug">
         <dc:Bounds x="540" y="504" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1boyqt9_di" bpmnElement="Gateway_1boyqt9" isMarkerVisible="true">
+        <dc:Bounds x="655" y="256" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1iksno7_di" bpmnElement="Activity_1qm4des">
+        <dc:Bounds x="630" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index c346097..3844770 100644 (file)
@@ -73,7 +73,7 @@ nss.getNssisFromAai(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_1fpw4gf" sourceRef="Activity_0c8tzf1" targetRef="Activity_1so8vif" />
     <bpmn:sequenceFlow id="Flow_05cl21h" sourceRef="Activity_1so8vif" targetRef="Activity_0uxxkp1" />
-    <bpmn:scriptTask id="Activity_0uxxkp1" name="update AAI relationships">
+    <bpmn:scriptTask id="Activity_0uxxkp1" name="update AAI relationships" scriptFormat="groovy">
       <bpmn:incoming>Flow_05cl21h</bpmn:incoming>
       <bpmn:outgoing>Flow_1jwk3jy</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
index dcfd31b..06bcb08 100644 (file)
@@ -29,7 +29,7 @@ ex.processJavaException(execution)</bpmn:script>
       <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def runScript = new DoActivateTnNssi()
+def runScript = new DoModifyTnNssi()
 runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Modified TN NSSI successfully")</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
@@ -73,8 +73,8 @@ runScript.preprocessSdncModifyTnNssiRequest(execution)</bpmn:script>
       <bpmn:extensionElements>
         <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
         <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
-        <camunda:in source="mso-request-id" target="mso-request-id" />
-        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+        <camunda:in source="msoRequestId" target="mso-request-id" />
+        <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
         <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
@@ -132,6 +132,20 @@ runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
   <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_0b3rxne_di" bpmnElement="Flow_0b3rxne">
+        <di:waypoint x="690" y="146" />
+        <di:waypoint x="690" y="360" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="698" y="203" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cm9i4m_di" bpmnElement="Flow_0cm9i4m">
+        <di:waypoint x="715" y="121" />
+        <di:waypoint x="789" y="121" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="743" y="103" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1akxvak_di" bpmnElement="Flow_1akxvak">
         <di:waypoint x="1230" y="400" />
         <di:waypoint x="1372" y="400" />
@@ -171,62 +185,12 @@ runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
         <di:waypoint x="208" y="121" />
         <di:waypoint x="290" y="121" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0cm9i4m_di" bpmnElement="Flow_0cm9i4m">
-        <di:waypoint x="715" y="121" />
-        <di:waypoint x="789" y="121" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="743" y="103" width="19" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0b3rxne_di" bpmnElement="Flow_0b3rxne">
-        <di:waypoint x="690" y="146" />
-        <di:waypoint x="690" y="360" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="698" y="203" width="15" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="Activity_1vtz33q_di" bpmnElement="Activity_1vtz33q">
-        <dc:Bounds x="1229" y="74" width="121" height="94" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_14ab476_di" bpmnElement="Activity_14ab476">
-        <dc:Bounds x="989" y="74" width="121" height="94" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0h1vr2l_di" bpmnElement="Activity_0h1vr2l">
-        <dc:Bounds x="789" y="74" width="121" height="94" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
         <dc:Bounds x="172" y="103" width="36" height="36" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="155" y="146" width="86" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
-        <dc:Bounds x="290" y="81" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
-        <dc:Bounds x="479" y="74" width="121" height="94" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1o68a9z_di" bpmnElement="Gateway_1o68a9z" isMarkerVisible="true">
-        <dc:Bounds x="665" y="96" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="653" y="73" width="75" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
-        <dc:Bounds x="640" y="360" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
-        <dc:Bounds x="860" y="360" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0ziz3ti_di" bpmnElement="Activity_0ziz3ti">
-        <dc:Bounds x="1130" y="360" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
-        <dc:Bounds x="1372" y="382" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1380" y="425" width="20" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
         <dc:Bounds x="735" y="1080" width="781" height="196" />
       </bpmndi:BPMNShape>
@@ -247,6 +211,42 @@ runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
       <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
         <dc:Bounds x="1029" y="1144" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1372" y="382" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1380" y="425" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="860" y="360" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="640" y="360" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="479" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="290" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0h1vr2l_di" bpmnElement="Activity_0h1vr2l">
+        <dc:Bounds x="789" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14ab476_di" bpmnElement="Activity_14ab476">
+        <dc:Bounds x="989" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vtz33q_di" bpmnElement="Activity_1vtz33q">
+        <dc:Bounds x="1229" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ziz3ti_di" bpmnElement="Activity_0ziz3ti">
+        <dc:Bounds x="1130" y="360" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1o68a9z_di" bpmnElement="Gateway_1o68a9z" isMarkerVisible="true">
+        <dc:Bounds x="665" y="96" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="653" y="73" width="75" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 3b0bdb2..6fbf09e 100644 (file)
@@ -45,6 +45,8 @@
   <logger name="AUDIT" level="info" additivity="true">
     <appender-ref ref="STDOUT"/>
   </logger>
+  
+  <logger name="org.reflections" level="ERROR" />
 
   <!-- suppress the amount of org.apache.tomcat.util.net.NioEndpoint log-->
   <logger name="org.apache.tomcat" level="WARN" />
index 276b546..64db713 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>bpmn</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-bpmn-tasks</artifactId>
index 8e6e867..7c6473f 100644 (file)
@@ -2,12 +2,15 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
 import java.util.Optional;
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.commons.lang3.StringUtils;
 import org.onap.so.adapters.nwrest.CreateNetworkResponse;
 import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
 import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
@@ -22,6 +25,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
 
 @Component
 public class NetworkAdapterImpl {
@@ -80,14 +84,16 @@ public class NetworkAdapterImpl {
         return unmarshaller.unmarshal(reader);
     }
 
-    protected Optional<String> findResponseType(String xmlString) {
+    protected Optional<String> findResponseType(final String xmlString) {
         try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            org.w3c.dom.Document doc;
-            doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+            factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY);
+
+            final DocumentBuilder builder = factory.newDocumentBuilder();
+            final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)));
             return Optional.of(doc.getDocumentElement().getNodeName());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             logger.error("Error Finding Response Type", e);
             return Optional.empty();
         }
index e55fa9e..7ed8447 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks;
 
 import java.io.StringReader;
 import java.io.StringWriter;
+import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
@@ -30,14 +31,15 @@ import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
+import org.apache.commons.lang3.StringUtils;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.logging.filter.base.ONAPComponents;
 import org.onap.so.bpmn.infrastructure.sdnc.exceptions.SDNCErrorResponseException;
 import org.onap.so.client.exception.BadResponseException;
 import org.onap.so.client.exception.ExceptionBuilder;
 import org.onap.so.client.exception.MapperException;
 import org.onap.so.client.sdnc.SDNCClient;
 import org.onap.so.client.sdnc.beans.SDNCRequest;
-import org.onap.logging.filter.base.ONAPComponents;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,10 +49,17 @@ import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import com.jayway.jsonpath.JsonPath;
 import com.jayway.jsonpath.PathNotFoundException;
+import net.sf.saxon.lib.NamespaceConstant;
+import net.sf.saxon.xpath.XPathFactoryImpl;
 
 @Component
 public class SDNCRequestTasks {
 
+    private static final String NET_SF_SAXON_XPATH_IMPL = "net.sf.saxon.xpath.XPathFactoryImpl";
+
+    private static final String XPATH_FACTORY_PROPERTY_NAME =
+            "javax.xml.xpath.XPathFactory:" + NamespaceConstant.OBJECT_MODEL_SAXON;
+
     private static final Logger logger = LoggerFactory.getLogger(SDNCRequestTasks.class);
 
     private static final String SDNC_REQUEST = "SDNCRequest";
@@ -143,14 +152,20 @@ public class SDNCRequestTasks {
         return "Y".equals(finalMessageIndicator);
     }
 
-    protected String getXmlElement(Document doc, String exp) throws Exception {
-        TransformerFactory tf = TransformerFactory.newInstance();
-        Transformer transformer = tf.newTransformer();
-        StringWriter writer = new StringWriter();
+    protected String getXmlElement(final Document doc, final String exp) throws Exception {
+        final TransformerFactory factory = TransformerFactory.newInstance();
+        factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY);
+        factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, StringUtils.EMPTY);
+
+        final Transformer transformer = factory.newTransformer();
+        final StringWriter writer = new StringWriter();
         transformer.transform(new DOMSource(doc), new StreamResult(writer));
         logger.debug(writer.getBuffer().toString());
-        XPath xPath = XPathFactory.newInstance().newXPath();
-        String result = xPath.evaluate(exp, doc);
+
+        System.setProperty(XPATH_FACTORY_PROPERTY_NAME, NET_SF_SAXON_XPATH_IMPL);
+        final XPathFactory xPathFactory = XPathFactoryImpl.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
+        final XPath xPath = xPathFactory.newXPath();
+        final String result = xPath.evaluate(exp, doc);
         if (result == null || result.isEmpty()) {
             throw new Exception("XPath Failed to find element expression: " + exp);
         }
index 2138f48..2bd0f2c 100644 (file)
@@ -10,6 +10,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2020 Tech Mahindra
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -26,6 +28,7 @@
 
 package org.onap.so.bpmn.infrastructure.workflow.tasks;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -36,20 +39,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.UUID;
 import java.util.stream.Collectors;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONFIGURATION;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.VOLUMEGROUP;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.*;
 
 @Component
 public class ExecuteBuildingBlockBuilder {
@@ -62,78 +56,117 @@ public class ExecuteBuildingBlockBuilder {
     private static final String NETWORK = "Network";
 
     protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
-            List<Resource> resourceList, String requestId, String apiVersion, String resourceId, String requestAction,
-            String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
-            boolean replaceVnf) {
+            List<Resource> originalResourceList, String requestId, String apiVersion, String resourceId,
+            String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds,
+            RequestDetails requestDetails, boolean replaceVnf) {
+        List<Resource> resourceList = getOnlyRootResourceList(originalResourceList);
+
         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+
+        boolean ascendingOrder = requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGN_INSTANCE)
+                || requestAction.equals(ACTIVATE_INSTANCE);
+
+        ExecutionPlan plan = ExecutionPlan.build(resourceList, ascendingOrder);
+
+        logger.info("Orchestration Flows");
         for (OrchestrationFlow orchFlow : orchFlows) {
-            if (orchFlow.getFlowName().contains(SERVICE)) {
-                if (!replaceVnf) {
-                    workflowResourceIds.setServiceInstanceId(resourceId);
-                }
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.SERVICE, orchFlow, requestId,
-                        apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
-                        false);
-            } else if (orchFlow.getFlowName().contains(VNF) || (orchFlow.getFlowName().contains(CONTROLLER)
-                    && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, 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, resourceList, WorkflowType.PNF, orchFlow, requestId,
-                        apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
-                        false);
-            } else if (orchFlow.getFlowName().contains(NETWORK)
-                    && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORK, orchFlow, requestId,
-                        apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
-                        false);
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VIRTUAL_LINK, orchFlow,
-                        requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
-                        true, false);
-            } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER)
-                    && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
-                List<Resource> vfModuleResourcesSorted;
-                if (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGNINSTANCE)
-                        || requestAction.equals("activateInstance")) {
-                    vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceList.stream()
-                            .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
-                } else {
-                    vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream()
-                            .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
-                }
-                for (Resource resource : vfModuleResourcesSorted) {
-                    flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
-                            requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null,
-                            false, null));
-                }
-            } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
-                if (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
-                        || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) {
-                    logger.debug("Replacing workflow resource id by volume group id");
-                    resourceId = workflowResourceIds.getVolumeGroupId();
-                }
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VOLUMEGROUP, orchFlow,
-                        requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
-                        false, false);
-            } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORKCOLLECTION, orchFlow,
-                        requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
-                        false, false);
-            } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
-                addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.CONFIGURATION, orchFlow,
-                        requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
-                        false, true);
-            } else {
-                flowsToExecute
-                        .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction,
-                                false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null));
+            String flowDetails = new ToStringBuilder(this).append("id", orchFlow.getId())
+                    .append("action", orchFlow.getAction()).append("sequenceNumber", orchFlow.getSequenceNumber())
+                    .append("flowName", orchFlow.getFlowName()).append("flowVersion", orchFlow.getFlowVersion())
+                    .append("bpmnAction", orchFlow.getBpmnAction()).append("bpmnScope", orchFlow.getBpmnScope())
+                    .toString();
+            logger.info("Flow: " + flowDetails);
+            buildExecuteBuildingBlockListPlan(orchFlow, plan, requestId, apiVersion, resourceId, requestAction, vnfType,
+                    workflowResourceIds, requestDetails, replaceVnf);
+        }
+
+        plan.flushBlocksFromCache(flowsToExecute);
+
+        return flowsToExecute;
+    }
+
+    protected void buildExecuteBuildingBlockListPlan(OrchestrationFlow flow, ExecutionPlan plan, String requestId,
+            String apiVersion, String resourceId, String requestAction, String vnfType,
+            WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean replaceVnf) {
+
+        List<ExecuteBuildingBlock> mainFlows = buildExecuteBuildingBlockListRaw(flow, plan.getResource(), requestId,
+                apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, replaceVnf);
+
+        plan.pushBlockToCache(mainFlows);
+
+        for (ExecutionGroup nestedGroup : plan.getNestedExecutions()) {
+            for (ExecutionPlan nestedPlan : nestedGroup.getNestedExecutions()) {
+                buildExecuteBuildingBlockListPlan(flow, nestedPlan, requestId, apiVersion, resourceId, requestAction,
+                        vnfType, workflowResourceIds, requestDetails, replaceVnf);
             }
+            if (nestedGroup.getCacheSize() > 0)
+                plan.changeCurrentGroup(nestedGroup);
+        }
+    }
+
+    private List<ExecuteBuildingBlock> buildExecuteBuildingBlockListRaw(OrchestrationFlow orchFlow, Resource resource,
+            String requestId, String apiVersion, String resourceId, String requestAction, String vnfType,
+            WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean replaceVnf) {
+        List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+        if (orchFlow.getFlowName().contains(SERVICE) || (orchFlow.getFlowName().contains(CONTROLLER)
+                && (SERVICE).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
+            if (!replaceVnf) {
+                workflowResourceIds.setServiceInstanceId(resourceId);
+            }
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.SERVICE, orchFlow, requestId,
+                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if (orchFlow.getFlowName().contains(VNF)
+                || (orchFlow.getFlowName().contains(CONTROLLER) && (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,
+                    resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if (orchFlow.getFlowName().contains(NETWORK) && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.NETWORK, orchFlow, requestId,
+                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VIRTUAL_LINK, orchFlow, requestId,
+                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, true, false);
+        } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER)
+                && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VFMODULE, orchFlow, requestId,
+                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
+            if (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
+                    || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) {
+                logger.debug("Replacing workflow resource id by volume group id");
+                resourceId = workflowResourceIds.getVolumeGroupId();
+            }
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VOLUMEGROUP, orchFlow, requestId,
+                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.NETWORKCOLLECTION, orchFlow,
+                    requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
+                    false, false);
+        } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.CONFIGURATION, orchFlow, requestId,
+                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, true);
+        } else {
+            flowsToExecute
+                    .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction,
+                            false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null));
         }
         return flowsToExecute;
     }
 
+    protected List<Resource> getOnlyRootResourceList(List<Resource> resourceList) {
+        return resourceList.stream().filter(x -> countResourceOnTheResourceList(x, resourceList) == 1)
+                .collect(Collectors.toList());
+    }
+
+    protected int countResourceOnTheResourceList(Resource resource, List<Resource> resourceList) {
+        int count = resourceList.stream()
+                .mapToInt(x -> (x.equals(resource) ? 1 : 0) + countResourceOnTheResourceList(resource, x.getChildren()))
+                .reduce(0, Integer::sum);
+        return count;
+    }
+
     protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId,
             Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte,
             String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
@@ -169,39 +202,16 @@ public class ExecuteBuildingBlockBuilder {
         return executeBuildingBlock;
     }
 
-    protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
-        int count = 0;
-        for (Resource resource : vfModuleResources) {
-            if (resource.isBaseVfModule()) {
-                Collections.swap(vfModuleResources, 0, count);
-                break;
-            }
-            count++;
-        }
-        return vfModuleResources;
-    }
-
-    protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
-        int count = 0;
-        for (Resource resource : vfModuleResources) {
-            if (resource.isBaseVfModule()) {
-                Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count);
-                break;
-            }
-            count++;
-        }
-        return vfModuleResources;
-    }
-
-    private void addBuildingBlockToExecuteBBList(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList,
+    private void addBuildingBlockToExecuteBBList(List<ExecuteBuildingBlock> flowsToExecute, Resource resource,
             WorkflowType workflowType, OrchestrationFlow orchFlow, String requestId, String apiVersion,
             String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds,
             RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) {
 
-        resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType))
-                .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
-                        apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
-                        isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null)));
+        if (resource == null || !resource.getResourceType().equals(workflowType))
+            return;
+        flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+                requestAction, false, vnfType, workflowResourceIds, requestDetails, isVirtualLink,
+                resource.getVirtualLinkKey(), null, isConfiguration, null));
     }
 
     protected ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) {
@@ -212,6 +222,4 @@ public class ExecuteBuildingBlockBuilder {
         configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
         return configurationResourceKeys;
     }
-
-
 }
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecutionPlan.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecutionPlan.java
new file mode 100644 (file)
index 0000000..77cb616
--- /dev/null
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Orange 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.
+ * 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.workflow.tasks;
+
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
+
+class ExecutionPlan extends ExecutionCollection<ExecutionGroup> {
+    private final Resource resource;
+    private ExecutionGroup currentGroup = null;
+
+    public ExecutionPlan(Resource resource, ExecutionGroup group) {
+        super(resource != null ? resource.getResourceType() : WorkflowType.SERVICE);
+        this.resource = resource;
+        if (group != null) {
+            group.addNestedPlans(Collections.singletonList(this));
+        }
+    }
+
+    public void changeCurrentGroup(ExecutionGroup group) {
+        if (currentGroup == null || !currentGroup.equals(group)) {
+            logger.info("Change " + getName() + " group[" + group.getName() + "]");
+            if (currentGroup != null)
+                currentGroup.flushBlocksFromCache(this.blocksBuiltCache);
+        }
+        currentGroup = group;
+    }
+
+    Resource getResource() {
+        return resource;
+    }
+
+    protected String getName() {
+        return super.getName() + "["
+                + (resource != null ? (resource.getProcessingPriority() + ", " + resource.getResourceId()) : "") + "]";
+    }
+
+    public static ExecutionPlan build(List<Resource> resourceList, boolean ascendingOrder) {
+        ExecutionPlan plan = new ExecutionPlan(null, null);
+        buildExecutionPlan(plan, resourceList, ascendingOrder);
+        if (plan.getNestedExecutions().size() == 1
+                && plan.getNestedExecutions().get(0).getNestedExecutions().size() == 1)
+            plan = plan.getNestedExecutions().get(0).getNestedExecutions().get(0);
+        return plan;
+    }
+
+    private static void buildExecutionPlan(ExecutionPlan plan, List<Resource> resourceList, boolean ascendingOrder) {
+        Map<WorkflowType, List<Resource>> resourceGroups = new TreeMap<>();
+        for (Resource resource : resourceList) {
+            if (!resourceGroups.containsKey(resource.getResourceType())) {
+                resourceGroups.put(resource.getResourceType(), new ArrayList<>());
+            }
+            resourceGroups.get(resource.getResourceType()).add(resource);
+        }
+        for (WorkflowType type : resourceGroups.keySet()) {
+            ExecutionGroup nestedGroup = new ExecutionGroup(type, plan);
+            List<Resource> resourceGroupSorted = resourceGroups.get(type).stream()
+                    .sorted(ascendingOrder ? Resource.sortByPriorityAsc : Resource.sortByPriorityDesc)
+                    .collect(Collectors.toList());
+            for (Resource resource : resourceGroupSorted) {
+                ExecutionPlan planInGroup = new ExecutionPlan(resource, nestedGroup);
+                if (resource.getChildren().size() > 0)
+                    buildExecutionPlan(planInGroup, resource.getChildren(), ascendingOrder);
+            }
+        }
+    }
+}
+
+
+class ExecutionGroup extends ExecutionCollection<ExecutionPlan> {
+
+    public ExecutionGroup(WorkflowType groupType, ExecutionPlan plan) {
+        super(groupType);
+        plan.addNestedPlans(Collections.singletonList(this));
+    }
+}
+
+
+class ExecutionCollection<T extends ExecutionCollection<?>> {
+
+    protected static final Logger logger = LoggerFactory.getLogger(ExecutionCollection.class);
+
+    protected final WorkflowType type;
+    protected List<ExecuteBuildingBlock> blocksBuiltCache;
+    protected final List<T> nestedExecutions;
+
+    public ExecutionCollection(WorkflowType type) {
+        this.type = type;
+        this.nestedExecutions = new ArrayList<>();
+        this.blocksBuiltCache = new ArrayList<>();
+    }
+
+    public WorkflowType getType() {
+        return type;
+    }
+
+    public List<T> getNestedExecutions() {
+        return nestedExecutions;
+    }
+
+    public void addNestedPlans(List<T> executions) {
+        nestedExecutions.addAll(executions);
+    }
+
+    public void pushBlockToCache(List<ExecuteBuildingBlock> blocksCache) {
+        if (blocksCache.size() == 0)
+            return;
+        this.flushNestedBlocksToCache();
+        String blocks =
+                blocksCache.stream().map(x -> x.getBuildingBlock().getBpmnFlowName() + ", ").reduce("", String::concat);
+        blocks = blocks.substring(0, blocks.length() - 2);
+        logger.info("Push " + getName() + " (" + blocksCache.size() + ") blocks [" + blocks + "]");
+        this.blocksBuiltCache.addAll(blocksCache);
+    }
+
+    private void flushNestedBlocksToCache() {
+        for (T collection : nestedExecutions) {
+            collection.flushBlocksFromCache(this.blocksBuiltCache);
+        }
+    }
+
+    public void flushBlocksFromCache(List<ExecuteBuildingBlock> blockList) {
+        flushNestedBlocksToCache();
+        if (this.blocksBuiltCache.size() > 0) {
+            String blocks = this.blocksBuiltCache.stream().map(x -> x.getBuildingBlock().getBpmnFlowName() + ", ")
+                    .reduce("", String::concat);
+            blocks = blocks.substring(0, blocks.length() - 2);
+            logger.info("Flush " + getName() + " (" + blocksBuiltCache.size() + ") blocks [" + blocks + "]");
+            blockList.addAll(this.blocksBuiltCache);
+            this.blocksBuiltCache.clear();
+        }
+    }
+
+    public int getCacheSize() {
+        return blocksBuiltCache.size()
+                + getNestedExecutions().stream().mapToInt(x -> x.getCacheSize()).reduce(0, Integer::sum);
+    }
+
+    protected String getName() {
+        return type.name();
+    }
+}
index 447f899..0d2844d 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
 
 package org.onap.so.bpmn.infrastructure.workflow.tasks;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
 public class Resource {
 
     private String resourceId;
@@ -30,11 +37,24 @@ public class Resource {
     private String vnfCustomizationId;
     private String vfModuleCustomizationId;
     private String cvnfModuleCustomizationId;
+    private int processingPriority;
+    private Resource parent;
+    private List<Resource> children;
+
+    public static final Comparator<Resource> sortByPriorityAsc =
+            Comparator.comparingInt(Resource::getProcessingPriority);
+    public static final Comparator<Resource> sortByPriorityDesc =
+            Comparator.comparingInt(x -> -x.getProcessingPriority());
 
-    public Resource(WorkflowType resourceType, String resourceId, boolean generated) {
+    public Resource(WorkflowType resourceType, String resourceId, boolean generated, Resource parent) {
         this.resourceId = resourceId;
         this.resourceType = resourceType;
         this.generated = generated;
+        this.processingPriority = 0;
+        this.children = new ArrayList<>();
+        this.parent = parent;
+        if (parent != null)
+            this.parent.children.add(this);
     }
 
     public String getResourceId() {
@@ -100,4 +120,20 @@ public class Resource {
     public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
         this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
     }
+
+    public int getProcessingPriority() {
+        return processingPriority == 0 ? (isBaseVfModule() ? Integer.MIN_VALUE + 1 : 0) : processingPriority;
+    }
+
+    public void setProcessingPriority(int processingPriority) {
+        this.processingPriority = processingPriority;
+    }
+
+    public Resource getParent() {
+        return this.parent;
+    }
+
+    public List<Resource> getChildren() {
+        return this.children;
+    }
 }
index 29206a6..ce775af 100644 (file)
@@ -10,6 +10,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2020 Tech Mahindra
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
 
 package org.onap.so.bpmn.infrastructure.workflow.tasks;
 
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGN_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.DELETE_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.RECREATE_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPDATE_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -279,14 +284,14 @@ public class WorkflowAction {
         List<Resource> resourceList = new ArrayList<>();
         List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
 
-        if (resourceType == WorkflowType.SERVICE) {
+        if (resourceType == WorkflowType.SERVICE || isVNFCreateOrDelete(resourceType, requestAction)) {
             resourceList = serviceEBBLoader.getResourceListForService(sIRequest, requestAction, execution,
                     serviceInstanceId, resourceId, aaiResourceIds);
         } else if (resourceType == WorkflowType.VNF && (REPLACEINSTANCE.equalsIgnoreCase(requestAction)
-                || ("recreateInstance".equalsIgnoreCase(requestAction)))) {
+                || (RECREATE_INSTANCE.equalsIgnoreCase(requestAction)))) {
             vnfEBBLoader.traverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
                     workflowResourceIds.getVnfId(), aaiResourceIds);
-        } else if (resourceType == WorkflowType.VNF && "updateInstance".equalsIgnoreCase(requestAction)) {
+        } else if (resourceType == WorkflowType.VNF && UPDATE_INSTANCE.equalsIgnoreCase(requestAction)) {
             vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
                     workflowResourceIds.getVnfId(), aaiResourceIds);
         } else {
@@ -315,14 +320,32 @@ public class WorkflowAction {
             logger.info("Sorting for Vlan Tagging");
             flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
         }
+        logger.info("Building Block Execution Order");
+        for (ExecuteBuildingBlock block : flowsToExecute) {
+            Resource res = resourceList.stream()
+                    .filter(resource -> resource.getResourceId() == block.getBuildingBlock().getKey()).findAny()
+                    .orElse(null);
+            String log = "Block: " + block.getBuildingBlock().getBpmnFlowName();
+            if (res != null) {
+                log += ", Resource: " + res.getResourceType() + "[" + res.getResourceId() + "]";
+                log += ", Priority: " + res.getProcessingPriority();
+                if (res.getResourceType() == WorkflowType.VFMODULE)
+                    log += ", Base: " + res.isBaseVfModule();
+            }
+            if (block.getBuildingBlock().getBpmnScope() != null)
+                log += ", Scope: " + block.getBuildingBlock().getBpmnScope();
+            if (block.getBuildingBlock().getBpmnAction() != null)
+                log += ", Action: " + block.getBuildingBlock().getBpmnAction();
+            logger.info(log);
+        }
         // By default, enable homing at VNF level for CREATE_INSTANCE and ASSIGNINSTANCE
         if (resourceType == WorkflowType.SERVICE
-                && (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGNINSTANCE))
+                && (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGN_INSTANCE))
                 && resourceList.stream().anyMatch(x -> WorkflowType.VNF.equals(x.getResourceType()))) {
             execution.setVariable(HOMING, true);
             execution.setVariable("calledHoming", false);
         }
-        if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)
+        if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGN_INSTANCE)
                 || requestAction.equalsIgnoreCase(CREATE_INSTANCE))) {
             generateResourceIds(flowsToExecute, resourceList, serviceInstanceId);
         } else {
@@ -331,6 +354,11 @@ public class WorkflowAction {
         return flowsToExecute;
     }
 
+    private boolean isVNFCreateOrDelete(WorkflowType resourceType, String requestAction) {
+        return resourceType == WorkflowType.VNF
+                && (CREATE_INSTANCE.equalsIgnoreCase(requestAction) || DELETE_INSTANCE.equalsIgnoreCase(requestAction));
+    }
+
     private void setExecutionVariables(DelegateExecution execution, List<ExecuteBuildingBlock> flowsToExecute,
             List<String> flowNames) {
         execution.setVariable("flowNames", flowNames);
@@ -409,7 +437,7 @@ public class WorkflowAction {
                 resourceId = modelInfo.getModelCustomizationId();
             }
         }
-        return new Resource(resourceType, resourceId, true);
+        return new Resource(resourceType, resourceId, true, null);
     }
 
     private String getCloudOwner(CloudConfiguration cloudConfiguration) {
@@ -724,7 +752,7 @@ public class WorkflowAction {
                     type = action;
                 }
             }
-            return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated);
+            return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated, null);
         } else {
             throw new IllegalArgumentException("Uri could not be parsed: " + uri);
         }
@@ -887,7 +915,7 @@ public class WorkflowAction {
     protected boolean isRequestMacroServiceResume(boolean aLaCarte, WorkflowType resourceType, String requestAction,
             String serviceInstanceId) {
         return (!aLaCarte && resourceType == WorkflowType.SERVICE
-                && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATE_INSTANCE))
+                && (requestAction.equalsIgnoreCase(ASSIGN_INSTANCE) || requestAction.equalsIgnoreCase(CREATE_INSTANCE))
                 && (serviceInstanceId != null && serviceInstanceId.trim().length() > 1)
                 && (bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId) != null));
     }
index b2cc895..38ba007 100644 (file)
@@ -32,16 +32,23 @@ public final class WorkflowActionConstants {
         throw new IllegalStateException("Utility class");
     }
 
-    public static final String USER_PARAM_SERVICE = "service";
+    public static final String ACTIVATE_INSTANCE = "activateInstance";
+    public static final String ASSIGN_INSTANCE = "assignInstance";
+    public static final String CONFIGURATION = "Configuration";
+    public static final String CONTROLLER = "Controller";
     public static final String CREATE_INSTANCE = "createInstance";
+    public static final String DEACTIVATE_INSTANCE = "deactivateInstance";
+    public static final String DELETE_INSTANCE = "deleteInstance";
     public static final String FABRIC_CONFIGURATION = "FabricConfiguration";
-    public static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
-    static final String SERVICE = "Service";
-    static final String CONTROLLER = "Controller";
     public static final String NETWORKCOLLECTION = "NetworkCollection";
-    static final String CONFIGURATION = "Configuration";
-    public static final String ASSIGNINSTANCE = "assignInstance";
-    static final String REPLACEINSTANCE = "replaceInstance";
-    static final String VOLUMEGROUP = "VolumeGroup";
-    static final String REPLACEINSTANCERETAINASSIGNMENTS = "replaceInstanceRetainAssignments";
+    public static final String RECREATE_INSTANCE = "recreateInstance";
+    public static final String REPLACEINSTANCE = "replaceInstance";
+    public static final String REPLACEINSTANCERETAINASSIGNMENTS = "replaceInstanceRetainAssignments";
+    public static final String SERVICE = "Service";
+    public static final String UNASSIGN_INSTANCE = "unassignInstance";
+    public static final String UPDATE_INSTANCE = "updateInstance";
+    public static final String USER_PARAM_SERVICE = "service";
+    public static final String VOLUMEGROUP = "VolumeGroup";
+    public static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
+
 }
index 068c287..e4c6d29 100644 (file)
@@ -1,3 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2020 Nokia
+ * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
+ * 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.workflow.tasks.ebb.loader;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -35,12 +57,16 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ACTIVATE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.DEACTIVATE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.DELETE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UNASSIGN_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION;
 import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGN_INSTANCE;
 
 
 @Component
@@ -77,7 +103,7 @@ public class ServiceEBBLoader {
         boolean containsService = false;
         List<Resource> resourceList = new ArrayList<>();
         List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
-        if (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
+        if (requestAction.equalsIgnoreCase(ASSIGN_INSTANCE)) {
             // SERVICE-MACRO-ASSIGN will always get user params with a
             // service.
 
@@ -108,17 +134,16 @@ public class ServiceEBBLoader {
             if (!foundRelated(resourceList)) {
                 traverseCatalogDbService(execution, sIRequest, resourceList, aaiResourceIds);
             }
-        } else if (("activateInstance".equalsIgnoreCase(requestAction)
-                || "unassignInstance".equalsIgnoreCase(requestAction)
-                || "deleteInstance".equalsIgnoreCase(requestAction)
+        } else if ((ACTIVATE_INSTANCE.equalsIgnoreCase(requestAction)
+                || UNASSIGN_INSTANCE.equalsIgnoreCase(requestAction) || DELETE_INSTANCE.equalsIgnoreCase(requestAction)
                 || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
             // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
             // SERVICE-MACRO-DELETE
             // Will never get user params with service, macro will have
             // to query the SI in AAI to find related instances.
             traverseAAIService(execution, resourceList, resourceId, aaiResourceIds);
-        } else if ("deactivateInstance".equalsIgnoreCase(requestAction)) {
-            resourceList.add(new Resource(WorkflowType.SERVICE, "", false));
+        } else if (DEACTIVATE_INSTANCE.equalsIgnoreCase(requestAction)) {
+            resourceList.add(new Resource(WorkflowType.SERVICE, "", false, null));
         }
         return resourceList;
     }
@@ -139,16 +164,18 @@ public class ServiceEBBLoader {
         if (service == null) {
             buildAndThrowException(execution, "Could not find the service model in catalog db.");
         } else {
-            resourceList.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
+            Resource serviceResource = new Resource(WorkflowType.SERVICE, service.getModelUUID(), false, null);
+            resourceList.add(serviceResource);
             RelatedInstance relatedVpnBinding =
                     bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
             RelatedInstance relatedLocalNetwork =
                     bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
 
             if (relatedVpnBinding != null && relatedLocalNetwork != null) {
-                traverseVrfConfiguration(aaiResourceIds, resourceList, service, relatedVpnBinding, relatedLocalNetwork);
+                traverseVrfConfiguration(aaiResourceIds, resourceList, serviceResource, service, relatedVpnBinding,
+                        relatedLocalNetwork);
             } else {
-                traverseNetworkCollection(execution, resourceList, service);
+                traverseNetworkCollection(execution, resourceList, serviceResource, service);
             }
         }
     }
@@ -166,14 +193,17 @@ public class ServiceEBBLoader {
             ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
             org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
                     bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
-            resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
-            traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
-            traverseServiceInstanceMSOPnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
+            Resource serviceResource =
+                    new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
+            resourceList.add(serviceResource);
+            traverseServiceInstanceMSOVnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
+            traverseServiceInstanceMSOPnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
             if (serviceInstanceMSO.getNetworks() != null) {
                 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));
+                    resourceList
+                            .add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource));
                 }
             }
             if (serviceInstanceMSO.getCollection() != null) {
@@ -181,7 +211,7 @@ public class ServiceEBBLoader {
                 aaiResourceIds
                         .add(new Pair<>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
                 resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
-                        serviceInstanceMSO.getCollection().getId(), false));
+                        serviceInstanceMSO.getCollection().getId(), false, serviceResource));
             }
             if (serviceInstanceMSO.getConfigurations() != null) {
                 for (Configuration config : serviceInstanceMSO.getConfigurations()) {
@@ -192,8 +222,8 @@ public class ServiceEBBLoader {
                             if (relationship.getRelatedTo().contains("vnfc")
                                     || relationship.getRelatedTo().contains("vpn-binding")) {
                                 aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
-                                resourceList.add(
-                                        new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
+                                resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(),
+                                        false, serviceResource));
                                 break;
                             }
                         }
@@ -207,7 +237,7 @@ public class ServiceEBBLoader {
         }
     }
 
-    private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList,
+    private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList, Resource serviceResource,
             List<Pair<WorkflowType, String>> aaiResourceIds,
             org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
         if (serviceInstanceMSO.getVnfs() == null) {
@@ -215,18 +245,20 @@ public class ServiceEBBLoader {
         }
         for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
             aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
-            resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
-            traverseVnfModules(resourceList, aaiResourceIds, vnf);
+            Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource);
+            resourceList.add(vnfResource);
+            traverseVnfModules(resourceList, vnfResource, aaiResourceIds, vnf);
             if (vnf.getVolumeGroups() != null) {
                 for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
                     aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
-                    resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
+                    resourceList.add(
+                            new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false, vnfResource));
                 }
             }
         }
     }
 
-    private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList,
+    private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList, Resource serviceResource,
             List<Pair<WorkflowType, String>> aaiResourceIds,
             org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
         if (serviceInstanceMSO.getPnfs() == null) {
@@ -234,12 +266,12 @@ 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));
+            resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource));
         }
     }
 
     protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds,
-            List<Resource> resourceList, org.onap.so.db.catalog.beans.Service service,
+            List<Resource> resourceList, Resource serviceResource, org.onap.so.db.catalog.beans.Service service,
             RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork)
             throws VrfBondingServiceException, JsonProcessingException {
         org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
@@ -257,12 +289,12 @@ public class ServiceEBBLoader {
             aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
         }
         resourceList.add(new Resource(WorkflowType.CONFIGURATION,
-                service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
+                service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false, serviceResource));
 
     }
 
     protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
-            org.onap.so.db.catalog.beans.Service service) {
+            Resource serviceResource, org.onap.so.db.catalog.beans.Service service) {
         if (isVnfCustomizationsInTheService(service)) {
             buildAndThrowException(execution,
                     "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
@@ -277,14 +309,16 @@ public class ServiceEBBLoader {
         } else {
             CollectionResourceCustomization collectionResourceCustomization =
                     findCatalogNetworkCollection(execution, service);
-            traverseNetworkCollectionResourceCustomization(resourceList, collectionResourceCustomization);
+            traverseNetworkCollectionResourceCustomization(resourceList, serviceResource,
+                    collectionResourceCustomization);
         }
-        traverseNetworkCollectionCustomization(resourceList, service);
+        traverseNetworkCollectionCustomization(resourceList, serviceResource, service);
     }
 
-    private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList,
+    private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList, Resource serviceResource,
             CollectionResourceCustomization collectionResourceCustomization) {
-        if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, collectionResourceCustomization))
+        if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, serviceResource,
+                collectionResourceCustomization))
             return;
         int minNetworks = 0;
         org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
@@ -309,7 +343,7 @@ public class ServiceEBBLoader {
         for (int i = 0; i < minNetworks; i++) {
             if (collectionNetworkResourceCust != null) {
                 Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
-                        collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+                        collectionNetworkResourceCust.getModelCustomizationUUID(), false, serviceResource);
                 resource.setVirtualLinkKey(Integer.toString(i));
                 resourceList.add(resource);
             }
@@ -331,13 +365,13 @@ public class ServiceEBBLoader {
     }
 
     private boolean collectionResourceCustomizationShouldNotBeProcessed(List<Resource> resourceList,
-            CollectionResourceCustomization collectionResourceCustomization) {
+            Resource serviceResource, CollectionResourceCustomization collectionResourceCustomization) {
         if (collectionResourceCustomization == null) {
             logger.debug("No Network Collection Customization found");
             return true;
         }
         resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
-                collectionResourceCustomization.getModelCustomizationUUID(), false));
+                collectionResourceCustomization.getModelCustomizationUUID(), false, serviceResource));
         logger.debug("Found a network collection");
         if (collectionResourceCustomization.getCollectionResource() == null) {
             logger.debug("No Network Collection found. collectionResource is null");
@@ -365,7 +399,7 @@ public class ServiceEBBLoader {
         return toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION);
     }
 
-    private void traverseNetworkCollectionCustomization(List<Resource> resourceList,
+    private void traverseNetworkCollectionCustomization(List<Resource> resourceList, Resource serviceResource,
             org.onap.so.db.catalog.beans.Service service) {
         if (isNetworkCollectionInTheResourceList(resourceList)) {
             return;
@@ -376,7 +410,7 @@ public class ServiceEBBLoader {
         }
         for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
             resourceList.add(new Resource(WorkflowType.NETWORK,
-                    service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
+                    service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false, serviceResource));
         }
     }
 
@@ -388,14 +422,15 @@ public class ServiceEBBLoader {
         return !(service.getPnfCustomizations() == null || service.getPnfCustomizations().isEmpty());
     }
 
-    private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds,
+    private void traverseVnfModules(List<Resource> resourceList, Resource vnfResource,
+            List<Pair<WorkflowType, String>> aaiResourceIds,
             org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
         if (vnf.getVfModules() == null) {
             return;
         }
         for (VfModule vfModule : vnf.getVfModules()) {
             aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
-            Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
+            Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource);
             resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
             resourceList.add(resource);
         }
index 4b1fdd8..1f93274 100644 (file)
@@ -10,6 +10,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2020 Tech Mahindra
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -89,38 +91,45 @@ public class UserParamsServiceTraversal {
     private List<Resource> getResourceList(DelegateExecution execution, String serviceModelVersionId,
             String requestAction, Service validate) {
         List<Resource> resourceList = new ArrayList<>();
-        resourceList.add(new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false));
+        Resource serviceResource =
+                new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false, null);
+        resourceList.add(serviceResource);
         if (validate.getResources().getVnfs() != null) {
-            setResourceListForVnfs(execution, resourceList, validate);
+            setResourceListForVnfs(execution, resourceList, serviceResource, validate);
         }
         if (validate.getResources().getPnfs() != null) {
-            setResourceListForPnfs(resourceList, validate);
+            setResourceListForPnfs(resourceList, serviceResource, validate);
         }
         if (validate.getResources().getNetworks() != null) {
-            setResourceListForNetworks(execution, serviceModelVersionId, requestAction, resourceList, validate);
+            setResourceListForNetworks(execution, serviceModelVersionId, requestAction, resourceList, serviceResource,
+                    validate);
         }
         return resourceList;
     }
 
-    private void setResourceListForVnfs(DelegateExecution execution, List<Resource> resourceList, Service validate) {
+    private void setResourceListForVnfs(DelegateExecution execution, List<Resource> resourceList,
+            Resource serviceResource, Service validate) {
         for (Vnfs vnf : validate.getResources().getVnfs()) {
             setVnfCustomizationUUID(vnf);
-            resourceList.add(new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false));
-            setResourceListForVfModules(execution, resourceList, validate, vnf);
+            Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false,
+                    serviceResource);
+            vnfResource.setProcessingPriority(vnf.getProcessingPriority());
+            resourceList.add(vnfResource);
+            setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf);
         }
     }
 
-    private void setResourceListForVfModules(DelegateExecution execution, List<Resource> resourceList, Service validate,
-            Vnfs vnf) {
+    private void setResourceListForVfModules(DelegateExecution execution, List<Resource> resourceList,
+            Resource vnfResource, Service validate, Vnfs vnf) {
         if (vnf.getVfModules() != null) {
             for (VfModules vfModule : vnf.getVfModules()) {
                 setVfModuleCustomizationUUID(vfModule);
                 VfModuleCustomization vfModuleCustomization =
                         catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(vfModuleCustomizationUUID);
                 if (vfModuleCustomization != null && vfModuleCustomization.getVfModule() != null) {
-                    setVolumeGroupWorkFlowTypeToResourceList(resourceList, vfModuleCustomization);
-                    setVfModuleAndConfigurationWorkFlowTypeToResourceList(resourceList, validate, vnf, vfModule,
-                            vfModuleCustomization);
+                    setVolumeGroupWorkFlowTypeToResourceList(resourceList, vnfResource, vfModuleCustomization);
+                    setVfModuleAndConfigurationWorkFlowTypeToResourceList(resourceList, vnfResource, validate, vnf,
+                            vfModule, vfModuleCustomization);
                     if (!foundVfModuleOrVG) {
                         buildAndThrowException(execution,
                                 "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null");
@@ -130,46 +139,49 @@ public class UserParamsServiceTraversal {
         }
     }
 
-    private void setVolumeGroupWorkFlowTypeToResourceList(List<Resource> resourceList,
+    private void setVolumeGroupWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource,
             VfModuleCustomization vfModuleCustomization) {
         if (vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null
                 && vfModuleCustomization.getVolumeHeatEnv() != null) {
             foundVfModuleOrVG = true;
-            resourceList.add(
-                    new Resource(WorkflowType.VOLUMEGROUP, vfModuleCustomization.getModelCustomizationUUID(), false));
+            resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, vfModuleCustomization.getModelCustomizationUUID(),
+                    false, vnfResource));
         }
     }
 
-    private void setVfModuleAndConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Service validate,
-            Vnfs vnf, VfModules vfModule, VfModuleCustomization vfModuleCustomization) {
+    private void setVfModuleAndConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList,
+            Resource vnfResource, Service validate, Vnfs vnf, VfModules vfModule,
+            VfModuleCustomization vfModuleCustomization) {
         if ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null
                 && vfModuleCustomization.getHeatEnvironment() != null)
                 || (vfModuleCustomization.getVfModule().getModelName() != null
                         && vfModuleCustomization.getVfModule().getModelName().contains("helm"))) {
             foundVfModuleOrVG = true;
-            Resource resource = setVfModuleWorkFlowTypeToResourceList(resourceList, vfModuleCustomization);
-            setConfigurationWorkFlowTypeToResourceList(resourceList, validate, vnf, vfModule, resource);
+            Resource resource =
+                    setVfModuleWorkFlowTypeToResourceList(resourceList, vnfResource, vfModuleCustomization, vfModule);
+            setConfigurationWorkFlowTypeToResourceList(resourceList, vnfResource, validate, vnf, vfModule, resource);
         }
     }
 
-    private Resource setVfModuleWorkFlowTypeToResourceList(List<Resource> resourceList,
-            VfModuleCustomization vfModuleCustomization) {
-        Resource resource =
-                new Resource(WorkflowType.VFMODULE, vfModuleCustomization.getModelCustomizationUUID(), false);
+    private Resource setVfModuleWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource,
+            VfModuleCustomization vfModuleCustomization, VfModules vfModule) {
+        Resource resource = new Resource(WorkflowType.VFMODULE, vfModuleCustomization.getModelCustomizationUUID(),
+                false, vnfResource);
+        resource.setProcessingPriority(vfModule.getProcessingPriority());
         resource.setBaseVfModule(vfModuleCustomization.getVfModule().getIsBase() != null
                 && vfModuleCustomization.getVfModule().getIsBase());
         resourceList.add(resource);
         return resource;
     }
 
-    private void setConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Service validate, Vnfs vnf,
-            VfModules vfModule, Resource resource) {
+    private void setConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource,
+            Service validate, Vnfs vnf, VfModules vfModule, Resource resource) {
         if (!vnfCustomizationUUID.isEmpty() && !vfModuleCustomizationUUID.isEmpty()) {
             List<CvnfcConfigurationCustomization> configs =
                     traverseCatalogDbForConfiguration(validate.getModelInfo().getModelVersionId());
             for (CvnfcConfigurationCustomization config : configs) {
                 Resource configResource = new Resource(WorkflowType.CONFIGURATION,
-                        config.getConfigurationResource().getModelUUID(), false);
+                        config.getConfigurationResource().getModelUUID(), false, vnfResource);
                 resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
                 resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
                 resourceList.add(configResource);
@@ -193,22 +205,28 @@ public class UserParamsServiceTraversal {
         }
     }
 
-    private void setResourceListForPnfs(List<Resource> resourceList, Service validate) {
+    private void setResourceListForPnfs(List<Resource> resourceList, Resource serviceResource, Service validate) {
         for (Pnfs pnf : validate.getResources().getPnfs()) {
-            resourceList.add(new Resource(WorkflowType.PNF, pnf.getModelInfo().getModelCustomizationId(), false));
+            Resource pnfResource = new Resource(WorkflowType.PNF, pnf.getModelInfo().getModelCustomizationId(), false,
+                    serviceResource);
+            pnfResource.setProcessingPriority(pnf.getProcessingPriority());
+            resourceList.add(pnfResource);
         }
     }
 
     private void setResourceListForNetworks(DelegateExecution execution, String serviceModelVersionId,
-            String requestAction, List<Resource> resourceList, Service validate) {
+            String requestAction, List<Resource> resourceList, Resource serviceResource, Service validate) {
         for (Networks network : validate.getResources().getNetworks()) {
-            resourceList
-                    .add(new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false));
+            Resource networkResource = new Resource(WorkflowType.NETWORK,
+                    network.getModelInfo().getModelCustomizationId(), false, serviceResource);
+            networkResource.setProcessingPriority(network.getProcessingPriority());
+            resourceList.add(networkResource);
         }
         if (requestAction.equals(CREATE_INSTANCE)) {
             String networkColCustId = queryCatalogDbForNetworkCollection(execution, serviceModelVersionId);
             if (networkColCustId != null) {
-                resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false));
+                resourceList
+                        .add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false, serviceResource));
             }
         }
     }
index b271226..c1d1d7a 100644 (file)
@@ -10,6 +10,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2020 Tech Mahindra
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -73,9 +75,11 @@ public class VnfEBBLoader {
             org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI =
                     bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
             ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
-            resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+            Resource serviceResource =
+                    new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
+            resourceList.add(serviceResource);
             if (serviceInstanceMSO.getVnfs() != null) {
-                findVnfWithGivenId(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList, execution);
+                findVnfWithGivenId(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList, serviceResource, execution);
             }
         } catch (Exception ex) {
             logger.error("Exception in traverseAAIVnf", ex);
@@ -90,10 +94,12 @@ public class VnfEBBLoader {
             org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI =
                     bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
             ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
-            resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+            Resource serviceResource =
+                    new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
+            resourceList.add(serviceResource);
             if (serviceInstanceMSO.getVnfs() != null) {
                 findVnfWithGivenIdAndAddCustomizationUUID(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList,
-                        execution);
+                        serviceResource, execution);
             }
         } catch (Exception ex) {
             logger.error("Exception in customTraverseAAIVnf", ex);
@@ -104,34 +110,38 @@ public class VnfEBBLoader {
     }
 
     private void findVnfWithGivenId(ServiceInstance serviceInstanceMSO, String vnfId,
-            List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, DelegateExecution execution) {
+            List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource serviceResource,
+            DelegateExecution execution) {
         for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
             if (vnf.getVnfId().equals(vnfId)) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
-                resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
-                processVfModules(vnf, aaiResourceIds, resourceList, execution);
-                processVolumeGroups(vnf, aaiResourceIds, resourceList);
+                Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource);
+                resourceList.add(vnfResource);
+                processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution);
+                processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource);
                 break;
             }
         }
     }
 
     private void findVnfWithGivenIdAndAddCustomizationUUID(ServiceInstance serviceInstanceMSO, String vnfId,
-            List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, DelegateExecution execution) {
+            List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource serviceResource,
+            DelegateExecution execution) {
         for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
             if (vnf.getVnfId().equals(vnfId)) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
-                resourceList.add(new Resource(WorkflowType.VNF,
-                        bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false));
-                processVfModules(vnf, aaiResourceIds, resourceList, execution);
-                processVolumeGroups(vnf, aaiResourceIds, resourceList);
+                Resource vnfResource = new Resource(WorkflowType.VNF,
+                        bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false, serviceResource);
+                resourceList.add(vnfResource);
+                processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution);
+                processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource);
                 break;
             }
         }
     }
 
     private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId,
-            List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) {
+            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(
@@ -140,7 +150,7 @@ public class VnfEBBLoader {
             relationshipsOp = vfModuleWrapper.getRelationships();
             if (relationshipsOp.isPresent()) {
                 relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get());
-                addConfigToResources(relationshipsOp, resourceList, aaiResourceIds);
+                addConfigToResources(relationshipsOp, resourceList, vfModuleResource, aaiResourceIds);
             }
         } catch (Exception ex) {
             logger.error("Exception in findConfigurationsInsideVfModule", ex);
@@ -149,35 +159,39 @@ public class VnfEBBLoader {
     }
 
     private void processVfModules(GenericVnf vnf, List<Pair<WorkflowType, String>> aaiResourceIds,
-            List<Resource> resourceList, DelegateExecution execution) {
+            List<Resource> resourceList, Resource vnfResource, DelegateExecution execution) {
         if (vnf.getVfModules() != null) {
             for (VfModule vfModule : vnf.getVfModules()) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
-                resourceList.add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
+                Resource vfModuleResource =
+                        new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource);
+                resourceList.add(vfModuleResource);
                 findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceList,
-                        aaiResourceIds);
+                        vfModuleResource, aaiResourceIds);
             }
         }
     }
 
     private void processVolumeGroups(GenericVnf vnf, List<Pair<WorkflowType, String>> aaiResourceIds,
-            List<Resource> resourceList) {
+            List<Resource> resourceList, Resource vnfResource) {
         if (vnf.getVolumeGroups() != null) {
             for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
-                resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
+                resourceList.add(
+                        new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false, vnfResource));
             }
         }
     }
 
     private void addConfigToResources(Optional<Relationships> relationshipsOp, List<Resource> resourceList,
-            List<Pair<WorkflowType, String>> aaiResourceIds) {
+            Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) {
         if (relationshipsOp.isPresent()) {
             Optional<Configuration> config =
                     workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
             if (config.isPresent()) {
                 aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
-                resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
+                resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false,
+                        vfModuleResource));
             }
         }
     }
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasksTest.java
new file mode 100644 (file)
index 0000000..f2687ef
--- /dev/null
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Modifications Copyright (c) 2021 Nokia
+ * ================================================================================
+ * 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.aai.tasks;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.Optional;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+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.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAICommonTasksTest {
+
+    private static final String SERVICE_TYPE = "testService";
+
+    @Mock
+    private ExtractPojosForBB extractPojosForBBMock;
+    @Mock
+    private ExceptionBuilder exceptionBuilder;
+    @InjectMocks
+    private AAICommonTasks testedObject;
+
+    private ServiceInstance serviceInstance;
+    private BuildingBlockExecution buildingBlockExecution;
+
+    @Before
+    public void setup() {
+        serviceInstance = new ServiceInstance();
+        buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake());
+    }
+
+    @Test
+    public void getServiceType_success() throws Exception {
+        // given
+        ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+        modelInfoServiceInstance.setServiceType(SERVICE_TYPE);
+        serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+        when(extractPojosForBBMock.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID))
+                .thenReturn(serviceInstance);
+        // when
+        Optional<String> resultOpt = testedObject.getServiceType(buildingBlockExecution);
+        // then
+        assertThat(resultOpt).isNotEmpty();
+        String result = resultOpt.get();
+        assertThat(result).isEqualTo(SERVICE_TYPE);
+    }
+
+    @Test
+    public void getServiceType_emptyWhenServiceInstanceModelIsNull() throws Exception {
+        // given
+        when(extractPojosForBBMock.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID))
+                .thenReturn(serviceInstance);
+        // when
+        Optional<String> result = testedObject.getServiceType(buildingBlockExecution);
+        // then
+        assertThat(result).isEmpty();
+    }
+
+    @Test
+    public void getServiceType_exceptionHandling() throws Exception {
+        // given
+        BBObjectNotFoundException exception = new BBObjectNotFoundException();
+        when(extractPojosForBBMock.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID))
+                .thenThrow(exception);
+        // when
+        testedObject.getServiceType(buildingBlockExecution);
+        // then
+        verify(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000, exception);
+    }
+}
index cfaa404..fb15ffa 100644 (file)
 package org.onap.so.bpmn.infrastructure.service.level;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 import java.util.ArrayList;
+import java.util.List;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
 import org.junit.Test;
-import java.util.List;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
+import org.onap.so.client.exception.ExceptionBuilder;
 
+@RunWith(MockitoJUnitRunner.class)
 public class ServiceLevelTest {
 
     private static final String EXECUTION_KEY_PNF_NAME_LIST = "pnfNameList";
     private static final String EXECUTION_KEY_PNF_COUNTER = "pnfCounter";
+    private static final String PARAM_NAME = "param1";
+    private static final String SCOPE = "scope1";
+    private static final String PNF_NAME = "pnfName1";
+
+    @Mock
+    private ExceptionBuilder exceptionBuilderMock;
+    @InjectMocks
+    private ServiceLevel testedObject;
+
+    private DelegateExecution execution;
+
+    @Before
+    public void init() {
+        execution = new DelegateExecutionFake();
+    }
 
     @Test
     public void pnfCounterExecution_success() {
         // given
-        String pnfName = "pnfName1";
-        DelegateExecution execution = new DelegateExecutionFake();
-        execution.setVariable(EXECUTION_KEY_PNF_NAME_LIST, createPnfNameList(pnfName));
+        execution.setVariable(EXECUTION_KEY_PNF_NAME_LIST, createPnfNameList());
         execution.setVariable(EXECUTION_KEY_PNF_COUNTER, 0);
         // when
-        new ServiceLevel().pnfCounterExecution(execution);
+        testedObject.pnfCounterExecution(execution);
         // then
-        assertThat(execution.getVariable(ServiceLevelConstants.PNF_NAME)).isEqualTo(pnfName);
+        assertThat(execution.getVariable(ServiceLevelConstants.PNF_NAME)).isEqualTo(PNF_NAME);
         assertThat(execution.getVariable(EXECUTION_KEY_PNF_COUNTER)).isEqualTo(1);
     }
 
-    private List<String> createPnfNameList(String pnfName) {
+    @Test
+    public void validateParams_success_paramExistsInExecution() {
+        // given
+        execution.setVariable(PARAM_NAME, "anyValue");
+        // when
+        testedObject.validateParamsWithScope(execution, "anyScope", createParamList());
+        // then
+        verify(exceptionBuilderMock, times(0)).buildAndThrowWorkflowException(any(DelegateExecution.class),
+                eq(ServiceLevelConstants.ERROR_CODE), any(String.class));
+    }
+
+    @Test
+    public void validateParams_exceptionParamDoesNotExistInExecution() {
+        // when
+        testedObject.validateParamsWithScope(execution, SCOPE, createParamList());
+        // then
+        verify(exceptionBuilderMock).buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
+                "Validation of health check workflow parameters failed for the scope: " + SCOPE);
+    }
+
+    private List<String> createParamList() {
+        List<String> params = new ArrayList<>();
+        params.add(PARAM_NAME);
+        return params;
+    }
+
+    private List<String> createPnfNameList() {
         List<String> pnfNameList = new ArrayList<>();
-        pnfNameList.add(pnfName);
+        pnfNameList.add(PNF_NAME);
         return pnfNameList;
     }
 }
index fae2317..61b5740 100644 (file)
@@ -10,6 +10,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2020 Tech Mahindra
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -29,8 +31,10 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
 import org.junit.Test;
 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.macro.OrchestrationFlow;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -40,43 +44,6 @@ public class ExecuteBuildingBlockBuilderTest {
 
     final private ExecuteBuildingBlockBuilder executeBBBuilder = new ExecuteBuildingBlockBuilder();
 
-    @Test
-    public void sortVfModulesByBaseFirstTest() {
-        List<Resource> resources = new ArrayList<>();
-        Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false);
-        resource1.setBaseVfModule(false);
-        resources.add(resource1);
-        Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false);
-        resource2.setBaseVfModule(false);
-        resources.add(resource2);
-        Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false);
-        resource3.setBaseVfModule(true);
-        resources.add(resource3);
-
-        List<Resource> result = executeBBBuilder.sortVfModulesByBaseFirst(resources);
-        assertEquals("333", result.get(0).getResourceId());
-        assertEquals("222", result.get(1).getResourceId());
-        assertEquals("111", result.get(2).getResourceId());
-    }
-
-    @Test
-    public void sortVfModulesByBaseLastTest() {
-        List<Resource> resources = new ArrayList<>();
-        Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false);
-        resource1.setBaseVfModule(true);
-        resources.add(resource1);
-        Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false);
-        resource2.setBaseVfModule(false);
-        resources.add(resource2);
-        Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false);
-        resource3.setBaseVfModule(false);
-        resources.add(resource3);
-        List<Resource> result = executeBBBuilder.sortVfModulesByBaseLast(resources);
-        assertEquals("333", result.get(0).getResourceId());
-        assertEquals("222", result.get(1).getResourceId());
-        assertEquals("111", result.get(2).getResourceId());
-    }
-
     @Test
     public void verifyLackOfNullPointerExceptionForNullResource() {
         ExecuteBuildingBlock result = null;
@@ -96,7 +63,7 @@ public class ExecuteBuildingBlockBuilderTest {
         String cvnfModuleCustomizationId = "2b1a3c";
         String vnfCustomizationId = "zz12aa";
 
-        Resource resource = new Resource(WorkflowType.SERVICE, "123", true);
+        Resource resource = new Resource(WorkflowType.SERVICE, "123", true, null);
 
         resource.setCvnfModuleCustomizationId(vfModuleCustomizationId);
         resource.setCvnfModuleCustomizationId(cvnfModuleCustomizationId);
@@ -110,4 +77,170 @@ public class ExecuteBuildingBlockBuilderTest {
         assertEquals(vnfCustomizationId, confResourceKeys.getVnfResourceCustomizationUUID());
 
     }
+
+    private Resource getResource(List<Resource> resources, ExecuteBuildingBlock block) {
+        Resource res =
+                resources.stream().filter(resource -> resource.getResourceId() == block.getBuildingBlock().getKey())
+                        .findAny().orElse(null);
+        return res;
+    }
+
+    private void buildExecuteBuildingBlockListOrderOfVnf(int vnfCount, boolean addPnf, boolean priorities) {
+        WorkflowResourceIds wfIds = new WorkflowResourceIds();
+        wfIds.setServiceInstanceId("1");
+        List<Resource> resources = new ArrayList<>();
+        Resource r1 = new Resource(WorkflowType.SERVICE, "1", false, null);
+        resources.add(r1);
+        for (int i = 0; i < vnfCount; i++) {
+            Resource r2 = new Resource(WorkflowType.VNF, Integer.toString(2 + i * 3), false, r1);
+            Resource r3 = new Resource(WorkflowType.VFMODULE, Integer.toString(3 + i * 3), false, r2);
+            Resource r4 = new Resource(WorkflowType.VFMODULE, Integer.toString(4 + i * 3), false, r2);
+            r4.setBaseVfModule(true);
+            resources.add(r2);
+            resources.add(r3);
+            resources.add(r4);
+            if (priorities) {
+                r2.setProcessingPriority(vnfCount - i);
+                r3.setProcessingPriority(1);
+                r4.setProcessingPriority(2);
+            }
+        }
+        if (addPnf) {
+            Resource r5 = new Resource(WorkflowType.PNF, Integer.toString(5 + (vnfCount - 1) * 3), false, r1);
+            resources.add(r5);
+        }
+
+        OrchestrationFlow f1 = new OrchestrationFlow();
+        f1.setFlowName("AssignServiceInstanceBB");
+        OrchestrationFlow f2 = new OrchestrationFlow();
+        f2.setFlowName("AssignVnfBB");
+        OrchestrationFlow f3 = new OrchestrationFlow();
+        f3.setFlowName("AssignVfModuleBB");
+        OrchestrationFlow f4 = new OrchestrationFlow();
+        f4.setFlowName("ControllerExecutionBB");
+        f4.setBpmnAction("config-assign");
+        f4.setBpmnScope("vnf");
+        OrchestrationFlow f5 = new OrchestrationFlow();
+        f5.setFlowName("AssignPnfBB");
+        OrchestrationFlow f6 = new OrchestrationFlow();
+        f6.setFlowName("WaitForPnfReadyBB");
+        OrchestrationFlow f7 = new OrchestrationFlow();
+        f7.setFlowName("ControllerExecutionBB");
+        f7.setBpmnAction("config-assign");
+        f7.setBpmnScope("pnf");
+        OrchestrationFlow f8 = new OrchestrationFlow();
+        f8.setFlowName("ControllerExecutionBB");
+        f8.setBpmnAction("config-deploy");
+        f8.setBpmnScope("pnf");
+        OrchestrationFlow f9 = new OrchestrationFlow();
+        f9.setFlowName("ActivatePnfBB");
+        OrchestrationFlow f10 = new OrchestrationFlow();
+        f10.setFlowName("CreateVfModuleBB");
+        OrchestrationFlow f11 = new OrchestrationFlow();
+        f11.setFlowName("ActivateVfModuleBB");
+        OrchestrationFlow f12 = new OrchestrationFlow();
+        f12.setFlowName("ControllerExecutionBB");
+        f12.setBpmnAction("config-deploy");
+        f12.setBpmnScope("vnf");
+        OrchestrationFlow f13 = new OrchestrationFlow();
+        f13.setFlowName("ActivateVnfBB");
+        OrchestrationFlow f14 = new OrchestrationFlow();
+        f14.setFlowName("ActivateServiceInstanceBB");
+
+        List<OrchestrationFlow> flows = Arrays.asList(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14);
+        for (int i = 0; i < flows.size(); i++) {
+            OrchestrationFlow flow = flows.get(i);
+            flow.setId(i + 1);
+            flow.setSequenceNumber(i + 1);
+            flow.setFlowVersion(1.0);
+            flow.setAction("Service-Macro-Create");
+        }
+
+        List<ExecuteBuildingBlock> flowsToExecute = executeBBBuilder.buildExecuteBuildingBlockList(flows, resources,
+                "1", "1", "1", WorkflowActionConstants.CREATE_INSTANCE, "type", wfIds, null, false);
+
+        for (ExecuteBuildingBlock block : flowsToExecute) {
+            String name = block.getBuildingBlock().getBpmnFlowName();
+            if (name.equals("ControllerExecutionBB"))
+                name += " [" + block.getBuildingBlock().getBpmnScope() + ", " + block.getBuildingBlock().getBpmnAction()
+                        + "]";
+            System.out.println(name);
+        }
+        assertNotNull(flowsToExecute);
+        assertEquals((addPnf ? 7 : 2) + vnfCount * 4L + vnfCount * 2L * 3, flowsToExecute.size());
+
+        for (ExecuteBuildingBlock block : flowsToExecute)
+            assertNotNull(getResource(resources, block));
+
+        if (priorities) {
+            if (vnfCount > 1)
+                assertEquals("5", getResource(resources, flowsToExecute.get(1)).getResourceId());
+            else
+                assertEquals("3", getResource(resources, flowsToExecute.get(2)).getResourceId());
+        } else {
+            if (vnfCount > 1)
+                assertEquals("2", getResource(resources, flowsToExecute.get(1)).getResourceId());
+            else
+                assertEquals("4", getResource(resources, flowsToExecute.get(2)).getResourceId());
+        }
+
+        // AssignVfModuleBB
+        assertEquals(f3.getFlowName(), flowsToExecute.get(2).getBuildingBlock().getBpmnFlowName());
+        // ControllerExecutionBB
+        assertEquals(f4.getFlowName(), flowsToExecute.get(4).getBuildingBlock().getBpmnFlowName());
+        if (vnfCount > 1) {
+            // AssignVnfBB
+            if (addPnf)
+                assertEquals(f2.getFlowName(), flowsToExecute.get(5).getBuildingBlock().getBpmnFlowName());
+            else
+                assertEquals(f2.getFlowName(), flowsToExecute.get(11).getBuildingBlock().getBpmnFlowName());
+        }
+        int pnfOffset = -5;
+        if (addPnf) {
+            pnfOffset = (vnfCount - 1) * 4;
+            // AssignPnfBB
+            assertEquals(f5.getFlowName(), flowsToExecute.get(5 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+            // WaitForPnfReadyBB
+            assertEquals(f6.getFlowName(), flowsToExecute.get(6 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+            // ControllerExecutionBB
+            assertEquals(f7.getFlowName(), flowsToExecute.get(7 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+            // ControllerExecutionBB
+            assertEquals(f8.getFlowName(), flowsToExecute.get(8 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+            // ActivatePnfBB
+            assertEquals(f9.getFlowName(), flowsToExecute.get(9 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+        }
+        // CreateVfModuleBB
+        assertEquals(f10.getFlowName(), flowsToExecute.get(10 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+        // ActivateVfModuleBB
+        assertEquals(f11.getFlowName(), flowsToExecute.get(11 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+        // ControllerExecutionBB
+        assertEquals(f12.getFlowName(), flowsToExecute.get(14 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+        // ActivateVnfBB
+        assertEquals(f13.getFlowName(), flowsToExecute.get(15 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+    }
+
+    @Test
+    public void buildExecuteBuildingBlockListSortByBaseVfModuleTest() {
+        buildExecuteBuildingBlockListOrderOfVnf(1, false, false);
+    }
+
+    @Test
+    public void buildExecuteBuildingBlockListSortByPriorityTest() {
+        buildExecuteBuildingBlockListOrderOfVnf(1, false, true);
+    }
+
+    @Test
+    public void buildExecuteBuildingBlockListGroupByResourceTypeAndSortByPriorityTest() {
+        buildExecuteBuildingBlockListOrderOfVnf(2, false, true);
+    }
+
+    @Test
+    public void buildExecuteBuildingBlockListGroupByResourceTypeTest() {
+        buildExecuteBuildingBlockListOrderOfVnf(2, false, false);
+    }
+
+    @Test
+    public void buildExecuteBuildingBlockListGroupByResourceTypeVnfAndPnfTest() {
+        buildExecuteBuildingBlockListOrderOfVnf(2, true, false);
+    }
 }
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java
new file mode 100644 (file)
index 0000000..cd98792
--- /dev/null
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
+ * 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.workflow.tasks;
+
+import static org.junit.Assert.assertEquals;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.Test;
+
+public class ResourceTest {
+
+    @Test
+    public void testBaseFirstComparator() {
+        Resource r1 = new Resource(null, "1", false, null);
+        Resource r2 = new Resource(null, "2", false, null);
+        r2.setBaseVfModule(true);
+
+        List<Resource> sorted =
+                Arrays.asList(r1, r2).stream().sorted(Resource.sortByPriorityAsc).collect(Collectors.toList());
+
+        assertEquals("2", sorted.get(0).getResourceId());
+    }
+
+    @Test
+    public void testPriorityAscComparator() {
+        Resource r1 = new Resource(null, "1", false, null);
+        Resource r2 = new Resource(null, "2", false, null);
+        Resource r3 = new Resource(null, "3", false, null);
+        Resource r4 = new Resource(null, "4", false, null);
+        r1.setProcessingPriority(4);
+        r2.setBaseVfModule(true);
+        r3.setProcessingPriority(2);
+        r4.setProcessingPriority(1);
+
+        List<Resource> sorted =
+                Arrays.asList(r1, r2, r3, r4).stream().sorted(Resource.sortByPriorityAsc).collect(Collectors.toList());
+
+        assertEquals("2", sorted.get(0).getResourceId());
+        assertEquals("4", sorted.get(1).getResourceId());
+        assertEquals("3", sorted.get(2).getResourceId());
+    }
+
+    @Test
+    public void testBaseLastComparator() {
+        Resource r1 = new Resource(null, "1", false, null);
+        Resource r2 = new Resource(null, "2", false, null);
+        r1.setBaseVfModule(true);
+
+        List<Resource> sorted =
+                Arrays.asList(r1, r2).stream().sorted(Resource.sortByPriorityDesc).collect(Collectors.toList());
+
+        assertEquals("1", sorted.get(1).getResourceId());
+    }
+
+    @Test
+    public void testPriorityDescComparator() {
+        Resource r1 = new Resource(null, "1", false, null);
+        Resource r2 = new Resource(null, "2", false, null);
+        Resource r3 = new Resource(null, "3", false, null);
+        Resource r4 = new Resource(null, "4", false, null);
+        r1.setProcessingPriority(4);
+        r2.setBaseVfModule(true);
+        r3.setProcessingPriority(2);
+        r4.setProcessingPriority(1);
+
+        List<Resource> sorted =
+                Arrays.asList(r1, r2, r3, r4).stream().sorted(Resource.sortByPriorityDesc).collect(Collectors.toList());
+
+        assertEquals("1", sorted.get(0).getResourceId());
+        assertEquals("3", sorted.get(1).getResourceId());
+        assertEquals("4", sorted.get(2).getResourceId());
+    }
+
+    @Test
+    public void testPriorityReplaceBase() {
+        Resource r1 = new Resource(null, "1", false, null);
+        Resource r2 = new Resource(null, "2", false, null);
+        Resource r3 = new Resource(null, "3", false, null);
+        Resource r4 = new Resource(null, "4", false, null);
+        r1.setProcessingPriority(4);
+        r2.setBaseVfModule(true);
+        r2.setProcessingPriority(6);
+        r3.setProcessingPriority(2);
+        r4.setProcessingPriority(1);
+
+        List<Resource> sorted =
+                Arrays.asList(r1, r2, r3, r4).stream().sorted(Resource.sortByPriorityAsc).collect(Collectors.toList());
+
+        assertEquals("4", sorted.get(0).getResourceId());
+        assertEquals("3", sorted.get(1).getResourceId());
+        assertEquals("1", sorted.get(2).getResourceId());
+    }
+
+}
index 10e6ed4..e52d2df 100644 (file)
@@ -8,6 +8,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2020 Nokia
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -115,6 +117,7 @@ public class WorkflowActionTest extends BaseTaskTest {
             "VfModuleReplaceRebuildVolumeGroups.json";
     private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
     private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
+    private static final String MACRO_CREATE_JSON = "Macro/ServiceMacroAssignVnfAndPnf.json";
 
     @Mock
     protected Environment environment;
@@ -298,7 +301,7 @@ public class WorkflowActionTest extends BaseTaskTest {
         vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
 
         when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
-                .thenReturn(prepareListWithResources());
+                .thenReturn(prepareListWithResources(false, false));
         when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
                 false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
         when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"))
@@ -349,7 +352,7 @@ public class WorkflowActionTest extends BaseTaskTest {
         vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
 
         when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
-                .thenReturn(prepareListWithResources());
+                .thenReturn(prepareListWithResources(false, false));
         when(environment.getProperty("org.onap.so.cloud-owner")).thenReturn("att-aic");
         when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
                 false, "att-aic")).thenReturn(northBoundRequest);
@@ -406,13 +409,13 @@ public class WorkflowActionTest extends BaseTaskTest {
         workflowAction.selectExecutionList(execution);
         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
         assertEqualsBulkFlowName(ebbs, "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
-                "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
+                "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
                 "ActivateServiceInstanceBB");
         assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
         assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
         assertEquals("testVfModuleId1", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
-        assertEquals("testVfModuleId2", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
-        assertEquals("testVfModuleId1", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
+        assertEquals("testVfModuleId1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
+        assertEquals("testVfModuleId2", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
         assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
         assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
         assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
@@ -624,7 +627,7 @@ public class WorkflowActionTest extends BaseTaskTest {
         vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
 
         when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
-                .thenReturn(prepareListWithResources());
+                .thenReturn(prepareListWithResources(false, false));
         when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
                 false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
         when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"))
@@ -638,8 +641,8 @@ public class WorkflowActionTest extends BaseTaskTest {
         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
         assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
                 "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "CreateVolumeGroupBB",
-                "ActivateVolumeGroupBB", "CreateVfModuleBB", "CreateVfModuleBB", "CreateVfModuleBB",
-                "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
+                "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB",
+                "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
                 "ActivateServiceInstanceBB");
 
         assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
@@ -662,6 +665,92 @@ public class WorkflowActionTest extends BaseTaskTest {
         assertEquals(true, execution.getVariable("homing"));
     }
 
+    @Test
+    public void selectExecutionListServiceMacroCreateWithUserParamsAndPriorities() throws Exception {
+        String gAction = "createInstance";
+        String resource = "Service";
+        String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_JSON);
+        initExecution(gAction, bpmnRequest, false);
+        execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+        NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+        List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+                "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignPnfBB",
+                "WaitForPnfReadyBB", "ActivatePnfBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB",
+                "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB",
+                "ActivateFabricConfigurationBB", "ActivateVnfBB", "ActivateNetworkCollectionBB",
+                "ActivateServiceInstanceBB");
+        northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+        Service service = new Service();
+        service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+
+        VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+        vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
+        HeatEnvironment volumeHeatEnv = new HeatEnvironment();
+        vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv);
+        org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+        HeatTemplate volumeHeatTemplate = new HeatTemplate();
+        vfModule.setVolumeHeatTemplate(volumeHeatTemplate);
+        vfModuleCustomization.setVfModule(vfModule);
+
+        VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
+        vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
+        HeatEnvironment heatEnvironment = new HeatEnvironment();
+        vfModuleCustomization2.setHeatEnvironment(heatEnvironment);
+        org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
+        HeatTemplate moduleHeatTemplate = new HeatTemplate();
+        vfModule2.setModuleHeatTemplate(moduleHeatTemplate);
+        vfModuleCustomization2.setVfModule(vfModule2);
+
+        VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2;
+        vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
+
+        when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
+                .thenReturn(prepareListWithResources(true, true));
+        when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+                false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+        when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"))
+                .thenReturn(vfModuleCustomization);
+        when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"))
+                .thenReturn(vfModuleCustomization2);
+        when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969"))
+                .thenReturn(vfModuleCustomization3);
+        when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+        workflowAction.selectExecutionList(execution);
+        List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+        assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
+                "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignPnfBB", "WaitForPnfReadyBB",
+                "ActivatePnfBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+                "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB",
+                "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
+
+        assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+        int randomUUIDLength = UUID.randomUUID().toString().length();
+        assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
+        assertEquals(randomUUIDLength, ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
+        assertEquals(randomUUIDLength, ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals("72d9d1cd-f46d-447a-abdb-451d6fb05fa8", ebbs.get(3).getBuildingBlock().getKey());
+        assertEquals("da4d4327-fb7d-4311-ac7a-be7ba60cf969", ebbs.get(4).getBuildingBlock().getKey());
+        assertEquals("3c40d244-808e-42ca-b09a-256d83d19d0a", ebbs.get(5).getBuildingBlock().getKey());
+        assertEquals(randomUUIDLength, ebbs.get(6).getWorkflowResourceIds().getPnfId().length());
+        assertEquals(randomUUIDLength, ebbs.get(7).getWorkflowResourceIds().getPnfId().length());
+        assertEquals(randomUUIDLength, ebbs.get(8).getWorkflowResourceIds().getPnfId().length());
+        assertEquals(randomUUIDLength, ebbs.get(9).getWorkflowResourceIds().getVolumeGroupId().length());
+        assertEquals(randomUUIDLength, ebbs.get(10).getWorkflowResourceIds().getVolumeGroupId().length());
+        assertEquals(randomUUIDLength, ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(14).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(15).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(16).getWorkflowResourceIds().getVfModuleId().length());
+        assertEquals(randomUUIDLength, ebbs.get(17).getWorkflowResourceIds().getVnfId().length());
+        assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+        assertEquals(true, execution.getVariable("homing"));
+    }
+
     @Test
     public void selectExecutionListServiceMacroDeleteTest() throws Exception {
         String gAction = "deleteInstance";
@@ -708,7 +797,7 @@ public class WorkflowActionTest extends BaseTaskTest {
                 false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
         workflowAction.selectExecutionList(execution);
         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
-        assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
+        assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVfModuleBB",
                 "DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB",
                 "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB",
                 "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
@@ -879,8 +968,8 @@ public class WorkflowActionTest extends BaseTaskTest {
         workflowAction.selectExecutionList(execution);
         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
         assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateVfModuleBB",
-                "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB",
-                "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB",
+                "DeleteVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB",
+                "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB",
                 "AAIUnsetVnfInMaintBB");
     }
 
@@ -940,12 +1029,13 @@ public class WorkflowActionTest extends BaseTaskTest {
                 false, "cloud-owner")).thenReturn(northBoundRequest);
         workflowAction.selectExecutionList(execution);
         List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
-        assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateFabricConfigurationBB",
-                "UnassignFabricConfigurationBB", "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
-                "DeleteVfModuleBB", "DeactivateVnfBB", "ChangeModelVfModuleBB", "ChangeModelVfModuleBB",
-                "CreateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB",
-                "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB",
-                "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
+        assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateVfModuleBB",
+                "DeleteVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB",
+                "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "ChangeModelVfModuleBB",
+                "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVfModuleBB", "CreateVfModuleBB",
+                "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB",
+                "ChangeModelVnfBB", "ActivateVnfBB", "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB",
+                "AAIUnsetVnfInMaintBB");
         for (ExecuteBuildingBlock executeBuildingBlock : ebbs) {
             assertEquals("123", executeBuildingBlock.getWorkflowResourceIds().getServiceInstanceId());
         }
@@ -1540,7 +1630,7 @@ public class WorkflowActionTest extends BaseTaskTest {
         String vnfType = "vnfType";
         String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
         String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
-        Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+        Resource resourceKey = new Resource(resourceType, key, aLaCarte, null);
         WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
 
         thrown.expect(AAIEntityNotFoundException.class);
@@ -1592,7 +1682,7 @@ public class WorkflowActionTest extends BaseTaskTest {
         String vnfType = "vnfType";
         String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
         String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
-        Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+        Resource resourceKey = new Resource(resourceType, key, aLaCarte, null);
         WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
 
         List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
@@ -1667,7 +1757,7 @@ public class WorkflowActionTest extends BaseTaskTest {
         String vnfType = "vnfType";
         String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
         String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
-        Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+        Resource resourceKey = new Resource(resourceType, key, aLaCarte, null);
         WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
 
         List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
@@ -1948,10 +2038,10 @@ public class WorkflowActionTest extends BaseTaskTest {
         String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction";
         String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace";
         String uri8 = "/v6/serviceInstances/123/vnfs/1234/vfModules/scaleOut";
-        Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true);
-        Resource expected2 = new Resource(WorkflowType.VNF, "1234", false);
-        Resource expected3 = new Resource(WorkflowType.VNF, "1234", false);
-        Resource expected4 = new Resource(WorkflowType.VFMODULE, "5678", false);
+        Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true, null);
+        Resource expected2 = new Resource(WorkflowType.VNF, "1234", false, expected1);
+        Resource expected3 = new Resource(WorkflowType.VNF, "1234", false, expected1);
+        Resource expected4 = new Resource(WorkflowType.VFMODULE, "5678", false, expected2);
         Resource result = workflowAction.extractResourceIdAndTypeFromUri(uri);
         assertEquals(expected1.getResourceId(), result.getResourceId());
         assertEquals(expected1.getResourceType(), result.getResourceType());
@@ -2091,14 +2181,31 @@ public class WorkflowActionTest extends BaseTaskTest {
         return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName)));
     }
 
-    private List<Resource> prepareListWithResources() {
+    private List<Resource> prepareListWithResources(boolean addPnf, boolean addPriorites) {
         List<Resource> resourceList = new ArrayList<>();
-        resourceList.add(new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
-        resourceList.add(new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false));
-        resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false));
-        resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
-        resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
-        resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
+        Resource r1 = new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, null);
+        resourceList.add(r1);
+        Resource r2 = new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false, r1);
+        resourceList.add(r2);
+        Resource r3 = new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false, r2);
+        resourceList.add(r3);
+        Resource r4 = new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false, r2);
+        resourceList.add(r4);
+        Resource r5 = new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, r2);
+        resourceList.add(r5);
+        Resource r6 = new Resource(WorkflowType.VFMODULE, "da4d4327-fb7d-4311-ac7a-be7ba60cf969", false, r2);
+        resourceList.add(r6);
+        if (addPnf) {
+            Resource r7 = new Resource(WorkflowType.PNF, "aa153b6e-c364-44c0-bef6-1f2982117f04", false, r1);
+            resourceList.add(r7);
+        }
+        if (addPriorites) {
+            r3.setProcessingPriority(2);
+            r4.setProcessingPriority(1);
+            r5.setProcessingPriority(4);
+            r5.setBaseVfModule(true);
+            r6.setProcessingPriority(3);
+        }
         return resourceList;
     }
 }
index a5ecf36..7a26422 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (c) 2020 Nokia
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -171,10 +173,10 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
     @Test
     public void foundRelatedTest() {
         List<Resource> resourceList = new ArrayList<>();
-        resourceList.add(new Resource(WorkflowType.PNF, "model customization id", false));
-        resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false));
-        resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
-        resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
+        resourceList.add(new Resource(WorkflowType.PNF, "model customization id", false, null));
+        resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false, null));
+        resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false, null));
+        resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false, null));
 
         assertTrue(serviceEBBLoader.foundRelated(resourceList));
     }
@@ -182,10 +184,10 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
     @Test
     public void containsWorkflowTypeTest() {
         List<Resource> resourceList = new ArrayList<>();
-        resourceList.add(new Resource(WorkflowType.PNF, "resource id", false));
-        resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false));
-        resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
-        resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
+        resourceList.add(new Resource(WorkflowType.PNF, "resource id", false, null));
+        resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false, null));
+        resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false, null));
+        resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false, null));
 
         assertTrue(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.PNF));
         assertTrue(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.VNF));
@@ -280,7 +282,8 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
 
         doReturn(aaiLocalNetwork).when(mockBbInputSetupUtils).getAAIL3Network("localNetworkInstanceId");
 
-        serviceEBBLoader.traverseVrfConfiguration(aaiResourceIds, resource, service, relatedVpnBinding,
+        Resource serviceResource = new Resource(WorkflowType.SERVICE, "1", false, null);
+        serviceEBBLoader.traverseVrfConfiguration(aaiResourceIds, resource, serviceResource, service, relatedVpnBinding,
                 relatedLocalNetwork);
         assertEquals(resource.size(), 1);
         assertEquals(aaiResourceIds.size(), 0);
@@ -346,12 +349,14 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
 
     private List<Resource> prepareListWithResources() {
         List<Resource> resourceList = new ArrayList<>();
-        resourceList.add(new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
-        resourceList.add(new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false));
-        resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false));
-        resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
-        resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
-        resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
+        Resource r1 = new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, null);
+        resourceList.add(r1);
+        Resource r2 = new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false, r1);
+        resourceList.add(r2);
+        resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false, r2));
+        resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false, r2));
+        resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, r2));
+        resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false, r2));
         return resourceList;
     }
 }
index 9f4bd97..58fee86 100644 (file)
@@ -59,6 +59,7 @@ import static org.mockito.Mockito.mock;
 public class UserParamsServiceTraversalTest extends BaseTaskTest {
 
     private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json";
+    private static final String MACRO_CREATE_JSON = "Macro/ServiceMacroAssignVnfAndPnf.json";
     private static final String MACRO_ASSIGN_PNF_JSON = "Macro/ServiceMacroAssignPnf.json";
     private static final String NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
     private static final String MACRO_CREATE_WITHOUT_RESOURCES_JSON = "Macro/ServiceMacroCreateWithoutResources.json";
@@ -113,6 +114,26 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
         assertThat(expected, is(result));
     }
 
+    @Test
+    public void getResourceListFromUserParamsForVnfsWithPriorities() throws Exception {
+        initExecution(requestAction, readBpmnRequestFromFile(MACRO_CREATE_JSON), false);
+        Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
+                .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
+        Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
+                anyString(), anyString());
+
+        List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution,
+                getUserParams(), serviceInstanceId, requestAction);
+        List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.VNF, WorkflowType.VOLUMEGROUP,
+                WorkflowType.VFMODULE, WorkflowType.CONFIGURATION, WorkflowType.PNF);
+        List<WorkflowType> result =
+                resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList());
+
+        assertEquals(6, resourceListFromUserParams.size());
+        assertThat(expected, is(result));
+        assertEquals(2, resourceListFromUserParams.get(1).getChildren().get(1).getProcessingPriority());
+    }
+
     @Test
     public void getResourceListFromUserParamsForPnfs() throws Exception {
         initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_PNF_JSON), false);
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignVnfAndPnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignVnfAndPnf.json
new file mode 100644 (file)
index 0000000..5a2c963
--- /dev/null
@@ -0,0 +1,157 @@
+{
+  "requestDetails": {
+    "modelInfo": {
+      "modelType": "service",
+      "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+      "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+      "modelName": "Sample Service Model",
+      "modelVersion": "10.0"
+    },
+    "cloudConfiguration": {
+      "cloudOwner": "my-custom-cloud-owner"
+    },
+    "owningEntity": {
+      "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+      "owningEntityName": "PACKET CORE"
+    },
+    "project": {
+      "projectName": "{some project name}"
+    },
+    "subscriberInfo": {
+      "globalSubscriberId": "{some subscriber id}"
+    },
+    "requestInfo": {
+      "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+      "source": "VID",
+      "suppressRollback": true,
+      "requestorId": "xxxxxx",
+      "instanceName": "test"
+    },
+    "requestParameters": {
+      "subscriptionServiceType": "VMX",
+      "aLaCarte": false,
+      "userParams": [
+        {
+          "service": {
+            "modelInfo": {
+              "modelType": "service",
+              "modelName": "Sample Service Model",
+              "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
+            },
+            "instanceParams": [],
+            "resources": {
+              "pnfs": [
+                {
+                  "modelInfo": {
+                    "modelType": "pnf",
+                    "modelName": "2016-73_MOW-AVPN-vPE-BV-L-PNF",
+                    "modelVersionId": "1f40c192-f63c-463e-ba94-286933b895f8",
+                    "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L-PNF 0",
+                    "modelCustomizationId": "aa153b6e-c364-44c0-bef6-1f2982117f04"
+                  },
+                  "cloudConfiguration": {
+                    "lcpCloudRegionId": "mdt1",
+                    "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+                  },
+                  "platform": {
+                    "platformName": "test"
+                  },
+                  "lineOfBusiness": {
+                    "lineOfBusinessName": "someValue"
+                  },
+                  "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+                  "instanceParams": []
+                }
+              ],
+              "vnfs": [
+                {
+                  "modelInfo": {
+                    "modelType": "vnf",
+                    "modelName": "2016-73_MOW-AVPN-vPE-BV-L",
+                    "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8",
+                    "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0",
+                    "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+                  },
+                  "cloudConfiguration": {
+                    "lcpCloudRegionId": "mdt1",
+                    "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+                  },
+                  "platform": {
+                    "platformName": "test"
+                  },
+                  "lineOfBusiness": {
+                    "lineOfBusinessName": "someValue"
+                  },
+                  "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+                  "instanceParams": [],
+                  "processingPriority": 2,
+                  "vfModules": [
+                    {
+                      "modelInfo": {
+                        "modelType": "vfModule",
+                        "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0",
+                        "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79",
+                        "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
+                      },
+                      "processingPriority": 2,
+                      "instanceParams": [
+                        {
+                          "vmx_int_net_len": "24"
+                        }
+                      ]
+                    },
+                    {
+                      "modelInfo": {
+                        "modelType": "vfModule",
+                        "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
+                        "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
+                        "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
+                      },
+                      "processingPriority": 1,
+                      "instanceParams": [
+                        {
+                          "availability_zone_0": "mtpocdv-kvm-az01",
+                          "vre_a_volume_size_0": "100"
+                        }
+                      ]
+                    },
+                    {
+                      "modelInfo": {
+                        "modelType": "vfModule",
+                        "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-3",
+                        "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64",
+                        "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
+                      },
+                      "processingPriority": 4,
+                      "instanceParams": [
+                        {
+                          "availability_zone_0": "mtpocdv-kvm-az01",
+                          "vmx_vpfe_int_ip_0": "192.168.0.16"
+                        }
+                      ]
+                    },
+                    {
+                      "modelInfo": {
+                        "modelType": "vfModule",
+                        "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-2",
+                        "modelVersionId": "16e2b103-637c-4d1a-adc8-3a7f4a6c3240",
+                        "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
+                      },
+                      "processingPriority": 3,
+                      "instanceParams": [
+                        {
+                          "availability_zone_0": "mtpocdv-kvm-az01",
+                          "vre_a_volume_size_0": "50"
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          }
+        }
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/logback-test.xml b/bpmn/so-bpmn-tasks/src/test/resources/logback-test.xml
new file mode 100644 (file)
index 0000000..bb4aee6
--- /dev/null
@@ -0,0 +1,36 @@
+<!--
+  ============LICENSE_START=======================================================
+  ONAP - SO
+  ================================================================================
+  Copyright (C) 2021 Nordix Foundation.
+  ================================================================================
+  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.
+  
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.reflections" level="ERROR" />
+    <logger name="org.onap" level="DEBUG" />
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>
index dd296e8..a6e8a79 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>common</artifactId>
   <name>common</name>
@@ -15,6 +15,7 @@
     <protobuf.version>3.10.0</protobuf.version>
     <grpc.netty.version>4.1.30.Final</grpc.netty.version>
     <ccsdk.version>1.1.2</ccsdk.version>
+    <spring-cloud-sleuth.version>2.0.2.RELEASE</spring-cloud-sleuth.version>
   </properties>
   <dependencies>
     <dependency>
       <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.springframework.cloud</groupId>
+      <artifactId>spring-cloud-starter-sleuth</artifactId>
+    </dependency>
   </dependencies>
   <dependencyManagement>
     <dependencies>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
+      <dependency>
+        <groupId>org.springframework.cloud</groupId>
+        <artifactId>spring-cloud-sleuth</artifactId>
+        <version>${spring-cloud-sleuth.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
   <build>
diff --git a/common/src/main/java/org/onap/so/security/HttpHeaderForwarderConfig.java b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderConfig.java
new file mode 100644 (file)
index 0000000..6340b1c
--- /dev/null
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2021 Orange. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.security;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @author Sheel Bajpai (sheel.bajpai@orange.com)
+ *
+ */
+@Configuration
+@Profile("serviceMesh")
+class HttpHeaderForwarderConfig implements WebMvcConfigurer {
+    @Bean
+    public RestTemplate restTemplate() {
+        RestTemplate restTemplate = new RestTemplate();
+
+        List<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors();
+        if (CollectionUtils.isEmpty(interceptors))
+            interceptors = new ArrayList<>();
+
+        interceptors.add(new HttpHeaderForwarderRequestInterceptor());
+        restTemplate.setInterceptors(interceptors);
+        return restTemplate;
+    }
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(new HttpHeaderForwarderHandlerInterceptor());
+    }
+}
diff --git a/common/src/main/java/org/onap/so/security/HttpHeaderForwarderHandlerInterceptor.java b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderHandlerInterceptor.java
new file mode 100644 (file)
index 0000000..da01e5e
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2021 Orange. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.security;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Sheel Bajpai (sheel.bajpai@orange.com)
+ *
+ */
+
+public class HttpHeaderForwarderHandlerInterceptor extends HandlerInterceptorAdapter {
+
+    private static final ThreadLocal<Map<String, List<String>>> HEADERS_THREAD_LOCAL = new ThreadLocal<>();
+
+    private static final Set<String> FORWARDED_HEADER_NAMES = ImmutableSet.of("authorization", "x-request-id",
+            "x-b3-traceid", "x-b3-spanid", "x-b3-parentspanid", "x-b3-sampled", "x-b3-flags", "x-ot-span-context");
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
+            throws Exception {
+
+        Map<String, List<String>> headerMap = Collections.list(request.getHeaderNames()).stream()
+                .map(String::toLowerCase).filter(FORWARDED_HEADER_NAMES::contains)
+                .collect(Collectors.toMap(Function.identity(), h -> Collections.list(request.getHeaders(h))));
+
+        HEADERS_THREAD_LOCAL.set(headerMap);
+        return super.preHandle(request, response, handler);
+    }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
+            ModelAndView modelAndView) throws Exception {
+        HEADERS_THREAD_LOCAL.remove();
+    }
+
+    static Map<String, List<String>> getHeaders() {
+        return HEADERS_THREAD_LOCAL.get();
+    }
+
+}
diff --git a/common/src/main/java/org/onap/so/security/HttpHeaderForwarderRequestInterceptor.java b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderRequestInterceptor.java
new file mode 100644 (file)
index 0000000..18a3f3d
--- /dev/null
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2021 Orange. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.security;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpRequestExecution;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
+
+/**
+ * @author Sheel Bajpai (sheel.bajpai@orange.com)
+ *
+ */
+
+public class HttpHeaderForwarderRequestInterceptor implements ClientHttpRequestInterceptor {
+
+    @Override
+    public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
+            throws IOException {
+
+        Map<String, List<String>> headerMap = HttpHeaderForwarderHandlerInterceptor.getHeaders();
+        if (headerMap != null && !headerMap.isEmpty())
+            request.getHeaders().putAll(HttpHeaderForwarderHandlerInterceptor.getHeaders());
+        return execution.execute(request, body);
+    }
+
+}
index b3e4842..4a112b9 100644 (file)
@@ -34,7 +34,7 @@ import org.springframework.security.web.firewall.StrictHttpFirewall;
 @EnableWebSecurity
 @Configuration
 @Order(2)
-@Profile({"aaf", "test"})
+@Profile({"aaf", "test", "serviceMesh"})
 public class SoNoAuthWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
     @Override
     public void configure(final WebSecurity web) throws Exception {
index 8f795df..8e8f40c 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -45,6 +47,8 @@ public class Networks implements Serializable {
     protected String productFamilyId;
     @JsonProperty("instanceParams")
     private List<Map<String, String>> instanceParams = new ArrayList<>();
+    @JsonProperty("processingPriority")
+    protected Integer processingPriority = 0;
 
     public ModelInfo getModelInfo() {
         return modelInfo;
@@ -86,10 +90,19 @@ public class Networks implements Serializable {
         this.instanceParams = instanceParams;
     }
 
+    public Integer getProcessingPriority() {
+        return processingPriority;
+    }
+
+    public void setProcessingPriority(Integer processingPriority) {
+        this.processingPriority = processingPriority;
+    }
+
     @Override
     public String toString() {
         return "Networks [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
-                + instanceName + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams + "]";
+                + instanceName + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams
+                + ", processingPriority=" + processingPriority + "]";
     }
 
 }
index f601ebc..027a3be 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2019 Nokia
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -46,7 +48,8 @@ public class Pnfs implements Serializable {
     protected String productFamilyId;
     @JsonProperty("instanceParams")
     private List<Map<String, String>> instanceParams = new ArrayList<>();
-
+    @JsonProperty("processingPriority")
+    protected Integer processingPriority = 0;
 
     public ModelInfo getModelInfo() {
         return modelInfo;
@@ -104,11 +107,20 @@ public class Pnfs implements Serializable {
         this.instanceParams = instanceParams;
     }
 
+    public Integer getProcessingPriority() {
+        return processingPriority;
+    }
+
+    public void setProcessingPriority(Integer processingPriority) {
+        this.processingPriority = processingPriority;
+    }
+
     @Override
     public String toString() {
         return "Pnfs [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
                 + instanceName + ", platform=" + platform + ", " + "lineOfBusiness=" + lineOfBusiness
-                + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams + "]";
+                + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams
+                + ", processingPriority=" + processingPriority + "]";
     }
 
 }
index 5c4834d..d4d1f89 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -45,7 +47,8 @@ public class VfModules implements Serializable {
     protected String volumeGroupInstanceName;
     @JsonProperty("instanceParams")
     private List<Map<String, String>> instanceParams = new ArrayList<>();
-
+    @JsonProperty("processingPriority")
+    protected Integer processingPriority = 0;
 
     public ModelInfo getModelInfo() {
         return modelInfo;
@@ -87,11 +90,19 @@ public class VfModules implements Serializable {
         this.instanceParams = instanceParams;
     }
 
+    public Integer getProcessingPriority() {
+        return processingPriority;
+    }
+
+    public void setProcessingPriority(Integer processingPriority) {
+        this.processingPriority = processingPriority;
+    }
+
     @Override
     public String toString() {
         return "VfModules [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
                 + instanceName + ", volumeGroupInstanceName=" + volumeGroupInstanceName + ", instanceParams="
-                + instanceParams + "]";
+                + instanceParams + ", processingPriority=" + processingPriority + "]";
     }
 
 }
index ca67f56..f098d84 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
  * 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
@@ -53,6 +55,8 @@ public class Vnfs implements Serializable {
     private List<VfModules> vfModules = new ArrayList<>();
     @JsonProperty("applicationId")
     protected String applicationId;
+    @JsonProperty("processingPriority")
+    protected Integer processingPriority = 0;
 
     public ModelInfo getModelInfo() {
         return modelInfo;
@@ -126,12 +130,20 @@ public class Vnfs implements Serializable {
         this.applicationId = applicationId;
     }
 
+    public Integer getProcessingPriority() {
+        return processingPriority;
+    }
+
+    public void setProcessingPriority(Integer processingPriority) {
+        this.processingPriority = processingPriority;
+    }
+
     @Override
     public String toString() {
         return "Vnfs [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
                 + instanceName + ", platform=" + platform + ", " + "lineOfBusiness=" + lineOfBusiness
                 + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams + ", vfModules="
-                + vfModules + ", applicaionId=" + applicationId + " ]";
+                + vfModules + ", applicaionId=" + applicationId + ", processingPriority=" + processingPriority + " ]";
     }
 
 }
index 3c5f259..d0714bb 100644 (file)
@@ -68,6 +68,8 @@
   <logger name="org.reflections" level="ERROR" additivity="false">
     <appender-ref ref="STDOUT" />
   </logger>
+  
+  <logger name="org.reflections" level="ERROR" />
 
   <root level="WARN">
     <appender-ref ref="STDOUT" />
index 39beb10..ad9f26e 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <name>CXFLogging</name>
   <description>Common CXF Logging Classes</description>
index 772eeab..28dd35f 100644 (file)
@@ -65,6 +65,7 @@
                <appender-ref ref="STDOUT" />
        </logger>
        
+    <logger name="org.reflections" level="ERROR" />
 
        <root level="WARN">
                <appender-ref ref="STDOUT" />
index 0d54945..47a9551 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>deployment-configs</artifactId>
   <name>deployment-configs</name>
index 0ab486b..e5057f6 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>graph-inventory</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>aai-client</artifactId>
   <build>
diff --git a/graph-inventory/aai-client/src/test/resources/logback-test.xml b/graph-inventory/aai-client/src/test/resources/logback-test.xml
new file mode 100644 (file)
index 0000000..bb4aee6
--- /dev/null
@@ -0,0 +1,36 @@
+<!--
+  ============LICENSE_START=======================================================
+  ONAP - SO
+  ================================================================================
+  Copyright (C) 2021 Nordix Foundation.
+  ================================================================================
+  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.
+  
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.reflections" level="ERROR" />
+    <logger name="org.onap" level="DEBUG" />
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>
index bcc04ef..4003bb8 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>graph-inventory</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>fluent-builder-maven-plugin</artifactId>
   <packaging>maven-plugin</packaging>
index b61bed9..190a5b0 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>graph-inventory</artifactId>
   <packaging>pom</packaging>
index a241532..c891e31 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>mso-api-handlers</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>mso-api-handler-common</artifactId>
   <name>mso-api-handler-common</name>
index cf1df1b..bd58f9b 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>mso-api-handlers</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>mso-api-handler-infra</artifactId>
   <name>mso-api-handler-infra</name>
index 9a4d0a4..bcbc7c7 100644 (file)
@@ -935,8 +935,7 @@ public class ServiceInstances extends AbstractRestHandler {
         }
 
         if (!requestScope.equalsIgnoreCase(ModelType.service.name()) && action != Action.recreateInstance
-                && !(requestScope.equalsIgnoreCase(ModelType.vnf.name())
-                        && (action == Action.replaceInstance || action == Action.replaceInstanceRetainAssignments))) {
+                && !requestScope.equalsIgnoreCase(ModelType.vnf.name())) {
             aLaCarte = true;
         } else if (aLaCarte == null) {
             aLaCarte = false;
index 5e6b88c..23d31d0 100644 (file)
@@ -1,41 +1,38 @@
 <configuration>
 
-
-       <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-               <encoder>
-                       <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
-                       </pattern>
-               </encoder>
-       </appender>
-       <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender" />
-
-
-       <logger name="AUDIT" level="info" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-       <logger name="com.att.eelf.metrics" level="info" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-       <logger name="com.att.eelf.error" level="ERROR" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-
-       <logger name="org.onap" level="${so.log.level:-DEBUG}"
-               additivity="false">
-               <appender-ref ref="STDOUT" />
-               <appender-ref ref="test" />
-       </logger>
-
-       <logger name="com.att" level="${so.log.level:-DEBUG}"
-               additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-       <root level="WARN">
-               <appender-ref ref="STDOUT" />
-       </root>
-
-       <logger name="wiremock.org" level="ERROR" />
-
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+    <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender" />
+
+
+    <logger name="AUDIT" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="ERROR" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+        <appender-ref ref="test" />
+    </logger>
+
+    <logger name="com.att" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+    <root level="WARN">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+    <logger name="wiremock.org" level="ERROR" />
+    <logger name="org.reflections" level="ERROR" />
 </configuration>
index 2f5c836..71ad9ce 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>mso-api-handlers</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>mso-requests-db-repositories</artifactId>
   <name>mso-requests-db-repositories</name>
index 1951484..868583d 100644 (file)
@@ -1,46 +1,46 @@
-<configuration >
-  
-  
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-
-  <logger name="com.att.ecomp.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+
+    <logger name="com.att.ecomp.audit" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="trace" additivity="false">
         <appender-ref ref="STDOUT" />
-  </logger>
-
-  <logger name="com.att.eelf.error" level="trace" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
-
-       <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-  <root level="debug">
-    <appender-ref ref="STDOUT" />
-  </root>
-  
-       <!-- Spring related loggers -->
-       <logger name="org.springframework" level="WARN" />
-       <logger name="org.springframework.beans" level="WARN" />
-       <logger name="org.springframework.web" level="WARN" />
-       <logger name="com.blog.spring.jms" level="WARN" />
-       
-       <logger name="org.hibernate" level="WARN" />
-
-       
-       <!-- Tomcat related loggers -->
-       <logger name="org.apache.tomcat.util.digester.Digester" level="WARN" />
-       <logger name="org.apache.tomcat.util.modeler.modules.*" level="WARN" />
-       <logger name="org.apache.tomcat.util.IntrospectionUtils" level="WARN" />
-       <logger name="org.apache.catalina.loader.WebappClassLoaderBase" level="WARN" />
-       <logger name="wiremock.org.eclipse.jetty" level="WARN" />
+    </logger>
+
+    <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+    <root level="debug">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+    <logger name="org.reflections" level="ERROR" />
+    <!-- Spring related loggers -->
+    <logger name="org.springframework" level="WARN" />
+    <logger name="org.springframework.beans" level="WARN" />
+    <logger name="org.springframework.web" level="WARN" />
+    <logger name="com.blog.spring.jms" level="WARN" />
+
+    <logger name="org.hibernate" level="WARN" />
+
+
+    <!-- Tomcat related loggers -->
+    <logger name="org.apache.tomcat.util.digester.Digester" level="WARN" />
+    <logger name="org.apache.tomcat.util.modeler.modules.*" level="WARN" />
+    <logger name="org.apache.tomcat.util.IntrospectionUtils" level="WARN" />
+    <logger name="org.apache.catalina.loader.WebappClassLoaderBase" level="WARN" />
+    <logger name="wiremock.org.eclipse.jetty" level="WARN" />
 
 </configuration>
\ No newline at end of file
index ba3eac4..c6f65dd 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>mso-api-handlers</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <artifactId>mso-requests-db</artifactId>
   <name>mso-requests-db</name>
index 1951484..607cbe9 100644 (file)
@@ -27,6 +27,8 @@
     <appender-ref ref="STDOUT" />
   </root>
   
+    <logger name="org.reflections" level="ERROR" />
+  
        <!-- Spring related loggers -->
        <logger name="org.springframework" level="WARN" />
        <logger name="org.springframework.beans" level="WARN" />
index 28d3004..d03e91d 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>mso-api-handlers</artifactId>
index cca606a..c2bcf9b 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>mso-catalog-db</artifactId>
index 36d3c98..2b95f3b 100644 (file)
@@ -95,7 +95,7 @@ public class CloudIdentity {
     @Column(name = "MEMBER_ROLE")
     private String memberRole;
 
-    @JsonProperty("tenant_meta_data")
+    @JsonProperty("tenant_metadata")
     @BusinessKey
     @Column(name = "TENANT_METADATA")
     private Boolean tenantMetadata;
index 1407ad0..88f5f9a 100644 (file)
   ============LICENSE_END=========================================================
   -->
 
-<configuration >
+<configuration>
 
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
-    </encoder>
-  </appender>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n
+            </pattern>
+        </encoder>
+    </appender>
 
 
-  <logger name="com.att.eelf.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+    <logger name="com.att.eelf.audit" level="info" additivity="false">
         <appender-ref ref="STDOUT" />
-  </logger>
+    </logger>
 
-  <logger name="com.att.eelf.error" level="trace" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-       <logger name="org.onap" level="DEBUG" additivity="false">
-               <appender-ref ref="STDOUT" />
-       </logger>
-  <root level="info">
-    <appender-ref ref="STDOUT" />
-  </root>
+    <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="com.att.eelf.error" level="trace" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.onap" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org.reflections" level="ERROR" />
+    
+    <root level="info">
+        <appender-ref ref="STDOUT" />
+    </root>
 
 </configuration>
index 1d68522..04fd6e2 100644 (file)
@@ -6,7 +6,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>packages</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
 
   <packaging>pom</packaging>
index a64be03..75afb04 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>packages</artifactId>
diff --git a/pom.xml b/pom.xml
index a665440..49d4b75 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
   <groupId>org.onap.so</groupId>
   <artifactId>so</artifactId>
   <packaging>pom</packaging>
-  <version>1.8.0-SNAPSHOT</version>
+  <version>1.9.0-SNAPSHOT</version>
   <name>so</name>
   <description>This Maven project is responsible to build and package all child projects - contributions in the MSO project.
        This build can be configured to run Functional tests and to start/stop a jboss server + Mysql DB.
@@ -45,7 +45,6 @@
     <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
     <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
     <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
-    <!--sonar.jacoco.itReportPath>${project.mso.base.folder}/packages/arquillian-unit-tests/target/mso-automated-tests/jacoco-it.exec</sonar.jacoco.itReportPath -->
     <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
     <sonar.projectVersion>${project.version}</sonar.projectVersion>
     <sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
     <bowman.client.version>0.9.0</bowman.client.version>
     <aaf.cadi.version>2.1.15</aaf.cadi.version>
     <so-etsi-sol003-adapter-version>1.8.1-SNAPSHOT</so-etsi-sol003-adapter-version>
+    <onap-logging-version>1.6.9</onap-logging-version>
   </properties>
   <distributionManagement>
     <repository>
-      <id>onap-releases</id>
+      <id>ecomp-releases</id>
       <url>${nexusproxy}/${releaseNexusPath}</url>
     </repository>
     <snapshotRepository>
-      <id>onap-snapshots</id>
+      <id>ecomp-snapshots</id>
       <url>${nexusproxy}/${snapshotNexusPath}</url>
     </snapshotRepository>
     <site>
-      <id>onap-site</id>
+      <id>ecomp-site</id>
       <url>dav:${nexusproxy}${siteNexusPath}</url>
     </site>
   </distributionManagement>
       </snapshots>
     </pluginRepository>
     <pluginRepository>
-      <id>onap-release</id>
+      <id>ecomp-release</id>
       <url>${nexusproxy}/${releaseNexusPath}</url>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>
     </pluginRepository>
     <pluginRepository>
-      <id>onap-snapshots</id>
+      <id>ecomp-snapshots</id>
       <url>${nexusproxy}/${snapshotNexusPath}</url>
       <releases>
         <enabled>false</enabled>
   </pluginRepositories>
   <repositories>
     <repository>
-      <id>onap-public</id>
+      <id>ecomp-public</id>
       <url>https://nexus.onap.org/content/repositories/public/</url>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>
     </repository>
+    <repository>
+      <id>ecomp-releases</id>
+      <url>https://nexus.onap.org/content/repositories/releases/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>ecomp-snapshots</id>
+      <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
     <repository>
       <id>camunda-bpm</id>
       <url>https://app.camunda.com/nexus/content/repositories/camunda-bpm/</url>
       <dependency>
         <groupId>org.onap.logging-analytics</groupId>
         <artifactId>logging-slf4j</artifactId>
-        <version>1.6.10-SNAPSHOT</version>
+        <version>${onap-logging-version}</version>
       </dependency>
       <dependency>
         <groupId>org.onap.logging-analytics</groupId>
         <artifactId>logging-filter-base</artifactId>
-        <version>1.6.10-SNAPSHOT</version>
+        <version>${onap-logging-version}</version>
       </dependency>
       <dependency>
         <groupId>org.onap.logging-analytics</groupId>
         <artifactId>logging-filter-spring</artifactId>
-        <version>1.6.10-SNAPSHOT</version>
+        <version>${onap-logging-version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <scope>runtime</scope>
       </dependency>
       <dependency>
-       <groupId>ch.vorburger.mariaDB4j</groupId>
-       <artifactId>mariaDB4j</artifactId>
-       <version>2.3.0</version>
-       <scope>test</scope>
+        <groupId>ch.vorburger.mariaDB4j</groupId>
+        <artifactId>mariaDB4j</artifactId>
+        <version>2.3.0</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.cloud</groupId>
+        <artifactId>spring-cloud-contract-wiremock</artifactId>
+        <version>1.2.4.RELEASE</version>
+        <scope>test</scope>
       </dependency>
       <dependency>
-       <groupId>org.springframework.cloud</groupId>
-       <artifactId>spring-cloud-contract-wiremock</artifactId>
-       <version>1.2.4.RELEASE</version>
-       <scope>test</scope>
+        <groupId>org.camunda.bpm.assert</groupId>
+        <artifactId>camunda-bpm-assert</artifactId>
+        <version>3.0.0</version>
+        <scope>test</scope>
       </dependency>
       <dependency>
-       <groupId>org.camunda.bpm.assert</groupId>
-       <artifactId>camunda-bpm-assert</artifactId>
-       <version>3.0.0</version>
-       <scope>test</scope>
+        <groupId>janino</groupId>
+        <artifactId>janino</artifactId>
+        <version>2.5.15</version>
       </dependency>
       <dependency>
-       <groupId>janino</groupId>
-       <artifactId>janino</artifactId>
-       <version>2.5.15</version>
+        <groupId>org.camunda.bpm</groupId>
+        <artifactId>camunda-external-task-client</artifactId>
+        <version>1.4.0</version>
       </dependency>
       <dependency>
-       <groupId>org.camunda.bpm</groupId>
-       <artifactId>camunda-external-task-client</artifactId>
-       <version>1.4.0</version>
+        <groupId>pl.pragmatists</groupId>
+        <artifactId>JUnitParams</artifactId>
+        <version>1.0.5</version>
+        <scope>test</scope>
       </dependency>
       <dependency>
-       <groupId>pl.pragmatists</groupId>
-       <artifactId>JUnitParams</artifactId>
-       <version>1.0.5</version>
-       <scope>test</scope>
-         </dependency>
-         <dependency>
-       <groupId>io.swagger.core.v3</groupId>
-       <artifactId>swagger-jaxrs2</artifactId>
-       <version>2.1.7</version>
+        <groupId>io.swagger.core.v3</groupId>
+        <artifactId>swagger-jaxrs2</artifactId>
+        <version>2.1.7</version>
       </dependency>
       <dependency>
         <groupId>org.camunda.bpm</groupId>
index 77ce71e..3e56ff4 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-optimization-clients</artifactId>
index 96d4744..dbcf527 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-sdn-clients</artifactId>
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Copyright (C) 2021 - Nokia
+ * ================================================================================
  * 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
@@ -18,8 +20,9 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.so.client.sdn.common;
+package org.onap.so.client.sdnc;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import java.util.LinkedHashMap;
@@ -29,7 +32,6 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.onap.so.client.exception.BadResponseException;
 import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SdnCommonTasks;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 
@@ -101,4 +103,31 @@ public class SdnCommonTasksTest {
         sdnCommonTasks.validateSDNResponse(responseMap);
     }
 
+    @Test
+    public void validateSDNResponse_emptyWhenNoSerializerFoundForValue() throws Exception {
+        LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+        output.put("key1", new Object());
+        String result = sdnCommonTasks.validateSDNResponse(output);
+        assertThat(result).isEmpty();
+    }
+
+    @Test
+    public void validateSDNGetResponse_success() throws Exception {
+        LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+        output.put("key1", "value1");
+        String result = sdnCommonTasks.validateSDNGetResponse(output);
+        assertThat(result).isEqualTo("{\"key1\":\"value1\"}");
+    }
+
+    @Test(expected = BadResponseException.class)
+    public void validateSDNGetResponse_exWhenNoSerializerFoundForValue() throws Exception {
+        LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+        output.put("key1", new Object());
+        sdnCommonTasks.validateSDNGetResponse(output);
+    }
+
+    @Test(expected = BadResponseException.class)
+    public void validateSDNGetResponse_exWhenMapEmpty() throws Exception {
+        sdnCommonTasks.validateSDNGetResponse(new LinkedHashMap<>());
+    }
 }
diff --git a/so-sdn-clients/src/test/resources/logback-test.xml b/so-sdn-clients/src/test/resources/logback-test.xml
new file mode 100644 (file)
index 0000000..bb4aee6
--- /dev/null
@@ -0,0 +1,36 @@
+<!--
+  ============LICENSE_START=======================================================
+  ONAP - SO
+  ================================================================================
+  Copyright (C) 2021 Nordix Foundation.
+  ================================================================================
+  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.
+  
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.reflections" level="ERROR" />
+    <logger name="org.onap" level="DEBUG" />
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>
index c4dc797..8c2c529 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
+    <version>1.9.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-simulator</artifactId>
index b42441b..f7e8293 100644 (file)
@@ -1,5 +1,8 @@
 package org.onap.so.simulator.actions.aai;
 
+import com.consol.citrus.actions.AbstractTestAction;
+import com.consol.citrus.context.TestContext;
+import java.security.SecureRandom;
 import org.onap.aai.domain.yang.L3Network;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
@@ -7,8 +10,6 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import com.consol.citrus.actions.AbstractTestAction;
-import com.consol.citrus.context.TestContext;
 
 
 public class ProcessNetwork extends AbstractTestAction {
@@ -17,7 +18,7 @@ public class ProcessNetwork extends AbstractTestAction {
     public void doExecute(TestContext context) {
         final Logger logger = LoggerFactory.getLogger(ProcessNetwork.class);
         try {
-            int random = (int) (Math.random() * 50 + 1);
+            int random = (new SecureRandom()).nextInt(50) + 1;
 
             AAIResourcesClient aaiResourceClient = new AAIResourcesClient();
 
index 383e1bf..4989e99 100644 (file)
@@ -14,19 +14,21 @@ import com.consol.citrus.context.TestContext;
 
 public class ProcessVnfc extends AbstractTestAction {
 
+    private static final String VNF_SERVER_1_NAME = "ssc_server_1";
+
     @Override
     public void doExecute(TestContext context) {
 
         final Logger logger = LoggerFactory.getLogger(ProcessVnfc.class);
         try {
             logger.debug("running ProcessVnfc scenario");
-            logger.debug("requestAction: " + context.getVariable("requestAction"));
-            logger.debug("serviceAction: " + context.getVariable("serviceAction"));
-            logger.debug("cloudOwner: " + context.getVariable("cloudOwner"));
-            logger.debug("cloundRegion: " + context.getVariable("cloudRegion"));
-            logger.debug("tenant: " + context.getVariable("tenant"));
-            logger.debug("vfModuleId: " + context.getVariable("vfModuleId"));
-            logger.debug("vnfId: " + context.getVariable("vnfId"));
+            logger.debug("requestAction: {}", context.getVariable("requestAction"));
+            logger.debug("serviceAction: {}", context.getVariable("serviceAction"));
+            logger.debug("cloudOwner: {}", context.getVariable("cloudOwner"));
+            logger.debug("cloundRegion: {}", context.getVariable("cloudRegion"));
+            logger.debug("tenant: {}", context.getVariable("tenant"));
+            logger.debug("vfModuleId: {}", context.getVariable("vfModuleId"));
+            logger.debug("vnfId: {}", context.getVariable("vnfId"));
 
             AAIResourcesClient aaiResourceClient = new AAIResourcesClient();
 
@@ -34,9 +36,9 @@ public class ProcessVnfc extends AbstractTestAction {
                     && context.getVariable("serviceAction").equals("assign")) {
 
                 AAIResourceUri vnfcURI =
-                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc("ssc_server_1"));
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(VNF_SERVER_1_NAME));
                 Vnfc vnfc = new Vnfc();
-                vnfc.setVnfcName("ssc_server_1");
+                vnfc.setVnfcName(VNF_SERVER_1_NAME);
                 vnfc.setNfcNamingCode("oamfw");
                 vnfc.setNfcFunction("EPC-OAM-FIREWALL");
                 vnfc.setProvStatus("PREPROV");
@@ -53,8 +55,8 @@ public class ProcessVnfc extends AbstractTestAction {
 
                 if (aaiResourceClient.exists(vnfcURI)) {
                     Optional<VfModule> vfModule = aaiResourceClient.get(vfModuleURI).asBean(VfModule.class);
-                    if (vfModule.get().getVfModuleName().contains("macro")) {
-                        String vnfcName = "ssc_server_1" + vfModule.get().getVfModuleName()
+                    if (vfModule.isPresent() && vfModule.get().getVfModuleName().contains("macro")) {
+                        String vnfcName = VNF_SERVER_1_NAME + vfModule.get().getVfModuleName()
                                 .substring(vfModule.get().getVfModuleName().length() - 1);
                         vnfc.setVnfcName(vnfcName);
                         vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
index 29a9aff..140ac3c 100644 (file)
@@ -1,22 +1,24 @@
 package org.onap.so.simulator.scenarios.openstack.macro;
 
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
 import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
 import com.consol.citrus.simulator.scenario.Scenario;
 import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 /**
- * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete.
  *
  */
 @Scenario("Openstack-QueryStackByID-Macro1")
 @RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_1/*", method = RequestMethod.GET)
 public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
 
+    private static final String FILE_STACK_CREATED_PATH = "openstack/gr_api/Stack_Created.json";
+    private static final String FILE_STACK_DELETED_PATH = "openstack/gr_api/Stack_Deleted.json";
 
     @Override
     public void run(ScenarioDesigner scenario) {
@@ -31,38 +33,31 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
 
         scenario.variable("stackName", "macro_module_1");
 
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         // Create (module_2)
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         // Create (module_3)
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         // Create (module_2 recreate)
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         // Delete
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
 
         // Delete
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
 
         // Poll
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
     }
 
 }
index 15f0b61..05d87cd 100644 (file)
@@ -1,22 +1,24 @@
 package org.onap.so.simulator.scenarios.openstack.macro;
 
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
 import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
 import com.consol.citrus.simulator.scenario.Scenario;
 import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 /**
- * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete.
  *
  */
 @Scenario("Openstack-QueryStackByID-Macro2")
 @RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_2/*", method = RequestMethod.GET)
 public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
 
+    private static final String FILE_STACK_CREATED_PATH = "openstack/gr_api/Stack_Created.json";
+    private static final String FILE_STACK_DELETED_PATH = "openstack/gr_api/Stack_Deleted.json";
 
     @Override
     public void run(ScenarioDesigner scenario) {
@@ -31,22 +33,18 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
 
         scenario.variable("stackName", "macro_module_2");
 
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         // Delete
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
 
         // Poll
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
     }
 
 }
index b7808dc..15a6fa3 100644 (file)
@@ -1,22 +1,24 @@
 package org.onap.so.simulator.scenarios.openstack.macro;
 
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
 import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
 import com.consol.citrus.simulator.scenario.Scenario;
 import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 /**
- * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete.
  *
  */
 @Scenario("Openstack-QueryStackByID-Macro3")
 @RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_3/*", method = RequestMethod.GET)
 public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
 
+    private static final String FILE_STACK_CREATED_PATH = "openstack/gr_api/Stack_Created.json";
+    private static final String FILE_STACK_DELETED_PATH = "openstack/gr_api/Stack_Deleted.json";
 
     @Override
     public void run(ScenarioDesigner scenario) {
@@ -31,22 +33,18 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
         scenario.variable("stackName", "macro_module_3");
 
         // Poll
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         // Delete
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
 
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
 
         // Poll
         scenario.http().receive().get();
-        scenario.http().send().response(HttpStatus.OK)
-                .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+        scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
 
     }
 
index 4e6b151..6e5122f 100644 (file)
@@ -1,12 +1,13 @@
 package org.onap.so.simulator.scenarios.sdnc.grapi;
 
+import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
+import com.consol.citrus.simulator.scenario.Scenario;
+import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+import java.security.SecureRandom;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
-import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
-import com.consol.citrus.simulator.scenario.Scenario;
-import com.consol.citrus.simulator.scenario.ScenarioDesigner;
 
 @Scenario("SDNC-GRAPI-QueryVFModule")
 @RequestMapping(
@@ -17,7 +18,7 @@ public class QueryVFModuleGR extends AbstractSimulatorScenario {
     @Override
     public void run(ScenarioDesigner scenario) {
         scenario.http().receive().get();
-        int random = (int) (Math.random() * 50 + 1);
+        int random = (new SecureRandom()).nextInt(50) + 1;
 
         scenario.variable("vfModuleName", "vfModuleName" + random);
 
index bbf07d9..b6e146a 100644 (file)
@@ -5,8 +5,10 @@ log4j.rootLogger=INFO, out
 
 log4j.logger.com.consol.citrus=DEBUG
 log4j.logger.org.springframework=INFO
+log4j.logger.org.reflections=ERROR
 
 # CONSOLE appender not used by default
 log4j.appender.out=org.apache.log4j.ConsoleAppender
 log4j.appender.out.layout=org.apache.log4j.PatternLayout
 log4j.appender.out.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5.5p %20.20c{2}| %m%n
+
index b3f28cd..0986d1f 100644 (file)
@@ -3,8 +3,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major=1
-minor=8
-patch=1
+minor=9
+patch=0
 
 base_version=${major}.${minor}.${patch}