aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /bpmn/so-bpmn-tasks/src
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java563
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java379
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java136
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java241
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java370
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java64
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java107
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java126
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java93
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java99
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java109
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java121
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java133
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java154
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java143
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java117
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java864
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java261
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java297
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java122
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java341
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java134
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java120
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java167
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java730
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java170
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java65
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java157
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java150
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java83
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java111
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java99
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java105
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java92
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java52
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java86
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java172
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java100
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java164
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java115
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java65
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java64
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java119
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java139
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java665
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java387
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java427
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java82
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java157
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java115
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java169
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java115
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java118
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java92
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java144
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java100
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java154
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java121
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java202
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java182
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java188
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java1494
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java108
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java623
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java227
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java301
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java224
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java214
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java372
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java449
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java91
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java180
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java317
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java181
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java127
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java161
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java132
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java132
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java219
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java204
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java126
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java185
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java122
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java122
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java83
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java225
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java198
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java221
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java129
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java175
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml75
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml31
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json226
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json216
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json596
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json596
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json596
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json141
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json166
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json891
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml145
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json162
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json87
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json153
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json141
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json118
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json166
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json71
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json52
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json30
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json241
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json243
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json68
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json68
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json88
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json113
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json119
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json50
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest99
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf56
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json596
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json67
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json55
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json106
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf107
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net165
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf50
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf65
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json66
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json64
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json66
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json33
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json70
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json125
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml29
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml315
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml141
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml55
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml214
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/schema.sql1188
254 files changed, 34646 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
new file mode 100644
index 0000000000..b7f45c05b5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -0,0 +1,563 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.buildingblock;
+
+import static org.apache.commons.lang3.StringUtils.*;
+
+import java.time.Duration;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.lang.SerializationUtils;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoMetadata;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.ExceptionBuilder;
+
+import org.onap.so.client.sniro.SniroClient;
+import static org.onap.so.client.sniro.SniroValidator.*;
+
+import org.onap.so.client.sniro.beans.SniroManagerRequest;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
+
+
+/**
+ * The sniro homing building block obtains licensing and homing solutions for a given
+ * resource or set of resources.
+ *
+ * @author cb645j
+ *
+ */
+@Component("SniroHoming")
+public class SniroHomingV2 {
+ private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV2.class);
+ private JsonUtils jsonUtils = new JsonUtils();
+ @Autowired
+ private Environment env;
+ @Autowired
+ private SniroClient client;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ private static final String MODEL_NAME = "modelName";
+ private static final String MODEL_INVARIANT_ID = "modelInvariantId";
+ private static final String MODEL_VERSION_ID = "modelVersionId";
+ private static final String MODEL_VERSION = "modelVersion";
+ private static final String SERVICE_RESOURCE_ID = "serviceResourceId";
+ private static final String RESOURCE_MODULE_NAME = "resourceModuleName";
+ private static final String RESOURCE_MODEL_INFO = "resourceModelInfo";
+ private static final String IDENTIFIER_TYPE = "identifierType";
+ private static final String INVENTORY_TYPE = "inventoryType";
+ private static final String SOLUTIONS = "solutions";
+ private static final String RESOURCE_MISSING_DATA = "Resource does not contain: ";
+ private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: ";
+ private static final String UNPROCESSABLE = "422";
+ private static final int INTERNAL = 500;
+
+ /**
+ * Generates the request payload then sends to sniro manager to perform homing and
+ * licensing for the provided demands
+ *
+ * @param execution
+ */
+ public void callSniro(BuildingBlockExecution execution){
+ log.trace("Started Sniro Homing Call Sniro");
+ try{
+ GeneralBuildingBlock bb = execution.getGeneralBuildingBlock();
+
+ RequestContext requestContext = bb.getRequestContext();
+ RequestParameters requestParams = requestContext.getRequestParameters();
+ String requestId = requestContext.getMsoRequestId();
+
+ ServiceInstance serviceInstance = bb.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ Customer customer = bb.getCustomer();
+
+ String timeout = execution.getVariable("timeout");
+ if(isBlank(timeout)){
+ timeout = env.getProperty("sniro.manager.timeout", "PT30M");
+ }
+
+ SniroManagerRequest request = new SniroManagerRequest(); //TODO Add additional pojos for each section
+
+ JSONObject requestInfo = buildRequestInfo(requestId, timeout);
+ request.setRequestInformation(requestInfo.toString());
+
+ JSONObject serviceInfo = buildServiceInfo(serviceInstance);
+ request.setServiceInformation(serviceInfo.toString());
+
+ JSONObject placementInfo = buildPlacementInfo(customer, requestParams);
+
+ JSONArray placementDemands = buildPlacementDemands(serviceInstance);
+ placementInfo.put("placementDemands", placementDemands);
+ request.setPlacementInformation(placementInfo.toString());
+
+ JSONArray licenseDemands = buildLicenseDemands(serviceInstance);
+ request.setLicenseInformation(licenseDemands.toString());
+
+ if(placementDemands.length() > 0 || licenseDemands.length() > 0){
+ client.postDemands(request);
+ }else{
+ log.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing");
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "resources eligible for homing or licensing");
+ }
+
+ //Variables for ReceiveWorkflowMessage subflow
+ execution.setVariable("asyncCorrelator", requestId);
+ execution.setVariable("asyncMessageType", "SNIROResponse");
+ execution.setVariable("asyncTimeout", timeout);
+
+ log.trace("Completed Sniro Homing Call Sniro");
+ }catch(BpmnError e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ }catch(BadResponseException e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing sniro request: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Validates, processes, and sets the homing and licensing solutions that are returned by
+ * sniro manager
+ *
+ * @param execution
+ * @param asyncResponse
+ */
+ public void processSolution(BuildingBlockExecution execution, String asyncResponse){
+ log.trace("Started Sniro Homing Process Solution");
+ try{
+ //TODO improve handling multiple solutions but is dependent on sniro enhancing api + work with sniro conductor to improve "inventoryType" representation
+ validateSolution(asyncResponse);
+ ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+
+ log.debug("Processing sniro manager asyncronous response");
+ JSONObject response = new JSONObject(asyncResponse);
+ if(response.has(SOLUTIONS)){
+ JSONObject allSolutions = response.getJSONObject(SOLUTIONS);
+ if(allSolutions.has("placementSolutions")){
+ JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions");
+ for(int i = 0; i < placementSolutions.length(); i++){
+ JSONArray placements = placementSolutions.getJSONArray(i);
+ processPlacementSolution(serviceInstance, placements, i);
+ }
+ }
+ if(allSolutions.has("licenseSolutions")){
+ JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions");
+ if(licenseSolutions.length() > 0){
+ processLicenseSolution(serviceInstance, licenseSolutions);
+ }
+ }
+ }else{
+ throw new BpmnError(UNPROCESSABLE, "Sniro Managers response does not contain: " + SOLUTIONS);
+ }
+
+ execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
+
+ log.trace("Completed Sniro Homing Process Solution");
+ }catch(BpmnError e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ }catch(BadResponseException e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Builds the request information section for the homing/licensing request
+ *
+ * @throws Exception
+ */
+ private JSONObject buildRequestInfo(String requestId, String timeout) throws Exception{
+ log.trace("Building request information");
+ JSONObject requestInfo = new JSONObject();
+ if(requestId != null){
+ String host = env.getProperty("mso.workflow.message.endpoint");
+ String callbackUrl = host + "/" + UriUtils.encodePathSegment("SNIROResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8");
+
+ Duration d = Duration.parse(timeout);
+ long timeoutSeconds = d.getSeconds();
+
+ requestInfo.put("transactionId", requestId).put("requestId", requestId).put("callbackUrl", callbackUrl).put("sourceId", "mso").put("requestType", "create")
+ .put("timeout", timeoutSeconds);
+ } else{
+ throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
+ }
+ return requestInfo;
+ }
+
+ /**
+ * Builds the request information section for the homing/licensing request
+ *
+ */
+ private JSONObject buildServiceInfo(ServiceInstance serviceInstance){
+ log.trace("Building service information");
+ JSONObject info = new JSONObject();
+ ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
+ if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
+ info.put("serviceInstanceId", serviceInstance.getServiceInstanceId());
+ if(modelInfo.getServiceType() != null){ //temp solution
+ info.put("serviceName", serviceInstance.getModelInfoServiceInstance().getServiceType());
+ }
+ info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
+ }else{
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID);
+ }
+ return info;
+ }
+
+ /**
+ * Builds initial section of placement info for the homing/licensing request
+ *
+ */
+ private JSONObject buildPlacementInfo(Customer customer, RequestParameters requestParams){
+ JSONObject placementInfo = new JSONObject();
+ if(customer != null){
+ log.debug("Adding subscriber to placement information");
+ placementInfo.put("subscriberInfo", new JSONObject().put("globalSubscriberId", customer.getGlobalCustomerId()).put("subscriberName", customer.getSubscriberName()).put("subscriberCommonSiteId", customer.getSubscriberCommonSiteId()));
+ if(requestParams != null){
+ log.debug("Adding request parameters to placement information");
+ placementInfo.put("requestParameters", new JSONObject(requestParams.toJsonString()));
+ }
+ }else{
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
+ }
+ return placementInfo;
+
+ }
+
+ /**
+ * Builds the placement demand list for the homing/licensing request
+ *
+ */
+ private JSONArray buildPlacementDemands(ServiceInstance serviceInstance){
+ log.trace("Building placement information demands");
+ JSONArray placementDemands = new JSONArray();
+
+ List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
+ if(!allottedResourceList.isEmpty()){
+ log.debug("Adding allotted resources to placement demands list");
+ for(AllottedResource ar : allottedResourceList){
+ if(isBlank(ar.getId())){
+ ar.setId(UUID.randomUUID().toString());
+ }
+ JSONObject demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
+ addCandidates(ar, demand);
+ placementDemands.put(demand);
+ }
+ }
+ List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
+ if(!vpnBondingLinkList.isEmpty()){
+ log.debug("Adding vpn bonding links to placement demands list");
+ for(VpnBondingLink vbl:vpnBondingLinkList){
+ List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
+ for(ServiceProxy sp : serviceProxyList){
+ if(isBlank(sp.getId())){
+ sp.setId(UUID.randomUUID().toString());
+ }
+ JSONObject demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.put(demand);
+ }
+ }
+ }
+ return placementDemands;
+ }
+
+ /**
+ * Builds the license demand list for the homing/licensing request
+ *
+ */
+ private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){
+ log.trace("Building license information");
+ JSONArray licenseDemands = new JSONArray();
+ List<GenericVnf> vnfList = serviceInstance.getVnfs();
+ if(!vnfList.isEmpty()){
+ log.debug("Adding vnfs to license demands list");
+ for(GenericVnf vnf : vnfList){
+ JSONObject demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
+ licenseDemands.put(demand);
+ }
+ }
+ return licenseDemands;
+ }
+
+ /**
+ * Builds a single demand object
+ *
+ */
+ private JSONObject buildDemand(String id, ModelInfoMetadata metadata){
+ log.debug("Building demand for service or resource: " + id);
+ JSONObject demand = new JSONObject();
+ if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ demand.put(SERVICE_RESOURCE_ID, id);
+ demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName());
+ demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata));
+ }else{
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
+ }
+ return demand;
+ }
+
+ /**
+ * Builds the resource model info section
+ *
+ */
+ private JSONObject buildModelInfo(ModelInfoMetadata metadata){
+ JSONObject object = new JSONObject();
+ String invariantUuid = metadata.getModelInvariantUuid();
+ String modelUuid = metadata.getModelUuid();
+ if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
+ object.put(MODEL_INVARIANT_ID, invariantUuid).put(MODEL_VERSION_ID, modelUuid).put(MODEL_NAME, metadata.getModelName()).put(MODEL_VERSION, metadata.getModelVersion());
+ }else if(isNotBlank(invariantUuid)){
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID);
+ }else{
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID);
+ }
+ return object;
+ }
+
+ /**
+ * Adds required, excluded, and existing candidates to a demand
+ *
+ */
+ private void addCandidates(SolutionCandidates candidates, JSONObject demand){
+ List<Candidate> required = candidates.getRequiredCandidates();
+ List<Candidate> excluded = candidates.getExcludedCandidates();
+ if(!required.isEmpty()){
+ demand.put("requiredCandidates", required);
+ }
+ if(!excluded.isEmpty()){
+ demand.put("excludedCandidates", excluded);
+ }
+ //TODO support existing candidates
+ }
+
+ /**
+ * Processes the license solutions and sets to the corresponding generic vnf
+ *
+ */
+ private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+
+ log.debug("Processing the license solution");
+ for(int i = 0; i < licenseSolutions.length(); i++){
+ JSONObject licenseSolution = licenseSolutions.getJSONObject(i);
+ for(GenericVnf vnf:vnfs){
+ if(licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){
+ License license = new License();
+ JSONArray entitlementPools = licenseSolution.getJSONArray("entitlementPoolUUID");
+ List<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools);
+ license.setEntitlementPoolUuids(entitlementPoolsList);
+ JSONArray licenseKeys = licenseSolution.getJSONArray("licenseKeyGroupUUID");
+ List<String> licenseKeysList = jsonUtils.StringArrayToList(licenseKeys);
+ license.setLicenseKeyGroupUuids(licenseKeysList);
+
+ vnf.setLicense(license);
+ }
+ }
+ }
+ }
+
+ /**
+ * Processes a placement solution list then correlates and sets each placement solution
+ * to its corresponding resource
+ *
+ */
+ private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i){
+ List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
+ List<AllottedResource> allottes = serviceInstance.getAllottedResources();
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+
+ log.debug("Processing placement solution " + i+1);
+ for(int p = 0; p < placements.length(); p++){
+ JSONObject placement = placements.getJSONObject(p);
+ SolutionInfo solutionInfo = new SolutionInfo();
+ solutionInfo.setSolutionId(i + 1);
+ search: {
+ for(VpnBondingLink vbl:links){
+ List<ServiceProxy> proxies = vbl.getServiceProxies();
+ for(ServiceProxy sp:proxies){
+ if(placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())){
+ if(i > 0){
+ if(p % 2 == 0){
+ VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl);
+ vblNew.setVpnBondingLinkId(UUID.randomUUID().toString());
+ links.add(vblNew);
+ }
+ links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement));
+ }else{
+ sp.setServiceInstance(setSolution(solutionInfo, placement));
+ }
+ break search;
+ }
+ }
+ }
+ for(AllottedResource ar:allottes){
+ if(placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())){
+ ar.setParentServiceInstance(setSolution(solutionInfo, placement));
+ break search;
+ }
+ }
+ for(GenericVnf vnf:vnfs){
+ if(placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){
+ ServiceInstance si = setSolution(solutionInfo, placement);
+ serviceInstance.setSolutionInfo(si.getSolutionInfo());
+ serviceInstance.getVnfs().add(si.getVnfs().get(0));
+ break search;
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Creates and sets necessary pojos with placement solution data for a given demand
+ *
+ */
+ private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){
+ log.debug("Mapping placement solution");
+ String invalidMessage = "Sniro Managers Response contains invalid: ";
+
+ JSONObject solution = placement.getJSONObject("solution");
+ String identifierType = solution.getString(IDENTIFIER_TYPE);
+ List<String> identifiersList = jsonUtils.StringArrayToList(solution.getJSONArray("identifiers").toString());
+ String identifierValue = identifiersList.get(0);
+
+ JSONArray assignments = placement.getJSONArray("assignmentInfo");
+ Map<String, String> assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value");
+ solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome")));
+ String type = placement.getString(INVENTORY_TYPE);
+
+ ServiceInstance si = new ServiceInstance();
+ CloudRegion cloud = setCloud(assignmentsMap);
+ if(type.equals("service")){
+ if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){
+ solutionInfo.setHomed(true);
+ si.setServiceInstanceId(identifierValue);
+ si.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId"));
+ if(assignmentsMap.containsKey("vnfHostName")){
+ log.debug("Resources has been homed to a vnf");
+ GenericVnf vnf = setVnf(assignmentsMap);
+ vnf.setCloudRegion(cloud);
+ si.getVnfs().add(vnf);
+
+ }else if(assignmentsMap.containsKey("primaryPnfName")){
+ log.debug("Resources has been homed to a pnf");
+ Pnf priPnf = setPnf(assignmentsMap, "primary");
+ priPnf.setCloudRegion(cloud);
+ si.getPnfs().add(priPnf);
+ if(assignmentsMap.containsKey("secondaryPnfName")){
+ Pnf secPnf = setPnf(assignmentsMap, "secondary");
+ secPnf.setCloudRegion(cloud);
+ si.getPnfs().add(secPnf);
+ }
+ }
+ }else{
+ log.debug(invalidMessage + IDENTIFIER_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
+ }
+ }else if(type.equals("cloud")){
+ if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
+ log.debug("Resources has been homed to a cloud region");
+ cloud.setLcpCloudRegionId(identifierValue);
+ solutionInfo.setHomed(false);
+ solutionInfo.setTargetedCloudRegion(cloud);
+ si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ }else{
+ log.debug(invalidMessage + IDENTIFIER_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
+ }
+ }else{
+ log.debug(invalidMessage + INVENTORY_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE);
+ }
+ si.setSolutionInfo(solutionInfo);
+ return si;
+ }
+
+ /**
+ * Sets the cloud data to a cloud region object
+ *
+ */
+ private CloudRegion setCloud(Map<String, String> assignmentsMap){
+ CloudRegion cloud = new CloudRegion();
+ cloud.setCloudOwner(assignmentsMap.get("cloudOwner"));
+ cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion"));
+ cloud.setComplex(assignmentsMap.get("aicClli"));
+ return cloud;
+ }
+
+ /**
+ * Sets the vnf data to a generic vnf object
+ *
+ */
+ private GenericVnf setVnf(Map<String, String> assignmentsMap){
+ GenericVnf vnf = new GenericVnf();
+ vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ vnf.setVnfName(assignmentsMap.get("vnfHostName"));
+ vnf.setVnfId(assignmentsMap.get("vnfId"));
+ return vnf;
+ }
+
+ /**
+ * Sets the pnf data to a pnf object
+ *
+ */
+ private Pnf setPnf(Map<String, String> assignmentsMap, String role){
+ Pnf pnf = new Pnf();
+ pnf.setRole(role);
+ pnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ pnf.setPnfName(assignmentsMap.get(role + "PnfName"));
+ return pnf;
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java
new file mode 100644
index 0000000000..6571971347
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+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.ExceptionBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAICommonTasks {
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public Optional<String> getServiceType(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ ModelInfoServiceInstance model = serviceInstance.getModelInfoServiceInstance();
+ if (model != null) {
+ return Optional.of(model.getServiceType());
+ }
+ } catch(Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ return Optional.empty();
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
new file mode 100644
index 0000000000..79613047e5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -0,0 +1,379 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.onap.so.client.orchestration.AAIVpnBindingResources;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAICreateTasks {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateTasks.class);
+ private static final String networkTypeProvider = "PROVIDER";
+ private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
+ @Autowired
+ private AAIServiceInstanceResources aaiSIResources;
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Autowired
+ private AAIVfModuleResources aaiVfModuleResources;
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+ @Autowired
+ private AAIVpnBindingResources aaiVpnBindingResources;
+
+ public void createServiceInstance(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = execution.getGeneralBuildingBlock().getCustomer();
+ aaiSIResources.createServiceInstance(serviceInstance, customer);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createServiceSubscription(BuildingBlockExecution execution){
+ try{
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution,
+ ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = execution.getGeneralBuildingBlock().getCustomer();
+ if (null == customer) {
+ String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ + serviceInstance.getServiceInstanceId();
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ }
+ aaiSIResources.createServiceSubscription(customer);
+ } catch (BpmnError ex) {
+ throw ex;
+ }
+ catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createProject(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Project project = serviceInstance.getProject();
+ if(project != null) {
+ if (project.getProjectName() == null || "".equals(project.getProjectName())) {
+ msoLogger.info("ProjectName is null in input. Skipping create project...");
+ } else {
+ aaiSIResources.createProjectandConnectServiceInstance(project, serviceInstance);
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createOwningEntity(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ OwningEntity owningEntity = serviceInstance.getOwningEntity();
+ String owningEntityId = owningEntity.getOwningEntityId();
+ String owningEntityName = owningEntity.getOwningEntityName();
+ if (owningEntityId == null || "".equals(owningEntityId)) {
+ String msg = "Exception in AAICreateOwningEntity. OwningEntityId is null.";
+ execution.setVariable("ErrorCreateOEAAI", msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ } else {
+ if (aaiSIResources.existsOwningEntity(owningEntity)) {
+ aaiSIResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance);
+ } else {
+ if (owningEntityName == null || "".equals(owningEntityName)) {
+ String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName.";
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ } else {
+ if(aaiSIResources.existsOwningEntityName(owningEntityName)){
+ String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }else{
+ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ execution.setVariable("callHoming", vnf.isCallHoming());
+ aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createPlatform(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ Platform platform = vnf.getPlatform();
+ if(platform != null) {
+ if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) {
+ msoLogger.debug("PlatformName is null in input. Skipping create platform...");
+ } else {
+ aaiVnfResources.createPlatformandConnectVnf(platform,vnf);
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public void createLineOfBusiness(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
+ if(lineOfBusiness != null) {
+ if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) {
+ msoLogger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness...");
+ } else {
+ aaiVnfResources.createLineOfBusinessandConnectVnf(lineOfBusiness,vnf);
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion);
+ aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
+ aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup,cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createVfModule(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ aaiVfModuleResources.createVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void connectVfModuleToVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VolumeGroup volumeGroup = null;
+ try{
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ } catch (BBObjectNotFoundException e){
+ msoLogger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup");
+ }
+ if (volumeGroup != null) {
+ aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, execution.getGeneralBuildingBlock().getCloudRegion());
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to execute Create L3Network operation (PUT )in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void createNetwork(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ //set default to false. ToBe updated by SDNC
+ l3network.setIsBoundToVpn(false);
+ //define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER
+ if (l3network.getModelInfoNetwork().getNeutronNetworkType().equalsIgnoreCase(networkTypeProvider))
+ l3network.setIsBoundToVpn(true);
+ //put network shell in AAI
+ aaiNetworkResources.createNetworkConnectToServiceInstance(l3network, serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+ public void createCustomer(BuildingBlockExecution execution) throws Exception {
+ try {
+ Customer customer = execution.getGeneralBuildingBlock().getCustomer();
+
+ aaiVpnBindingResources.createCustomer(customer);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to execute NetworkCollection operation (PUT) in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void createNetworkCollection(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Collection networkCollection = serviceInstance.getCollection();
+ //pass name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow
+ //put shell in AAI
+ networkCollection.setName(execution.getVariable(NETWORK_COLLECTION_NAME));
+ aaiNetworkResources.createNetworkCollection(networkCollection);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to execute NetworkCollectionInstanceGroup operation (PUT) in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
+ //set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow
+ instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME));
+ //put shell in AAI
+ aaiNetworkResources.createNetworkInstanceGroup(instanceGroup);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void connectNetworkToTenant(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ aaiNetworkResources.connectNetworkToTenant(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void connectNetworkToCloudRegion(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ aaiNetworkResources.connectNetworkToCloudRegion(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(l3network, serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ //connect network only if Instance Group / Collection objects exist
+ if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null)
+ aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
new file mode 100644
index 0000000000..cb265b6e41
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -0,0 +1,136 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIDeleteTasks {
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIServiceInstanceResources aaiSIResources;
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
+ @Autowired
+ private AAIVfModuleResources aaiVfModuleResources;
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+ @Autowired
+ private AAIVolumeGroupResources aaiVolumeGroupResources;
+
+ public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+
+ execution.setVariable("aaiVfModuleRollback", false);
+ try {
+ aaiVfModuleResources.deleteVfModule(vfModule, genericVnf);
+ execution.setVariable("aaiVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteVnf(BuildingBlockExecution execution) throws Exception {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ execution.setVariable("aaiVnfRollback", false);
+ try {
+ aaiVnfResources.deleteVnf(genericVnf);
+ execution.setVariable("aaiVnfRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ aaiSIResources.deleteServiceInstance(serviceInstance);
+ }
+ catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public void deleteNetwork(BuildingBlockExecution execution) throws Exception {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ aaiNetworkResources.deleteNetwork(l3network);
+ execution.setVariable("isRollbackNeeded", true);
+ }
+ catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteCollection(BuildingBlockExecution execution) throws Exception {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ aaiNetworkResources.deleteCollection(serviceInstance.getCollection());
+ }
+ catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ }
+ catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
+ aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
new file mode 100644
index 0000000000..53d0e0a45c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIFlagTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIFlagTasks.class);
+
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public void checkVnfInMaintFlag(BuildingBlockExecution execution) {
+ boolean inMaint = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ String vnfId = vnf.getVnfId();
+ inMaint = aaiVnfResources.checkInMaintFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (inMaint) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF is in maintenance in A&AI");
+ }
+ }
+
+ public void modifyVnfInMaintFlag(BuildingBlockExecution execution, boolean inMaint) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ copiedGenericVnf.setInMaint(inMaint);
+ genericVnf.setInMaint(inMaint);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
new file mode 100644
index 0000000000..beffa25249
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
@@ -0,0 +1,241 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import org.modelmapper.ModelMapper;
+import org.modelmapper.PropertyMap;
+import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIQueryTasks {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIQueryTasks.class);
+ private static final String NETWORK_RESULT_WRAPPER_KEY = "l3NetworkAAIResultWrapper";
+ private static final String ERROR_MSG = "No relationships were returned from AAIResultWrapper.getRelationships()";
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+ private static final ModelMapper modelMapper = new ModelMapper();
+
+ /**
+ * BPMN access method to query L3Network object in AAI by it's Id
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void getNetworkWrapperById(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ execution.setVariable(NETWORK_RESULT_WRAPPER_KEY, aaiResultWrapper);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to query data for VPN bindings from the AAI result wrapper.
+ * The resulting VPN bindings are mapped to the corresponding bbobject and placed in the customer bbobject
+ *
+ * @param execution
+ */
+
+ public void queryNetworkVpnBinding(BuildingBlockExecution execution) {
+ try {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>();
+ if(netBindingsUriList != null && !netBindingsUriList.isEmpty()) {
+ for(AAIResourceUri netBindingUri : netBindingsUriList) {
+ Optional<VpnBinding> oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri);
+ if(oVpnBinding.isPresent()) {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding mappedVpnBinding =
+ modelMapper.map(oVpnBinding.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding.class);
+ if (oVpnBinding.get().getRouteTargets() != null){
+ mappedVpnBinding.getRouteTargets().addAll(mapRouteTargets(oVpnBinding.get().getRouteTargets().getRouteTarget()));
+ mappedVpnBindings.add(mappedVpnBinding);
+ }
+ }
+ }
+ }
+ execution.getGeneralBuildingBlock().getCustomer().getVpnBindings().addAll(mappedVpnBindings);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to extract VPN Binding data from AAI result and populate proper fields into CreateNetworkRequest
+ */
+ public void getNetworkVpnBinding(BuildingBlockExecution execution) {
+
+ try {
+ AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest");
+
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> netBindingsUriList = networkRelationships.get()
+ .getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+ List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>();
+ for (AAIResourceUri netBindingUri : netBindingsUriList) {
+ msoLogger.info("Get Route Targests");
+ Optional<VpnBinding> oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri);
+ if (oVpnBinding.isPresent()) {
+ VpnBinding vpnBinding = oVpnBinding.get();
+ RouteTargets rts = vpnBinding.getRouteTargets();
+ if (rts != null) {
+ List<org.onap.aai.domain.yang.RouteTarget> rtList = rts.getRouteTarget();
+ if (!rtList.isEmpty()) {
+ PropertyMap<org.onap.aai.domain.yang.RouteTarget, org.onap.so.openstack.beans.RouteTarget> personMap = new PropertyMap<org.onap.aai.domain.yang.RouteTarget, org.onap.so.openstack.beans.RouteTarget>() {
+ @Override
+ protected void configure() {
+ map().setRouteTarget(source.getGlobalRouteTarget());
+ map(source.getRouteTargetRole(), destination.getRouteTargetRole());
+ }
+ };
+ modelMapper.addMappings(personMap);
+ for (org.onap.aai.domain.yang.RouteTarget rt : rtList) {
+ org.onap.so.openstack.beans.RouteTarget openstackRtBean = modelMapper.map(rt,
+ org.onap.so.openstack.beans.RouteTarget.class);
+ routeTargets.add(openstackRtBean);
+ }
+ }
+ }
+ }
+ }
+ // store route targets data in execution - to be used as part of
+ // Network adapter input
+ createNetworkRequest.getContrailNetwork().setRouteTargets(routeTargets);
+ execution.setVariable("createNetworkRequest", createNetworkRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to query data for network policies from the AAI result wrapper
+ * From the resulting network policy, the network policy fqdn parameter is added to
+ * the network bbobject contrail network policy fqdns list
+ *
+ * @param execution
+ */
+ public void queryNetworkPolicy(BuildingBlockExecution execution) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+
+ AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> netPoliciesUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY);
+
+ if(!netPoliciesUriList.isEmpty()) {
+ for(AAIResourceUri netPolicyUri : netPoliciesUriList) {
+ Optional<NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
+ if(oNetPolicy.isPresent()) {
+ l3Network.getNetworkPolicies().add(modelMapper.map(oNetPolicy.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy.class));
+ }
+ }
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to query data for network table ref from the AAI result wrapper
+ * The resulting route table reference is mapped to the corresponding bbobject and added
+ * to the network bbobject contrail network route table references list
+ *
+ * @param execution
+ */
+ public void queryNetworkTableRef(BuildingBlockExecution execution) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+
+ AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> routeTableUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE);
+
+ if(!routeTableUriList.isEmpty()) {
+ for(AAIResourceUri routeTableUri : routeTableUriList) {
+ Optional<RouteTableReference> oRouteTableReference = aaiNetworkResources.getRouteTable(routeTableUri);
+ if(oRouteTableReference.isPresent()) {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference mappedRouteTableReference = modelMapper.map(oRouteTableReference.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference.class);
+ l3Network.getContrailNetworkRouteTableReferences().add(mappedRouteTableReference);
+ }
+ }
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private List<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget> mapRouteTargets(List<org.onap.aai.domain.yang.RouteTarget> routeTargets) {
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget> mappedRouteTargets = new ArrayList<>();
+ if(!routeTargets.isEmpty()) {
+ for(org.onap.aai.domain.yang.RouteTarget routeTarget : routeTargets) {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget mappedRouteTarget = modelMapper.map(routeTarget, org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget.class);
+ mappedRouteTargets.add(mappedRouteTarget);
+ }
+ }
+ return mappedRouteTargets;
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
new file mode 100644
index 0000000000..074652e221
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -0,0 +1,370 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIUpdateTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIUpdateTasks.class);
+ @Autowired
+ private AAIServiceInstanceResources aaiServiceInstanceResources;
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
+ @Autowired
+ private AAIVfModuleResources aaiVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+ @Autowired
+ private AAICollectionResources aaiCollectionResources;
+
+ public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
+ execution.setVariable("aaiServiceInstanceRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ volumeGroup.setHeatStackId("");
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
+ execution.setVariable("aaiDeactivateVfModuleRollback", false);
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);
+ execution.setVariable("aaiDeactivateVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Assigned in AAI
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("aaiNetworkAssignRollback", false);
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network copiedl3network = l3network.shallowCopyId();
+
+
+ l3network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ l3network.setHeatStackId("");
+
+ copiedl3network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ copiedl3network.setHeatStackId("");
+ aaiNetworkResources.updateNetwork(copiedl3network);
+ execution.setVariable("aaiNetworkAssignRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Active in AAI
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("aaiNetworkActivateRollback", false);
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network copiedl3network = l3network.shallowCopyId();
+
+ copiedl3network.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ l3network.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ aaiNetworkResources.updateNetwork(copiedl3network);
+ execution.setVariable("aaiNetworkActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Created in AAI
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("aaiNetworkActivateRollback", false);
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network copiedl3network = l3network.shallowCopyId();
+
+ copiedl3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ l3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ aaiNetworkResources.updateNetwork(copiedl3network);
+ execution.setVariable("aaiNetworkActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update status of L3Network Collection to Active in AAI
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
+ execution.setVariable("aaiNetworkCollectionActivateRollback", false);
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Collection networkCollection = serviceInstance.getCollection();
+ Collection copiedNetworkCollection = networkCollection.shallowCopyId();
+
+ networkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ copiedNetworkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ aaiCollectionResources.updateCollection(copiedNetworkCollection);
+ execution.setVariable("aaiNetworkCollectionActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
+ execution.setVariable("aaiActivateVfModuleRollback", false);
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
+ execution.setVariable("aaiActivateVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update L3Network after it was created in AIC
+ * @param execution
+ * @throws Exception
+ */
+ public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("aaiNetworkActivateRollback", false);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network copiedl3network = l3network.shallowCopyId();
+ CreateNetworkResponse response = execution.getVariable("createNetworkResponse");
+ try {
+ if(response.getNetworkFqdn()!=null){
+ l3network.setContrailNetworkFqdn(response.getNetworkFqdn());
+ }
+ l3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ l3network.setHeatStackId(response.getNetworkStackId());
+ l3network.setNeutronNetworkId(response.getNeutronNetworkId());
+
+ copiedl3network.setContrailNetworkFqdn(response.getNetworkFqdn());
+ copiedl3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ copiedl3network.setHeatStackId(response.getNetworkStackId());
+ copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
+
+ aaiNetworkResources.updateNetwork(copiedl3network);
+ execution.setVariable("aaiNetworkActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateObjectNetwork(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ aaiNetworkResources.updateNetwork(l3network);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update ServiceInstance
+ * @param execution
+ */
+ public void updateServiceInstance(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateObjectVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVnfResources.updateObjectVnf(genericVnf);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
+ execution.setVariable("aaiDeleteVfModuleRollback", false);
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ VfModule copiedVfModule = vfModule.shallowCopyId();
+ copiedVfModule.setHeatStackId("");
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
+ execution.setVariable("aaiDeleteVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateModelVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
new file mode 100644
index 0000000000..bc3845d760
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.network.tasks;
+
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkAdapterCreateTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterCreateTasks.class);
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+
+
+ public void createNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("networkAdapterCreateRollback", false);
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+
+ Map<String, String> userInput = gBBInput.getUserInput();
+ String cloudRegionPo = execution.getVariable("cloudRegionPo");
+ Optional<CreateNetworkResponse> oCreateNetworkResponse = networkAdapterResources.createNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
+
+ if (oCreateNetworkResponse.isPresent()){
+ CreateNetworkResponse createNetworkResponse = oCreateNetworkResponse.get();
+ l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId());
+ if (createNetworkResponse.getNetworkCreated()){
+ //setting rollback TRUE only if network was actually created (not a silent success OP)
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+ execution.setVariable("networkAdapterCreateRollback", true);
+ }
+ }
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void rollbackCreateNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
+
+ Map<String, String> userInput = gBBInput.getUserInput();
+ String cloudRegionPo = execution.getVariable("cloudRegionPo");
+ networkAdapterResources.rollbackCreateNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
new file mode 100644
index 0000000000..0f0f73ddf1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.network.tasks;
+
+import java.util.Optional;
+
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkAdapterDeleteTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterDeleteTasks.class);
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void deleteNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ Optional<DeleteNetworkResponse> oDeleteNetworkResponse = networkAdapterResources.deleteNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
+
+ if (oDeleteNetworkResponse.isPresent()){
+ DeleteNetworkResponse deleteNetworkResponse = oDeleteNetworkResponse.get();
+ if (deleteNetworkResponse.getNetworkDeleted()) {
+ execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
new file mode 100644
index 0000000000..ef2cf86f01
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.adapter.network.tasks;
+
+import java.util.Optional;
+
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkAdapterUpdateTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterUpdateTasks.class);
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void updateNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ Optional<UpdateNetworkResponse> oUpdateNetworkResponse = networkAdapterResources.updateNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer());
+
+ if(oUpdateNetworkResponse.isPresent()) {
+ UpdateNetworkResponse updateNetworkResponse = oUpdateNetworkResponse.get();
+ execution.setVariable("NetworkAdapterUpdateNetworkResponse", updateNetworkResponse);
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
new file mode 100644
index 0000000000..69fc633bbd
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.vnf.tasks;
+
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
+import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfAdapterCreateTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class);
+ private static final String VNFREST_REQUEST = "VNFREST_Request";
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
+ @Autowired
+ private VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void createVolumeGroupRequest(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VfModule vfModule;
+ String sdncVfModuleQueryResponse = null;
+ try {
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
+ sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+ }
+ else {
+ throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value");
+ }
+ } catch(BBObjectNotFoundException bbException) {
+ // If there is not a vf module in the general building block (in aLaCarte case), we will not retrieve the SDNCQueryResponse and proceed as normal without throwing an error
+ }
+
+ CreateVolumeGroupRequest createVolumeGroupRequest = vnfAdapterVolumeGroupResources.createVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+ execution.setVariable(VNFREST_REQUEST, createVolumeGroupRequest.toXmlString());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+
+ public void createVfModule(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ OrchestrationContext orchestrationContext = gBBInput.getOrchContext();
+ String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+ String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId());
+
+ CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+ execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
new file mode 100644
index 0000000000..6ec9007cd0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.vnf.tasks;
+
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
+import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfAdapterDeleteTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteTasks.class);
+ private static final String VNFREST_REQUEST = "VNFREST_Request";
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
+ @Autowired
+ private VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void deleteVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+
+ vnfAdapterVolumeGroupResources.deleteVolumeGroup(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteVfModule(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ DeleteVfModuleRequest deleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest( gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, genericVnf, vfModule);
+ execution.setVariable(VNFREST_REQUEST, deleteVfModuleRequest.toXmlString());
+ execution.setVariable("deleteVfModuleRequest", "true");
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
new file mode 100644
index 0000000000..aa865f0340
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -0,0 +1,126 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.adapter.vnf.tasks;
+
+import org.apache.commons.lang3.StringUtils;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.exceptions.MarshallerException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
+import java.io.StringReader;
+
+@Component
+public class VnfAdapterImpl {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class);
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void preProcessVnfAdapter(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ execution.setVariable("isDebugLogEnabled", "true");
+ execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void postProcessVnfAdapter(BuildingBlockExecution execution) {
+ try {
+ String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ if (!StringUtils.isEmpty( vnfAdapterResponse)) {
+ Object vnfRestResponse = unMarshal(vnfAdapterResponse);
+ if(vnfRestResponse instanceof CreateVfModuleResponse) {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
+ if(!StringUtils.isEmpty(heatStackId)) {
+ vfModule.setHeatStackId(heatStackId);
+ }
+ } else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
+ if(null!= vfModuleDelete && vfModuleDelete) {
+ vfModule.setHeatStackId(null);
+ }
+ } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
+ if(!StringUtils.isEmpty(heatStackId)) {
+ volumeGroup.setHeatStackId(heatStackId);
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
+ }
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private Object unMarshal(String input) throws MarshallerException {
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+ JAXBContext jaxbContext = JAXBContext.newInstance(CreateVfModuleResponse.class,
+ CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class);
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+
+ InputSource inputSource = new InputSource(new StringReader(input));
+ SAXSource source = new SAXSource(xmlReader, inputSource);
+ return jaxbUnmarshaller.unmarshal(source);
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e);
+ throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
new file mode 100644
index 0000000000..06c65020f5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AssignNetwork {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ AssignNetwork.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ /**
+ * Check if there are collection(s)
+ * @param execution
+ * @return boolean
+ */
+ public boolean hasCollection(BuildingBlockExecution execution) {
+ boolean hasCollection = false;
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
+ execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ if (serviceInstance.getCollection() != null){
+ hasCollection = true;
+ msoLogger.debug("there are collections to create");
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ return hasCollection;
+ }
+
+ /**
+ * Check if network was found by name
+ * @param execution
+ * @return
+ */
+ public boolean networkFoundByName(BuildingBlockExecution execution) {
+ boolean networkFound = false;
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+
+ if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){
+ networkFound = true;
+ msoLogger.debug("network found in NOT PRECREATED status");
+ }
+ } catch (Exception ex) {
+ // return false if no network present
+ }
+ return networkFound;
+ }
+
+ /**
+ * BPMN access method. Return flag if BPMN flow should skip AAI interaction
+ * @param execution
+ * @return TRUE if network collection was NOT present OR network WAS found by name
+ */
+ public boolean skipNetworkCreationInAAI(BuildingBlockExecution execution) {
+
+ return !hasCollection(execution) || networkFoundByName(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
new file mode 100644
index 0000000000..6217f87420
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AssignNetworkBBUtils {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ AssignNetworkBBUtils.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+ @Autowired
+ private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ /**
+ * BPMN access method. Verify if network name was provided as input to BB
+ * @param execution
+ * @return
+ */
+ public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception {
+ boolean found = false;
+ //TODO - populate logic after iTrack MSO-2143 implemented
+ return found;
+ }
+
+ /**
+ * BPMN access method to extract Cloud Region data
+ * @param execution
+ * @throws Exception
+ */
+ public void getCloudRegion(BuildingBlockExecution execution) {
+ try{
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String cloudRegionSdnc;
+ String cloudRegionPo = cloudRegion.getLcpCloudRegionId();
+ if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")){
+ cloudRegionSdnc = "AAIAIC25";
+ } else {
+ cloudRegionSdnc = cloudRegionPo;
+ }
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
+ execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
+ }catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method. Process silent success scenario
+ * @param execution
+ */
+ public void processSilentSuccess(BuildingBlockExecution execution) {
+ String msg = "Silent success processing network assign";
+ msoLogger.info(msg);
+ }
+
+ /**
+ * BPMN access method. Process silent success scenario
+ * @param execution
+ */
+ public void failOrchestrationStatus(BuildingBlockExecution execution) {
+ BpmnError error = new BpmnError("Failed orchestration status verificaiton");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, error);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
new file mode 100644
index 0000000000..bf429ee4fc
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import java.util.List;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.common.name.generation.AAIObjectInstanceNameGenerator;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AssignVnf {
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Autowired
+ private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator;
+
+
+ public void createInstanceGroups(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
+ for(InstanceGroup instanceGroup : instanceGroups) {
+ if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ instanceGroup.setInstanceGroupName(aaiObjectInstanceNameGenerator.generateInstanceGroupName(instanceGroup, vnf));
+ aaiInstanceGroupResources.createInstanceGroup(instanceGroup);
+ aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf);
+ }
+ else if(ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf);
+ }
+ }
+ }
+ catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
new file mode 100644
index 0000000000..08d5afcc44
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import java.util.Map;
+
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateNetwork {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetwork.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+
+ /**
+ * BPMN access method to build CreateNetworkRequest object
+ *
+ */
+ public void buildCreateNetworkRequest(BuildingBlockExecution execution) throws Exception {
+ try{
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ Map<String, String> userInput = gBBInput.getUserInput();
+ String cloudRegionPo = execution.getVariable("cloudRegionPo");
+
+ CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
+
+ //set CreateNetowrkRequest object on execution to be re-used within current BB
+ execution.setVariable("createNetworkRequest", createNetworkRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
new file mode 100644
index 0000000000..222a5482c5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateNetworkCollection {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetworkCollection.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+
+ private static final String UNDERSCORE = "_";
+ private static final String NETWORK_COLLECTION_NAME = "networkCollectionName";
+
+ /**
+ * BPMN access method to build Network Collection Name
+ * @param execution
+ * @throws Exception
+ */
+ public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception {
+ try{
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
+ if(instanceGroup.getModelInfoInstanceGroup() != null) {
+ //Build collection name assembling SI name and IG function
+ if(serviceInstance.getServiceInstanceName() != null
+ && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) {
+ String networkCollectionName = serviceInstance.getServiceInstanceName().concat(UNDERSCORE).concat(instanceGroup.getModelInfoInstanceGroup().getFunction());
+ //set networkCollectionName object on execution to be re-used within current BB
+ execution.setVariable(NETWORK_COLLECTION_NAME, networkCollectionName);
+ } else {
+ throw new IllegalArgumentException("Cannot generate collection name because either one or both fields are null: "
+ + " Service Instance Name: " + serviceInstance.getServiceInstanceName()
+ + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction());
+ }
+ } else {
+ throw new IllegalArgumentException("Instance group model info is null");
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to connect Network Collection
+ * @param execution
+ * @throws Exception
+ */
+ public void connectCollectionToInstanceGroup(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("connectCollectionToInstanceGroupRollback", false);
+ try{
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Collection networkCollection = serviceInstance.getCollection();
+ aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(networkCollection.getInstanceGroup(), networkCollection);
+ execution.setVariable("connectCollectionToInstanceGroupRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to connect Network Collection
+ * @param execution
+ * @throws Exception
+ */
+ public void connectCollectionToServiceInstance(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("connectCollectionToServiceInstanceRollback", false);
+ try{
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Collection networkCollection = serviceInstance.getCollection();
+ aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance);
+ execution.setVariable("connectCollectionToServiceInstanceRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
new file mode 100644
index 0000000000..7051da150f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkBBUtils {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkBBUtils.class);
+
+ private static final String CLOUD_REGION_VER25 = "2.5";
+ private static final String CLOUD_REGION_AAIAIC25 = "AAIAIC25";
+
+ /**
+ * BPMN access method to check if Relationship's Related-To value exists.
+ *
+ * @param l3Network - L3Network object
+ * @param relatedToValue - String, ex: 'vf-module'
+ * @return boolean
+ */
+ public boolean isRelationshipRelatedToExists(Optional<org.onap.aai.domain.yang.L3Network> l3network, String relatedToValue) {
+ boolean isRelatedToExists = false;
+ if (l3network.isPresent()) {
+ List<org.onap.aai.domain.yang.Relationship> relationshipList = l3network.get().getRelationshipList().getRelationship();
+ for (org.onap.aai.domain.yang.Relationship relationship : relationshipList) {
+ if (relationship.getRelatedTo().equals(relatedToValue)) {
+ isRelatedToExists = true;
+ break;
+ }
+ }
+ }
+ return isRelatedToExists;
+ }
+
+ /**
+ * BPMN access method to extract Cloud Region data
+ * @param execution
+ * @param motsValue (ex: SourceSystem.SDNC or SourceSystem.PO)
+ */
+ public String getCloudRegion(BuildingBlockExecution execution, SourceSystem sourceValue) {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String cloudRegionId = cloudRegion.getLcpCloudRegionId();
+ if (sourceValue.equals(SourceSystem.SDNC) && CLOUD_REGION_VER25.equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) {
+ cloudRegionId = CLOUD_REGION_AAIAIC25;
+ }
+ return cloudRegionId;
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java
new file mode 100644
index 0000000000..596b280916
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+public enum SourceSystem {
+ PO,
+ SDNC
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
new file mode 100644
index 0000000000..f94b967643
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class UnassignNetworkBB {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UnassignNetworkBB.class);
+
+ private static String MESSAGE_CANNOT_PERFORM_UNASSIGN = "Cannot perform Unassign Network. Network is still related to ";
+ private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually.";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private NetworkBBUtils networkBBUtils;
+
+ /**
+ * BPMN access method to prepare overall error messages.
+ *
+ * @param execution - BuildingBlockExecution
+ * @param relatedToValue - String, ex: vf-module
+ * @return void - nothing
+ * @throws Exception
+ */
+
+ public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception {
+ try {
+ AAIResultWrapper aaiResultWrapper = execution.getVariable("l3NetworkAAIResultWrapper");
+ Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+ if (networkBBUtils.isRelationshipRelatedToExists(l3network, relatedToValue)) {
+ String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue;
+ execution.setVariable("ErrorUnassignNetworkBB", msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to getCloudRegionId
+ *
+ * @param execution - BuildingBlockExecution
+ * @return void - nothing
+ * @throws Exception
+ */
+
+ public void getCloudSdncRegion(BuildingBlockExecution execution) throws Exception {
+ try {
+ String cloudRegionSdnc = networkBBUtils.getCloudRegion(execution, SourceSystem.SDNC);
+ execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to prepare overall error messages.
+ *
+ * @param execution - BuildingBlockExecution
+ * @return void - nothing
+ */
+ public void errorEncountered(BuildingBlockExecution execution) {
+ String msg;
+ boolean isRollbackNeeded = execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false;
+ if (isRollbackNeeded == true) {
+ msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK;
+ } else {
+ msg = execution.getVariable("ErrorUnassignNetworkBB");
+ }
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
new file mode 100644
index 0000000000..b9360b3d81
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import java.util.List;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.common.name.generation.AAIObjectInstanceNameGenerator;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+@Component()
+public class UnassignVnf {
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Autowired
+ private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator;
+
+ public void deleteInstanceGroups(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
+ for(InstanceGroup instanceGroup : instanceGroups) {
+ if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
+ }
+ }
+ }
+ catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
new file mode 100644
index 0000000000..e587e80251
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCActivateTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCActivateTasks.class);
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+
+
+ public void activateVnf(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Customer customer = gBBInput.getCustomer();
+ String response = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ execution.setVariable("SDNCResponse", response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to perform Assign action on SDNC for L3Network
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ execution.setVariable("sdncNetworkActivateRollback", false);
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ try {
+ sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
+ execution.setVariable("sdncNetworkActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void activateVfModule(BuildingBlockExecution execution) {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = null;
+ GenericVnf vnf = null;
+ VfModule vfModule = null;
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
+ execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID,
+ execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID,
+ execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ execution.setVariable("sdncActivateVfModuleRollback", false);
+
+ String response = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ execution.setVariable("SDNCActivateVfModuleResponse", response);
+ execution.setVariable("sdncActivateVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
new file mode 100644
index 0000000000..95d52d6f2a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCAssignTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAssignTasks.class);
+ @Autowired
+ private SDNCServiceInstanceResources sdncSIResources;
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private SDNCNetworkResources sdncNetworkResources;
+
+ public void assignServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = gBBInput.getCustomer();
+ String response = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ execution.setVariable("SDNCResponse", response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void assignVnf(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String response = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, vnf.isCallHoming());
+ execution.setVariable("SDNCResponse", response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void assignVfModule(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VolumeGroup volumeGroup = null;
+ try{
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ } catch (BBObjectNotFoundException e){
+ msoLogger.info("No volume group was found.");
+ }
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ execution.setVariable("SDNCAssignResponse_"+ vfModule.getVfModuleId(), response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to perform Assign action on SDNC for L3Network
+ * @param execution
+ * @throws Exception
+ */
+ public void assignNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
new file mode 100644
index 0000000000..cae4dc26de
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCChangeAssignTasks {
+ @Autowired
+ private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private SDNCServiceInstanceResources sdncServiceInstanceResources;
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+
+ public void changeModelServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ String response = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
+ execution.setVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response", response);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void changeModelVnf(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ String response = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
+ execution.setVariable("SDNCChangeModelVnfResponse", response);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void changeAssignNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ String sdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
+ execution.setVariable("SDNCChangeAssignNetworkResponse", sdncResponse);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void changeAssignModelVfModule(BuildingBlockExecution execution) throws Exception {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ Customer customer = gBBInput.getCustomer();
+ String response = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ execution.setVariable("SDNCChangeAssignVfModuleResponse", response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
new file mode 100644
index 0000000000..1f6ec72f34
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCDeactivateTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ SDNCDeactivateTasks.class);
+ @Autowired
+ private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private SDNCServiceInstanceResources sdncSIResources;
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public void deactivateVfModule(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
+ execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID,
+ execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID,
+ execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ execution.setVariable("sdncDeactivateVfModuleRollback", false);
+
+ String response = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer,
+ cloudRegion, requestContext);
+ execution.setVariable("SDNCDeactivateVfModuleResponse", response);
+ execution.setVariable("sdncDeactivateVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf
+ * @param execution
+ * @throws Exception
+ */
+ public void deactivateVnf(BuildingBlockExecution execution) throws Exception {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = null;
+ GenericVnf vnf = null;
+
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
+ execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID,
+ execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Customer customer = gBBInput.getCustomer();
+ String response = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ execution.setVariable("SDNCDeactivateVnfResponse", response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /*
+ * BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance
+ * @param execution
+ * @throws Exception
+ */
+ public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
+ execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = gBBInput.getCustomer();
+ execution.setVariable("sdncServiceInstanceRollback", false);
+ String response = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ execution.setVariable("deactivateServiceInstanceSDNCResponse", response);
+ execution.setVariable("sdncServiceInstanceRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to invoke deactivate on a L3Network object
+ *
+ * @param execution
+ */
+ public void deactivateNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", false);
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ String response = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.response", response);
+ execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java
new file mode 100644
index 0000000000..6d81cba41d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCDeleteTasks {
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
new file mode 100644
index 0000000000..1fe3143c4a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCQueryTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCQueryTasks.class);
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ try {
+ String response = sdncVnfResources.queryVnf(genericVnf);
+ execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+
+ public void queryVfModule(BuildingBlockExecution execution) throws Exception {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+
+ try {
+ if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
+ String response = sdncVfModuleResources.queryVfModule(vfModule);
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
+ }
+ else {
+ throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value");
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
+ String response = sdncVfModuleResources.queryVfModule(vfModule);
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
+ }
+ else {
+ throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value");
+ }
+ } catch(BBObjectNotFoundException bbException) {
+ // If there is not a vf module in the general building block, we will not call SDNC and proceed as normal without throwing an error
+ // If we see a bb object not found exception for something that is not a vf module id, then we should throw the error as normal
+ if(!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException);
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
new file mode 100644
index 0000000000..13639daa44
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+
+@Component
+public class SDNCUnassignTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCUnassignTasks.class);
+ @Autowired
+ private SDNCServiceInstanceResources sdncSIResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private SDNCNetworkResources sdncNetworkResources;
+
+ public void unassignServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+
+ if (serviceInstance.getOrchestrationStatus() == OrchestrationStatus.INVENTORIED) {
+ return; // If INVENTORIED then SDNC unassign is not necessary
+ }
+
+ RequestContext requestContext = gBBInput.getRequestContext();
+ Customer customer = gBBInput.getCustomer();
+ String sdncUnassignResponse = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
+ execution.setVariable("sdncUnassignResponse", sdncUnassignResponse);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void unassignVfModule(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+
+ if (OrchestrationStatus.INVENTORIED == vfModule.getOrchestrationStatus() || OrchestrationStatus.PENDING_CREATE == vfModule.getOrchestrationStatus()) {
+ return; // If INVENTORIED or PENDING_CREATE then SDNC unassign is not necessary
+ }
+
+ execution.setVariable("sdncVfModuleRollback", false);
+
+ String response = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+ execution.setVariable("SDNCResponse", response);
+ execution.setVariable("sdncVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void unassignVnf(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ if (OrchestrationStatus.INVENTORIED == vnf.getOrchestrationStatus() || OrchestrationStatus.CREATED == vnf.getOrchestrationStatus()) {
+ return; // If INVENTORIED or CREATED then SDNC unassign is not necessary
+ }
+
+ RequestContext requestContext = gBBInput.getRequestContext();
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ execution.setVariable("sdncVnfRollback", false);
+ String response = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ execution.setVariable("sdncUnassignVnfResponse", response);
+ execution.setVariable("sdncVnfRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+
+ if (OrchestrationStatus.INVENTORIED == network.getOrchestrationStatus()) {
+ return; // If INVENTORIED then SDNC unassign is not necessary
+ }
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
+ cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
+ try {
+ String response = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ execution.setVariable("SDNCUnAssignNetworkResponse", response);
+ execution.setVariable("isRollbackNeeded", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
new file mode 100644
index 0000000000..55ebad68aa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.OrchestrationStatusValidationException;
+import org.onap.so.db.catalog.beans.BuildingBlockDetail;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
+import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class OrchestrationStatusValidator {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OrchestrationStatusValidator.class);
+
+ private static final String BUILDING_BLOCK_DETAIL_NOT_FOUND = "Building Block (%s) not set up in Orchestration_Status_Validation table in CatalogDB.";
+ private static final String UNKNOWN_RESOURCE_TYPE = "Building Block (%s) not set up correctly in Orchestration_Status_Validation table in CatalogDB. ResourceType=(%s), TargetAction=(%s)";
+ private static final String ORCHESTRATION_VALIDATION_FAIL = "Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
+ private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
+
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ public void validateOrchestrationStatus(BuildingBlockExecution execution) {
+ try {
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
+
+ String buildingBlockFlowName = (String) execution.getVariable("flowToBeCalled");
+
+ BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName);
+
+ if (buildingBlockDetail == null) {
+ throw new OrchestrationStatusValidationException(String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName));
+ }
+
+ OrchestrationStatus orchestrationStatus = null;
+
+ switch(buildingBlockDetail.getResourceType()) {
+ case SERVICE:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ orchestrationStatus = serviceInstance.getOrchestrationStatus();
+ break;
+ case VNF:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ orchestrationStatus = genericVnf.getOrchestrationStatus();
+ break;
+ case VF_MODULE:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ orchestrationStatus = vfModule.getOrchestrationStatus();
+ break;
+ case VOLUME_GROUP:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ orchestrationStatus = volumeGroup.getOrchestrationStatus();
+ break;
+ case NETWORK:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ orchestrationStatus = network.getOrchestrationStatus();
+ break;
+ case NETWORK_COLLECTION:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection = serviceInst.getCollection();
+ orchestrationStatus = networkCollection.getOrchestrationStatus();
+ break;
+ case CONFIGURATION:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ orchestrationStatus = configuration.getOrchestrationStatus();
+ break;
+ default:
+ // can't currently get here, so not tested. Added in case enum is expanded without a change to this code
+ throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ }
+
+ if(orchestrationStatus==null){
+ throw new OrchestrationStatusValidationException("The resource's orchstration status is null. Cannot perform task on a null orchestration status");
+ }
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = catalogDbClient.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(), orchestrationStatus, buildingBlockDetail.getTargetAction());
+
+ if (orchestrationStatusStateTransitionDirective.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) {
+ throw new OrchestrationStatusValidationException(String.format(ORCHESTRATION_VALIDATION_FAIL, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction(), orchestrationStatus));
+ }
+
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, orchestrationStatusStateTransitionDirective.getFlowDirective());
+ } catch (Exception e) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
new file mode 100644
index 0000000000..fd5f00ed6f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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;
+
+public class Resource {
+
+ private String resourceId;
+ private WorkflowType resourceType;
+ private boolean generated;
+ private boolean baseVfModule;
+
+ public Resource(WorkflowType resourceType, String resourceId, boolean generated){
+ this.resourceId = resourceId;
+ this.resourceType = resourceType;
+ this.generated = generated;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+ public WorkflowType getResourceType() {
+ return resourceType;
+ }
+ public void setResourceType(WorkflowType resourceType) {
+ this.resourceType = resourceType;
+ }
+ public boolean isGenerated() {
+ return generated;
+ }
+ public void setGenerated(boolean generated) {
+ this.generated = generated;
+ }
+ public boolean isBaseVfModule() {
+ return baseVfModule;
+ }
+ public void setBaseVfModule(boolean baseVfModule) {
+ this.baseVfModule = baseVfModule;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
new file mode 100644
index 0000000000..0f02928d16
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -0,0 +1,864 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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 java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.javatuples.Pair;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
+import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class WorkflowAction {
+
+ private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow";
+ private static final String G_ACTION = "requestAction";
+ private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
+ private static final String G_REQUEST_ID = "mso-request-id";
+ private static final String G_BPMN_REQUEST = "bpmnRequest";
+ private static final String G_ALACARTE = "aLaCarte";
+ private static final String G_APIVERSION = "apiVersion";
+ private static final String G_URI = "requestUri";
+ private static final String G_ISTOPLEVELFLOW = "isTopLevelFlow";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String SERVICE = "Service";
+ private static final String VNF = "Vnf";
+ private static final String VFMODULE = "VfModule";
+ private static final String VOLUMEGROUP = "VolumeGroup";
+ private static final String NETWORK = "Network";
+ private static final String NETWORKCOLLECTION = "NetworkCollection";
+ private static final String ASSIGNINSTANCE = "assignInstance";
+ private static final String CREATEINSTANCE = "createInstance";
+ private static final String USERPARAMSERVICE = "service";
+ private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances";
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowAction.class);
+
+ @Autowired
+ protected BBInputSetup bbInputSetup;
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ }
+
+ public void setBbInputSetup(BBInputSetup bbInputSetup) {
+ this.bbInputSetup = bbInputSetup;
+ }
+
+ public void selectExecutionList(DelegateExecution execution) throws Exception {
+ final String requestAction = (String) execution.getVariable(G_ACTION);
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String apiVersion = (String) execution.getVariable(G_APIVERSION);
+ final String uri = (String) execution.getVariable(G_URI);
+ final String vnfType = (String) execution.getVariable(VNF_TYPE);
+ List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
+ List<Resource> resourceCounter = new ArrayList<>();
+
+ execution.setVariable("sentSyncResponse", false);
+ execution.setVariable("homing", false);
+ execution.setVariable("calledHoming", false);
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ execution.setVariable(G_ISTOPLEVELFLOW, true);
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ Resource resource = extractResourceIdAndTypeFromUri(uri);
+ WorkflowType resourceType = resource.getResourceType();
+ String resourceId = "";
+ if (resource.isGenerated()) {
+ resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
+ sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
+ workflowResourceIds);
+ } else {
+ resourceId = resource.getResourceId();
+ }
+ execution.setVariable("resourceId", resourceId);
+ execution.setVariable("resourceType", resourceType);
+
+ if (aLaCarte) {
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
+ }
+ String key = "";
+ ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
+ if(modelInfo.getModelType().equals(ModelType.service)) {
+ key = modelInfo.getModelVersionId();
+ } else {
+ key = modelInfo.getModelCustomizationId();
+ }
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false);
+ flowsToExecute.add(ebb);
+ }
+ } else {
+ boolean foundRelated = false;
+ boolean containsService = false;
+ if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
+ // SERVICE-MACRO-ASSIGN will always get user params with a
+ // service.
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters()
+ .getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(USERPARAMSERVICE)) {
+ containsService = true;
+ }
+ }
+ if (containsService) {
+ traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ }
+ } else {
+ buildAndThrowException(execution,
+ "Service-Macro-Assign request details must contain user params with a service");
+ }
+ } else if (resourceType == WorkflowType.SERVICE
+ && requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ // SERVICE-MACRO-CREATE will get user params with a service,
+ // a service with a network, a service with a
+ // networkcollection, OR an empty service.
+ // If user params is just a service or null and macro
+ // queries the SI and finds a VNF, macro fails.
+
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters()
+ .getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(USERPARAMSERVICE)) {
+ containsService = true;
+ }
+ }
+ }
+ if (containsService) {
+ foundRelated = traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ }
+ if (!foundRelated) {
+ traverseCatalogDbService(execution, sIRequest, resourceCounter);
+ }
+ } else if (resourceType == WorkflowType.SERVICE
+ && (requestAction.equalsIgnoreCase("activateInstance")
+ || requestAction.equalsIgnoreCase("unassignInstance")
+ || requestAction.equalsIgnoreCase("deleteInstance"))) {
+ // 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, resourceCounter, resourceId, aaiResourceIds);
+ } else if (resourceType == WorkflowType.SERVICE
+ && requestAction.equalsIgnoreCase("deactivateInstance")) {
+ resourceCounter.add(new Resource(WorkflowType.SERVICE,"",false));
+ } else {
+ buildAndThrowException(execution, "Current Macro Request is not supported");
+ }
+
+ String foundObjects = "";
+ for(WorkflowType type : WorkflowType.values()){
+ foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
+ }
+ msoLogger.info("Found " + foundObjects);
+
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
+ }
+ flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId,
+ resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
+ if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) {
+ msoLogger.info("Sorting for Vlan Tagging");
+ flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
+ }
+ if (resourceType == WorkflowType.SERVICE
+ && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
+ && !resourceCounter.stream().filter(x -> VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
+ execution.setVariable("homing", true);
+ execution.setVariable("calledHoming", false);
+ }
+ if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE))){
+ generateResourceIds(flowsToExecute, resourceCounter);
+ }else{
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds);
+ }
+ }
+
+ if (flowsToExecute.isEmpty()) {
+ throw new IllegalStateException("Macro did not come up with a valid execution path.");
+ }
+
+ msoLogger.info("List of BuildingBlocks to execute:");
+ for (ExecuteBuildingBlock ebb : flowsToExecute) {
+ msoLogger.info(ebb.getBuildingBlock().getBpmnFlowName());
+ }
+
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable("retryCount", 0);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+
+ } catch (Exception ex) {
+ buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
+ }
+ }
+
+ 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;
+ }
+
+ private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ for(Pair<WorkflowType,String> pair : aaiResourceIds){
+ msoLogger.debug(pair.getValue0() + ", " + pair.getValue1());
+ }
+
+ Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
+ List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
+ for(int i = 0; i < resources.size(); i++){
+ updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type));
+ }
+ });
+ }
+
+ private String retrieveAAIResourceId(List<Pair<WorkflowType, String>> aaiResourceIds, WorkflowType resource){
+ String id = null;
+ for(int i = 0; i<aaiResourceIds.size();i++){
+ if(aaiResourceIds.get(i).getValue0() == resource){
+ id = aaiResourceIds.get(i).getValue1();
+ aaiResourceIds.remove(i);
+ break;
+ }
+ }
+ return id;
+ }
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter) {
+ Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
+ List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
+ for(int i = 0; i < resources.size(); i++){
+ updateWorkflowResourceIds(flowsToExecute, type, resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
+ .collect(Collectors.toList()).get(i).getResourceId(), null); }
+ });
+ }
+
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id){
+ String resourceId = id;
+ if(resourceId==null){
+ resourceId = UUID.randomUUID().toString();
+ }
+ for(ExecuteBuildingBlock ebb : flowsToExecute){
+ if(key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())){
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ if(resource == WorkflowType.VNF){
+ workflowResourceIds.setVnfId(resourceId);
+ }else if(resource == WorkflowType.VFMODULE){
+ workflowResourceIds.setVfModuleId(resourceId);
+ }else if(resource == WorkflowType.VOLUMEGROUP){
+ workflowResourceIds.setVolumeGroupId(resourceId);
+ }else if(resource == WorkflowType.NETWORK){
+ workflowResourceIds.setNetworkId(resourceId);
+ }else if(resource == WorkflowType.NETWORKCOLLECTION){
+ workflowResourceIds.setNetworkCollectionId(resourceId);
+ }
+ ebb.setWorkflowResourceIds(workflowResourceIds);
+ }
+ }
+ }
+
+ protected CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution, org.onap.so.db.catalog.beans.Service service) {
+ CollectionResourceCustomization networkCollection = null;
+ int count = 0;
+ for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){
+ if(catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID())
+ instanceof NetworkCollectionResourceCustomization) {
+ networkCollection = collectionCust;
+ count++;
+ }
+ }
+ if(count == 0){
+ return null;
+ }else if(count > 1) {
+ buildAndThrowException(execution, "Found multiple Network Collections in the Service model, only one per Service is supported.");
+ }
+ return networkCollection;
+ }
+
+ protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
+ List<Resource> resourceCounter) {
+ String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
+ org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
+ if (service == null) {
+ buildAndThrowException(execution, "Could not find the service model in catalog db.");
+ } else {
+ resourceCounter.add(new Resource(WorkflowType.SERVICE,service.getModelUUID(),false));
+ if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if(customizations.isEmpty()) {
+ msoLogger.debug("No Collections found. CollectionResourceCustomization list is empty.");
+ }else{
+ CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service);
+ if(collectionResourceCustomization!=null){
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,collectionResourceCustomization.getModelCustomizationUUID(),false));
+ msoLogger.debug("Found a network collection");
+ if(collectionResourceCustomization.getCollectionResource()!=null){
+ if(collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null){
+ String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
+ if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
+ int minNetworks = 0;
+ InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ collectionInstCust = instanceGroup.getCollectionInstanceGroupCustomizations().get(0);
+ if(collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ msoLogger.debug("minNetworks: " + minNetworks);
+ for (int i = 0; i < minNetworks; i++) {
+ if(collectionInstCust != null) {
+
+ resourceCounter.add(
+ new Resource(WorkflowType.VIRTUAL_LINK,instanceGroup.getCollectionNetworkResourceCustomizations()
+ .get(0).getModelCustomizationUUID(),false));
+ }
+ }
+ } else {
+ msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType);
+ }
+ }else{
+ msoLogger.debug("No Instance Group found for network collection.");
+ }
+ }else{
+ msoLogger.debug("No Network Collection found. collectionResource is null");
+ }
+ } else {
+ msoLogger.debug("No Network Collection Customization found");
+ }
+ }
+ if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) {
+ if (service.getNetworkCustomizations() == null) {
+ msoLogger.debug("No networks were found on this service model");
+ } else {
+ for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORK,service.getNetworkCustomizations().get(i).getModelCustomizationUUID(),false));
+ }
+ }
+ }
+ } else {
+ 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");
+ }
+ }
+ }
+
+ protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceCounter, String resourceId, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try {
+ ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = bbInputSetup
+ .getExistingServiceInstance(serviceInstanceAAI);
+ resourceCounter.add(new Resource(WorkflowType.SERVICE,serviceInstanceMSO.getServiceInstanceId(),false));
+ if (serviceInstanceMSO.getVnfs() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO
+ .getVnfs()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getVnfId(),false));
+ if (vnf.getVfModules() != null) {
+ for (VfModule vfModule : vnf.getVfModules()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ resourceCounter.add(new Resource(WorkflowType.VFMODULE,vfModule.getVfModuleId(),false));
+ }
+ }
+ if (vnf.getVolumeGroups() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
+ .getVolumeGroups()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,volumeGroup.getVolumeGroupId(),false));
+ }
+ }
+ }
+ }
+ if (serviceInstanceMSO.getNetworks() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
+ .getNetworks()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORK, network.getNetworkId()));
+ resourceCounter.add(new Resource(WorkflowType.NETWORK,network.getNetworkId(),false));
+ }
+ }
+ if (serviceInstanceMSO.getCollection() != null) {
+ msoLogger.debug("found networkcollection");
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false));
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution,
+ "Could not find existing Service Instance or related Instances to execute the request on.");
+ }
+ }
+
+ protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter,
+ ServiceInstancesRequest sIRequest, String requestAction)
+ throws IOException {
+ boolean foundRelated = false;
+ boolean foundVfModuleOrVG = false;
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(USERPARAMSERVICE)) {
+ ObjectMapper obj = new ObjectMapper();
+ String input = obj.writeValueAsString(params.get(USERPARAMSERVICE));
+ Service validate = obj.readValue(input, Service.class);
+ resourceCounter.add(new Resource(WorkflowType.SERVICE,validate.getModelInfo().getModelVersionId(),false));
+ if (validate.getResources().getVnfs() != null) {
+ for (Vnfs vnf : validate.getResources().getVnfs()) {
+ resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getModelInfo().getModelCustomizationId(),false));
+ foundRelated = true;
+ if (vnf.getVfModules() != null) {
+ for (VfModules vfModule : vnf.getVfModules()) {
+ VfModuleCustomization vfModuleCustomization = catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(
+ vfModule.getModelInfo().getModelCustomizationUuid());
+ if (vfModuleCustomization != null) {
+ if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate()!=null &&vfModuleCustomization.getVolumeHeatEnv() != null) {
+ resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false));
+ foundRelated = true;
+ foundVfModuleOrVG = true;
+ }
+ if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getModuleHeatTemplate()!=null && vfModuleCustomization.getHeatEnvironment()!=null){
+ foundRelated = true;
+ foundVfModuleOrVG = true;
+ Resource resource = new Resource(WorkflowType.VFMODULE,vfModuleCustomization.getModelCustomizationUUID(),false);
+ if(vfModuleCustomization.getVfModule().getIsBase()!=null && vfModuleCustomization.getVfModule().getIsBase()){
+ resource.setBaseVfModule(true);
+ }else{
+ resource.setBaseVfModule(false);
+ }
+ resourceCounter.add(resource);
+ }
+ if(!foundVfModuleOrVG){
+ buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null");
+ }
+ }
+ }
+ }
+ }
+ }
+ if (validate.getResources().getNetworks() != null) {
+ for (Networks network : validate.getResources().getNetworks()) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORK,network.getModelInfo().getModelCustomizationId(),false));
+ foundRelated = true;
+ }
+ if (requestAction.equals(CREATEINSTANCE)) {
+ String networkColCustId = queryCatalogDBforNetworkCollection(execution, sIRequest);
+ if (networkColCustId != null) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,networkColCustId,false));
+ foundRelated = true;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ return foundRelated;
+ }
+
+ protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, ServiceInstancesRequest sIRequest) {
+ org.onap.so.db.catalog.beans.Service service = catalogDbClient
+ .getServiceByID(sIRequest.getRequestDetails().getModelInfo().getModelVersionId());
+ if (service != null) {
+ CollectionResourceCustomization networkCollection = this.findCatalogNetworkCollection(execution, service);
+ if(networkCollection != null) {
+ return networkCollection.getModelCustomizationUUID();
+ }
+ }
+ return null;
+ }
+
+ protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
+ workflowResourceIds.setNetworkId((String) execution.getVariable("networkId"));
+ workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
+ workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
+ workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
+ return workflowResourceIds;
+ }
+
+ protected Resource extractResourceIdAndTypeFromUri(String uri) {
+ Pattern patt = Pattern.compile(
+ "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ Matcher m = patt.matcher(uri);
+ Boolean generated = false;
+
+ if (m.find()) {
+ msoLogger.debug("found match on " + uri + ": " + m);
+ String type = m.group("type");
+ String id = m.group("id");
+ String action = m.group("action");
+ if (type == null) {
+ throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
+ }
+ if (action == null) {
+ if (type.equals("serviceInstances") && (id == null || id.equals("assign"))) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ }
+ } else {
+ if (action.matches(supportedTypes)) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ type = action;
+ }
+ }
+ return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated);
+ } else {
+ throw new IllegalArgumentException("Uri could not be parsed: " + uri);
+ }
+ }
+
+ protected String validateResourceIdInAAI(String generatedResourceId, WorkflowType type, String instanceName,
+ RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws Exception {
+ try {
+ if ("SERVICE".equalsIgnoreCase(type.toString())) {
+ String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId();
+ String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType();
+ if (instanceName != null) {
+ Optional<ServiceInstance> serviceInstanceAAI = bbInputSetupUtils
+ .getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName);
+ if (serviceInstanceAAI.isPresent()) {
+ return serviceInstanceAAI.get().getServiceInstanceId();
+ }
+ }
+ } else if ("NETWORK".equalsIgnoreCase(type.toString())) {
+ Optional<L3Network> network = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(
+ workflowResourceIds.getServiceInstanceId(), instanceName);
+ if (network.isPresent()) {
+ return network.get().getNetworkId();
+ }
+ } else if ("VNF".equalsIgnoreCase(type.toString())) {
+ Optional<GenericVnf> vnf = bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(
+ workflowResourceIds.getServiceInstanceId(), instanceName);
+ if (vnf.isPresent()) {
+ return vnf.get().getVnfId();
+ }
+ } else if ("VFMODULE".equalsIgnoreCase(type.toString())) {
+ GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
+ if (vnf != null && vnf.getVfModules() != null) {
+ for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) {
+ if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) {
+ return vfModule.getVfModuleId();
+ }
+ }
+ }
+ } else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) {
+ Optional<VolumeGroup> volumeGroup = bbInputSetupUtils
+ .getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName);
+ if (volumeGroup.isPresent()) {
+ return volumeGroup.get().getVolumeGroupId();
+ }
+ GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
+ if (vnf != null && vnf.getVfModules() != null) {
+ for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) {
+ Optional<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils
+ .getRelatedVolumeGroupByNameFromVfModule(vfModule.getVfModuleId(), instanceName);
+ if (volumeGroupFromVfModule.isPresent()) {
+ return volumeGroupFromVfModule.get().getVolumeGroupId();
+ }
+ }
+ }
+ }
+ return generatedResourceId;
+ } catch (Exception ex) {
+ throw new IllegalStateException(
+ "WorkflowAction was unable to verify if the instance name already exist in AAI.");
+ }
+ }
+
+ protected String convertTypeFromPlural(String type) {
+ if (!type.matches(supportedTypes)) {
+ return type;
+ } else {
+ if (type.equals("serviceInstances")) {
+ return SERVICE;
+ } else {
+ return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1);
+ }
+ }
+ }
+
+ protected List<ExecuteBuildingBlock> sortExecutionPathByObjectForVlanTagging(List<ExecuteBuildingBlock> orchFlows,
+ String requestAction) {
+ List<ExecuteBuildingBlock> sortedOrchFlows = new ArrayList<>();
+ if (requestAction.equals(CREATEINSTANCE)) {
+ for (ExecuteBuildingBlock ebb : orchFlows) {
+ if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) {
+ String key = ebb.getBuildingBlock().getKey();
+ sortedOrchFlows.add(ebb);
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ }
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ }
+ } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) {
+ continue;
+ } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
+ sortedOrchFlows.add(ebb);
+ }
+ }
+ } else if (requestAction.equals("deleteInstance")) {
+ for (ExecuteBuildingBlock ebb : orchFlows) {
+ if (ebb.getBuildingBlock().getBpmnFlowName().equals("DeactivateNetworkBB")) {
+ sortedOrchFlows.add(ebb);
+ String key = ebb.getBuildingBlock().getKey();
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (ebb2.getBuildingBlock().getBpmnFlowName().equals("DeleteNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ }
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (ebb2.getBuildingBlock().getBpmnFlowName().equals("UnassignNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ }
+ } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("DeleteNetworkBB")
+ || ebb.getBuildingBlock().getBpmnFlowName().equals("UnassignNetworkBB")) {
+ continue;
+ } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
+ sortedOrchFlows.add(ebb);
+ }
+ }
+ }
+ return sortedOrchFlows;
+ }
+
+ protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
+ List<Resource> resourceCounter, String requestId, String apiVersion, String resourceId, WorkflowType resourceType,
+ String requestAction, boolean aLaCarte, String vnfType,
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails) {
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ if (orchFlow.getFlowName().contains(SERVICE)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ workflowResourceIds.setServiceInstanceId(resourceId);
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ } else if (orchFlow.getFlowName().contains(VNF)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ } else if (orchFlow.getFlowName().contains(NETWORK)
+ && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true));
+ }
+ } else if (orchFlow.getFlowName().contains(VFMODULE)) {
+ List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
+ .collect(Collectors.toList()));
+ for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ } else {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ }
+ }
+ return flowsToExecute;
+ }
+
+ protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key,
+ String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink) {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ buildingBlock.setKey(key);
+ buildingBlock.setIsVirtualLink(isVirtualLink);
+ executeBuildingBlock.setApiVersion(apiVersion);
+ executeBuildingBlock.setaLaCarte(aLaCarte);
+ executeBuildingBlock.setRequestAction(requestAction);
+ executeBuildingBlock.setResourceId(resourceId);
+ executeBuildingBlock.setVnfType(vnfType);
+ executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
+ executeBuildingBlock.setRequestId(requestId);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ executeBuildingBlock.setRequestDetails(requestDetails);
+ return executeBuildingBlock;
+ }
+
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte) {
+ List<OrchestrationFlow> listToExecute = new ArrayList<>();
+ NorthBoundRequest northBoundRequest = catalogDbClient
+ .getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(requestAction, resourceName.toString(), aLaCarte);
+ if(northBoundRequest == null){
+ if(aLaCarte){
+ buildAndThrowException(execution,"The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API.");
+ }else{
+ buildAndThrowException(execution,"The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API.");
+ }
+ } else {
+ if(northBoundRequest.getIsToplevelflow()!=null){
+ execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
+ }
+ List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
+ if (flows == null)
+ flows = new ArrayList<>();
+ for (OrchestrationFlow flow : flows) {
+ if (!flow.getFlowName().contains("BB")) {
+ List<OrchestrationFlow> macroQueryFlows = catalogDbClient
+ .getOrchestrationFlowByAction(flow.getFlowName());
+ for (OrchestrationFlow macroFlow : macroQueryFlows) {
+ listToExecute.add(macroFlow);
+ }
+ } else {
+ listToExecute.add(flow);
+ }
+ }
+ }
+ return listToExecute;
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, ex);
+ execution.setVariable("WorkflowActionErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ msoLogger.error(msg);
+ execution.setVariable("WorkflowActionErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ public void handleRuntimeException (DelegateExecution execution){
+ StringBuffer wfeExpMsg = new StringBuffer("Runtime error ");
+ String runtimeErrorMessage = null;
+ try{
+ String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg");
+ if (javaExpMsg != null && !javaExpMsg.isEmpty()) {
+ wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg);
+ }
+ runtimeErrorMessage = wfeExpMsg.toString();
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, runtimeErrorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, runtimeErrorMessage);
+ execution.setVariable("WorkflowActionErrorMessage", runtimeErrorMessage);
+ } catch (Exception e){
+ //if runtime message was mulformed
+ runtimeErrorMessage = "Runtime error";
+ }
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, runtimeErrorMessage);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
new file mode 100644
index 0000000000..ee6af61d0f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -0,0 +1,261 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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 java.util.ArrayList;
+import java.util.List;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.client.db.request.RequestsDbClient;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.RequestReferences;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class WorkflowActionBBTasks {
+
+ private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
+ private static final String G_REQUEST_ID = "mso-request-id";
+ private static final String G_ALACARTE = "aLaCarte";
+ private static final String G_ACTION = "requestAction";
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowActionBBTasks.class);
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ @Autowired
+ private WorkflowAction workflowAction;
+
+ public void selectBB(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ execution.setVariable("MacroRollback", false);
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
+ boolean homing = (boolean) execution.getVariable("homing");
+ boolean calledHoming = (boolean) execution.getVariable("calledHoming");
+ if (homing && !calledHoming) {
+ if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignVnfBB")) {
+ ebb.setHoming(true);
+ execution.setVariable("calledHoming", true);
+ }
+ } else {
+ ebb.setHoming(false);
+ }
+ execution.setVariable("buildingBlock", ebb);
+ currentSequence++;
+ if (currentSequence >= flowsToExecute.size()) {
+ execution.setVariable("completed", true);
+ } else {
+ execution.setVariable("completed", false);
+ execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
+ }
+ }
+
+ public void sendSyncAck(DelegateExecution execution) {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String resourceId = (String) execution.getVariable("resourceId");
+ ServiceInstancesResponse serviceInstancesResponse = new ServiceInstancesResponse();
+ RequestReferences requestRef = new RequestReferences();
+ requestRef.setInstanceId(resourceId);
+ requestRef.setRequestId(requestId);
+ serviceInstancesResponse.setRequestReferences(requestRef);
+ ObjectMapper mapper = new ObjectMapper();
+ String jsonRequest = "";
+ try {
+ jsonRequest = mapper.writeValueAsString(serviceInstancesResponse);
+ } catch (JsonProcessingException e) {
+ workflowAction.buildAndThrowException(execution,
+ "Could not marshall ServiceInstancesRequest to Json string to respond to API Handler.", e);
+ }
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setStatusCode(200);
+ callbackResponse.setMessage("Success");
+ callbackResponse.setResponse(jsonRequest);
+ String processKey = execution.getProcessEngineServices().getRepositoryService()
+ .getProcessDefinition(execution.getProcessDefinitionId()).getKey();
+ WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId,
+ callbackResponse);
+ msoLogger.info("Successfully sent sync ack.");
+ }
+
+ public void sendErrorSyncAck(DelegateExecution execution) {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ try {
+ ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
+ String errorMsg = (String) execution.getVariable("WorkflowActionErrorMessage");
+ if (errorMsg == null) {
+ errorMsg = "WorkflowAction failed unexpectedly.";
+ }
+ String processKey = exceptionBuilder.getProcessKey(execution);
+ String buildworkflowException = "<aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>"
+ + errorMsg
+ + "</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException>";
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setStatusCode(500);
+ callbackResponse.setMessage("Fail");
+ callbackResponse.setResponse(buildworkflowException);
+ WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId,
+ callbackResponse);
+ execution.setVariable("sentSyncResponse", true);
+ } catch (Exception ex) {
+ msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage());
+ }
+ }
+
+ public void setupCompleteMsoProcess(DelegateExecution execution) {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String action = (String) execution.getVariable(G_ACTION);
+ final String resourceId = (String) execution.getVariable("resourceId");
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String resourceName = (String) execution.getVariable("resourceName");
+ final String source = (String) execution.getVariable("source");
+ String macroAction = "";
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action;
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action;
+ }
+ String msoCompletionRequest = "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>"
+ + requestId + "</request-id><action>" + action + "</action><source>" + source
+ + "</source></request-info><status-message>" + macroAction
+ + " request was executed correctly.</status-message><serviceInstanceId>" + resourceId
+ + "</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>";
+ execution.setVariable("CompleteMsoProcessRequest", msoCompletionRequest);
+ execution.setVariable("mso-request-id", requestId);
+ execution.setVariable("mso-service-instance-id", resourceId);
+ }
+
+ public void setupFalloutHandler(DelegateExecution execution) {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String action = (String) execution.getVariable(G_ACTION);
+ final String resourceId = (String) execution.getVariable("resourceId");
+ String exceptionMsg = "";
+ if (execution.getVariable("WorkflowActionErrorMessage") != null) {
+ exceptionMsg = (String) execution.getVariable("WorkflowActionErrorMessage");
+ } else {
+ exceptionMsg = "Error in WorkflowAction";
+ }
+ execution.setVariable("mso-service-instance-id", resourceId);
+ execution.setVariable("mso-request-id", requestId);
+ String falloutRequest = "<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"xmlns:ns=\"http://org.onap/so/request/types/v1\"xmlns:wfsch=\"http://org.onap/so/workflow/schema/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>"
+ + requestId + "</request-id><action>" + action
+ + "</action><source>VID</source></request-info><aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>"
+ + exceptionMsg
+ + "</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException></aetgt:FalloutHandlerRequest>";
+ execution.setVariable("falloutRequest", falloutRequest);
+ }
+
+ public void checkRetryStatus(DelegateExecution execution) {
+ if (execution.getVariable("handlingCode") == "Retry") {
+ int currSequence = (int) execution.getVariable("gCurrentSequence");
+ currSequence--;
+ execution.setVariable("gCurrentSequence", currSequence);
+ int currRetryCount = (int) execution.getVariable("retryCount");
+ currRetryCount++;
+ execution.setVariable("retryCount", currRetryCount);
+ }
+ }
+
+ /**
+ * Rollback will only handle Create/Activate/Assign Macro flows. Execute
+ * layer will rollback the flow its currently working on.
+ */
+ public void rollbackExecutionPath(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) - 1;
+ for (int i = flowsToExecute.size() - 1; i >= 0; i--) {
+ if (i >= currentSequence) {
+ flowsToExecute.remove(i);
+ } else {
+ ExecuteBuildingBlock ebb = flowsToExecute.get(i);
+ BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock();
+ String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
+ if (flowName.contains("Assign")) {
+ flowName = "Unassign" + flowName.substring(7, flowName.length());
+ } else if (flowName.contains("Create")) {
+ flowName = "Delete" + flowName.substring(6, flowName.length());
+ } else if (flowName.contains("Activate")) {
+ flowName = "Deactivate" + flowName.substring(8, flowName.length());
+ }
+ flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
+ rollbackFlows.add(flowsToExecute.get(i));
+ }
+ }
+ if (rollbackFlows.isEmpty())
+ execution.setVariable("isRollbackNeeded", false);
+ else
+ execution.setVariable("isRollbackNeeded", true);
+
+ execution.setVariable("flowsToExecute", rollbackFlows);
+ execution.setVariable("handlingCode", "PreformingRollback");
+ }
+
+ public void abortCallErrorHandling(DelegateExecution execution) {
+ String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
+ Exception exception = new Exception(msg);
+ msoLogger.error(exception);
+ throw new BpmnError(msg);
+ }
+
+ public void updateRequestStatusToFailed(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = null;
+ try {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ request.setStatusMessage(exception.getErrorMessage());
+ } catch (Exception ex) {
+ //log error and attempt to extact WorkflowExceptionMessage
+ msoLogger.error(ex);
+ }
+ if (errorMsg == null){
+ try {
+ errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
+ request.setStatusMessage(errorMsg);
+ } catch (Exception ex) {
+ msoLogger.error(ex);
+ request.setStatusMessage("Unexpected Error in BPMN");
+ }
+ }
+ request.setRequestStatus("FAILED");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
new file mode 100644
index 0000000000..ff5ba152b9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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;
+
+public enum WorkflowType {
+
+ SERVICE("Service"),
+ VNF("Vnf"),
+ VFMODULE("VfModule"),
+ VOLUMEGROUP("VolumeGroup"),
+ NETWORK("Network"),
+ VIRTUAL_LINK("VirtualLink"),
+ NETWORKCOLLECTION("NetworkCollection"),
+ CONFIGURATION("Configuration");
+
+ private final String type;
+
+ private WorkflowType (String type){
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
+
+ public static WorkflowType fromString (String text){
+ for (WorkflowType x : WorkflowType.values()) {
+ if (x.type.equalsIgnoreCase(text)) {
+ return x;
+ }
+ }
+ return null;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java
new file mode 100644
index 0000000000..9075fcc3cf
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdno.tasks;
+
+import java.util.Map;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNOHealthCheckResources;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNOHealthCheckTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNOHealthCheckTasks.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private SDNOHealthCheckResources sdnoHealthCheckResources;
+
+ public void sdnoHealthCheck(BuildingBlockExecution execution) {
+ boolean response = false;
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+
+ GenericVnf vnf = null;
+ Map<ResourceKey, String> lookupMap = execution.getLookupMap();
+ for (Map.Entry<ResourceKey, String> entry : lookupMap.entrySet()) {
+ if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) {
+ vnf = extractPojosForBB.extractByKey(execution, entry.getKey(), entry.getValue());
+ }
+ }
+
+ response = sdnoHealthCheckResources.healthCheck(vnf, requestContext);
+ }
+ catch (Exception ex) {
+ msoLogger.error(ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage());
+ }
+
+ if (!response) {
+ msoLogger.error("SDNO Health Check failed");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SDNO Health Check failed");
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
new file mode 100644
index 0000000000..373ed63fda
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -0,0 +1,297 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.aai.mapper;
+
+import org.modelmapper.ModelMapper;
+import org.modelmapper.PropertyMap;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import org.modelmapper.Converter;
+import org.modelmapper.spi.MappingContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+
+@Component
+public class AAIObjectMapper {
+ private static final ModelMapper modelMapper = new ModelMapper();
+
+ public org.onap.aai.domain.yang.ServiceInstance mapServiceInstance (ServiceInstance serviceInstance){
+ if (modelMapper.getTypeMap(ServiceInstance.class, org.onap.aai.domain.yang.ServiceInstance.class) == null) {
+ modelMapper.addMappings(new PropertyMap<ServiceInstance, org.onap.aai.domain.yang.ServiceInstance>(){
+ @Override
+ protected void configure() {
+ map().setServiceType(source.getModelInfoServiceInstance().getServiceType());
+ map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole());
+ map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid());
+ map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid());
+ map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext());
+ map().setWorkloadContext(source.getModelInfoServiceInstance().getWorkloadContext());
+ }
+ });
+ }
+
+ return modelMapper.map(serviceInstance,org.onap.aai.domain.yang.ServiceInstance.class);
+ }
+
+ public org.onap.aai.domain.yang.Project mapProject (Project project){
+ return modelMapper.map(project,org.onap.aai.domain.yang.Project.class);
+ }
+
+ public org.onap.aai.domain.yang.ServiceSubscription mapServiceSubscription(ServiceSubscription serviceSubscription){
+ return modelMapper.map(serviceSubscription,org.onap.aai.domain.yang.ServiceSubscription.class);
+ }
+
+ public org.onap.aai.domain.yang.OwningEntity mapOwningEntity (OwningEntity owningEntity){
+ return modelMapper.map(owningEntity,org.onap.aai.domain.yang.OwningEntity.class);
+ }
+
+ public org.onap.aai.domain.yang.GenericVnf mapVnf (GenericVnf vnf){
+ if (modelMapper.getTypeMap(GenericVnf.class, org.onap.aai.domain.yang.GenericVnf.class) == null) {
+ modelMapper.addMappings(new PropertyMap<GenericVnf, org.onap.aai.domain.yang.GenericVnf>(){
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoGenericVnf().getModelCustomizationUuid());
+ map().setModelInvariantId(source.getModelInfoGenericVnf().getModelInvariantUuid());
+ map().setModelVersionId(source.getModelInfoGenericVnf().getModelUuid());
+ map().setNfRole(source.getModelInfoGenericVnf().getNfRole());
+ map().setNfType(source.getModelInfoGenericVnf().getNfType());
+ map().setNfFunction(source.getModelInfoGenericVnf().getNfFunction());
+ map().setNfNamingCode(source.getModelInfoGenericVnf().getNfNamingCode());
+ }
+ });
+ }
+
+ return modelMapper.map(vnf, org.onap.aai.domain.yang.GenericVnf.class);
+ }
+
+ public org.onap.aai.domain.yang.VfModule mapVfModule (VfModule vfModule){
+ if (modelMapper.getTypeMap(VfModule.class, org.onap.aai.domain.yang.VfModule.class) == null) {
+ modelMapper.addMappings(new PropertyMap<VfModule, org.onap.aai.domain.yang.VfModule>(){
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID());
+ map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID());
+ map().setModelVersionId(source.getModelInfoVfModule().getModelUUID());
+ map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID());
+
+ }
+ });
+ }
+
+ return modelMapper.map(vfModule, org.onap.aai.domain.yang.VfModule.class);
+ }
+
+ public org.onap.aai.domain.yang.VolumeGroup mapVolumeGroup(VolumeGroup volumeGroup) {
+ if (modelMapper.getTypeMap(VolumeGroup.class, org.onap.aai.domain.yang.VolumeGroup.class) == null) {
+ modelMapper.addMappings(new PropertyMap<VolumeGroup, org.onap.aai.domain.yang.VolumeGroup>(){
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID());
+ map().setVfModuleModelCustomizationId(source.getModelInfoVfModule().getModelCustomizationUUID());
+ }
+ });
+ }
+ return modelMapper.map(volumeGroup, org.onap.aai.domain.yang.VolumeGroup.class);
+ }
+
+ public org.onap.aai.domain.yang.L3Network mapNetwork (L3Network l3Network){
+ if (modelMapper.getTypeMap(L3Network.class, org.onap.aai.domain.yang.L3Network.class) == null) {
+ modelMapper.addMappings(new PropertyMap<L3Network, org.onap.aai.domain.yang.L3Network>(){
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoNetwork().getModelCustomizationUUID());
+ map().setModelInvariantId(source.getModelInfoNetwork().getModelInvariantUUID());
+ map().setModelVersionId(source.getModelInfoNetwork().getModelUUID());
+ map().setNetworkType(source.getModelInfoNetwork().getNetworkType());
+ map().setNetworkRole(source.getModelInfoNetwork().getNetworkRole());
+ map().setNetworkTechnology(source.getModelInfoNetwork().getNetworkTechnology());
+ modelMapper.addConverter(convertSubnets);
+ modelMapper.addConverter(convertCtagAssignments);
+ modelMapper.addConverter(convertSegmentationAssignments);
+ }
+ });
+ }
+ return modelMapper.map(l3Network, org.onap.aai.domain.yang.L3Network.class);
+ }
+
+ public org.onap.aai.domain.yang.InstanceGroup mapInstanceGroup(InstanceGroup instanceGroup) {
+ if (modelMapper.getTypeMap(InstanceGroup.class, org.onap.aai.domain.yang.InstanceGroup.class) == null) {
+ modelMapper.addMappings(new PropertyMap<InstanceGroup, org.onap.aai.domain.yang.InstanceGroup>(){
+ @Override
+ protected void configure() {
+ map().setInstanceGroupRole(source.getModelInfoInstanceGroup().getInstanceGroupRole());
+ map().setModelInvariantId(source.getModelInfoInstanceGroup().getModelInvariantUUID());
+ map().setModelVersionId(source.getModelInfoInstanceGroup().getModelUUID());
+ map().setInstanceGroupType(source.getModelInfoInstanceGroup().getType());
+ map().setDescription(source.getModelInfoInstanceGroup().getDescription());
+ map().setInstanceGroupFunction(source.getModelInfoInstanceGroup().getFunction());
+ }
+ });
+ }
+ return modelMapper.map(instanceGroup, org.onap.aai.domain.yang.InstanceGroup.class);
+ }
+
+ public org.onap.aai.domain.yang.Customer mapCustomer(Customer customer) {
+ return modelMapper.map(customer, org.onap.aai.domain.yang.Customer.class);
+ }
+
+ public Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets = new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() {
+ public org.onap.aai.domain.yang.Subnets convert(MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) {
+ return mapToAAISubNets(context.getSource());
+ }
+ };
+
+ public Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments = new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() {
+ public org.onap.aai.domain.yang.CtagAssignments convert(MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) {
+ return mapToAAICtagAssignmentList(context.getSource());
+ }
+ };
+
+ public Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments = new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() {
+ public org.onap.aai.domain.yang.SegmentationAssignments convert(MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) {
+ return mapToAAISegmentationAssignmentList(context.getSource());
+ }
+ };
+
+ public org.onap.aai.domain.yang.Subnets mapToAAISubNets(List<Subnet> subnetList) {
+ org.onap.aai.domain.yang.Subnets subnets = null;
+
+ if (!subnetList.isEmpty()) {
+ subnets = new org.onap.aai.domain.yang.Subnets();
+ org.onap.aai.domain.yang.Subnet subnet = null;
+ for (Subnet subnetSource : subnetList) {
+ subnet = new org.onap.aai.domain.yang.Subnet();
+ subnet.setSubnetId(subnetSource.getSubnetId());
+ subnet.setSubnetName(subnetSource.getSubnetName());
+ subnet.setNeutronSubnetId(subnetSource.getNeutronSubnetId());
+ subnet.setGatewayAddress(subnetSource.getGatewayAddress());
+ subnet.setCidrMask(subnetSource.getCidrMask());
+ subnet.setIpVersion(subnetSource.getIpVersion());
+ subnet.setOrchestrationStatus(subnetSource.getOrchestrationStatus().toString());
+ subnet.setCidrMask(subnetSource.getCidrMask());
+ subnet.setDhcpEnabled(subnetSource.isDhcpEnabled());
+ subnet.setDhcpStart(subnetSource.getDhcpStart());
+ subnet.setDhcpEnd(subnetSource.getDhcpEnd());
+ subnet.setSubnetRole(subnetSource.getSubnetRole());
+ subnet.setIpAssignmentDirection(subnetSource.getIpAssignmentDirection());
+ subnet.setSubnetSequence(subnetSource.getSubnetSequence());
+
+ org.onap.aai.domain.yang.HostRoutes hostRoutes = new org.onap.aai.domain.yang.HostRoutes();
+ org.onap.aai.domain.yang.HostRoute hostRoute = null;
+ for (HostRoute hostRouteSource : subnetSource.getHostRoutes()) {
+ hostRoute = new org.onap.aai.domain.yang.HostRoute();
+ hostRoute.setHostRouteId(hostRouteSource.getHostRouteId());
+ hostRoute.setRoutePrefix(hostRouteSource.getRoutePrefix());
+ hostRoute.setNextHop(hostRouteSource.getNextHop());
+ hostRoute.setNextHopType(hostRouteSource.getNextHopType());
+ hostRoutes.getHostRoute().add(hostRoute);
+ }
+ subnet.setHostRoutes(hostRoutes);
+ subnets.getSubnet().add(subnet);
+ }
+ }
+ return subnets;
+ }
+
+ public org.onap.aai.domain.yang.CtagAssignments mapToAAICtagAssignmentList(List<CtagAssignment> ctagAssignmentsList) {
+ org.onap.aai.domain.yang.CtagAssignments ctagAssignments = null;
+ if (!ctagAssignmentsList.isEmpty()) {
+ ctagAssignments = new org.onap.aai.domain.yang.CtagAssignments();
+
+ org.onap.aai.domain.yang.CtagAssignment ctagAssignment = null;
+ for (CtagAssignment ctagAssignmentSource : ctagAssignmentsList) {
+ ctagAssignment = new org.onap.aai.domain.yang.CtagAssignment();
+ ctagAssignment.setVlanIdInner(ctagAssignmentSource.getVlanIdInner());
+ ctagAssignments.getCtagAssignment().add(ctagAssignment);
+ }
+ }
+ return ctagAssignments;
+ }
+
+ public org.onap.aai.domain.yang.SegmentationAssignments mapToAAISegmentationAssignmentList(List<SegmentationAssignment> segmentationAssignmentList) {
+ org.onap.aai.domain.yang.SegmentationAssignments segmentationAssignments = null;
+ if (!segmentationAssignmentList.isEmpty()) {
+ segmentationAssignments = new org.onap.aai.domain.yang.SegmentationAssignments();
+ org.onap.aai.domain.yang.SegmentationAssignment segmentationAssignment = null;
+ for (SegmentationAssignment segmentationAssignmentSource : segmentationAssignmentList) {
+ segmentationAssignment = new org.onap.aai.domain.yang.SegmentationAssignment();
+ segmentationAssignment.setSegmentationId(segmentationAssignmentSource.getSegmentationId());
+ segmentationAssignments.getSegmentationAssignment().add(segmentationAssignment);
+ }
+ }
+ return segmentationAssignments;
+ }
+
+ public org.onap.aai.domain.yang.Configuration mapConfiguration(Configuration configuration) {
+ if (null == modelMapper.getTypeMap(Configuration.class, org.onap.aai.domain.yang.Configuration.class)) {
+ modelMapper.addMappings(new PropertyMap<Configuration, org.onap.aai.domain.yang.Configuration>(){
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoConfiguration().getModelCustomizationId());
+ map().setModelVersionId(source.getModelInfoConfiguration().getModelVersionId());
+ map().setModelInvariantId(source.getModelInfoConfiguration().getModelInvariantId());
+ }
+ });
+ }
+ return modelMapper.map(configuration, org.onap.aai.domain.yang.Configuration.class);
+ }
+
+ public org.onap.aai.domain.yang.Collection mapCollection (Collection networkCollection){
+ if (modelMapper.getTypeMap(Collection.class, org.onap.aai.domain.yang.Collection.class) == null) {
+ modelMapper.addMappings(new PropertyMap<Collection, org.onap.aai.domain.yang.Collection>(){
+ @Override
+ protected void configure() {
+ map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID());
+ map().setModelVersionId(source.getModelInfoCollection().getModelVersionId());
+ map().setCollectionName(source.getName());
+ }
+ });
+ }
+ return modelMapper.map(networkCollection, org.onap.aai.domain.yang.Collection.class);
+ }
+
+
+ public org.onap.aai.domain.yang.VpnBinding mapVpnBinding(VpnBinding vpnBinding) {
+ org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = modelMapper.map(vpnBinding, org.onap.aai.domain.yang.VpnBinding.class);
+ mapRouteTargetToVpnBinding(aaiVpnBinding,vpnBinding);
+ return aaiVpnBinding;
+ }
+
+ public org.onap.aai.domain.yang.RouteTarget mapRouteTarget(RouteTarget routeTarget) {
+ return modelMapper.map(routeTarget, org.onap.aai.domain.yang.RouteTarget.class);
+ }
+
+ private void mapRouteTargetToVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding, VpnBinding vpnBinding) {
+ if(vpnBinding.getRouteTargets() != null && !vpnBinding.getRouteTargets().isEmpty()) {
+ RouteTargets routeTargets = new RouteTargets();
+ for (RouteTarget routeTarget : vpnBinding.getRouteTargets()) {
+ routeTargets.getRouteTarget().add(mapRouteTarget(routeTarget));
+ }
+ aaiVpnBinding.setRouteTargets(routeTargets);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java
new file mode 100644
index 0000000000..45f28df756
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.network;
+
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.QueryNetworkResponse;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+
+public interface NetworkAdapterClient {
+ CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException;
+
+ DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req)
+ throws NetworkAdapterClientException;
+
+ RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req)
+ throws NetworkAdapterClientException;
+
+ QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId,
+ boolean skipAAI, String requestId, String serviceInstanceId) throws NetworkAdapterClientException;
+
+ UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req)
+ throws NetworkAdapterClientException;
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java
new file mode 100644
index 0000000000..0492477cf6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.adapter.network;
+
+public class NetworkAdapterClientException extends Exception {
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8040736661096488110L;
+
+ public NetworkAdapterClientException(String message) {
+ super(message);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java
new file mode 100644
index 0000000000..9b052b4484
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.network;
+
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.QueryNetworkResponse;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkAdapterClientImpl implements NetworkAdapterClient {
+
+ private final NetworkAdapterRestProperties props;
+
+ public NetworkAdapterClientImpl() {
+ this.props = new NetworkAdapterRestProperties();
+ }
+
+ @Override
+ public CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException{
+ try {
+ return new AdapterRestClient(this.props, this.getUri("").build()).post(req,
+ CreateNetworkResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req,
+ DeleteNetworkResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req,
+ RollbackNetworkResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId,
+ String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) throws NetworkAdapterClientException {
+ UriBuilder builder = this.getUri("/" + aaiNetworkId);
+ if (cloudSiteId != null) {
+ builder.queryParam("cloudSiteId", cloudSiteId);
+ }
+ if (tenantId != null) {
+ builder.queryParam("tenantId", tenantId);
+ }
+ if (networkStackId != null) {
+ builder.queryParam("networkStackId", networkStackId);
+ }
+
+ builder.queryParam("skipAAI", skipAAI);
+
+ if (requestId != null) {
+ builder.queryParam("msoRequest.requestId", requestId);
+ }
+ if (serviceInstanceId != null) {
+ builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId);
+ }
+ try {
+ return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_XML, MediaType.APPLICATION_XML)
+ .get(QueryNetworkResponse.class).get();
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req,
+ UpdateNetworkResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
+
+ protected UriBuilder getUri(String path) {
+ return UriBuilder.fromPath(path);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java
new file mode 100644
index 0000000000..9888dd3be2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.network;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.adapter.rest.AdapterRestProperties;
+
+
+public class NetworkAdapterRestProperties implements AdapterRestProperties {
+
+ public NetworkAdapterRestProperties() {
+ }
+
+ @Override
+ public String getAuth() {
+ return UrnPropertiesReader.getVariable("mso.adapters.po.auth");
+ }
+ @Override
+ public String getKey() {
+ return UrnPropertiesReader.getVariable("mso.msoKey");
+ }
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint"));
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
new file mode 100644
index 0000000000..a1501da0e2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -0,0 +1,341 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.network.mapper;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.modelmapper.ModelMapper;
+import org.modelmapper.PropertyMap;
+import org.onap.so.adapters.nwrest.ContrailNetwork;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.NetworkRollback;
+import org.onap.so.openstack.beans.RouteTarget;
+import org.onap.so.openstack.beans.Subnet;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
+
+@Component
+public class NetworkAdapterObjectMapper {
+ private static final ModelMapper modelMapper = new ModelMapper();
+ private static String FORWARD_SLASH = "/";
+
+ public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException {
+ CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
+
+ //set cloudSiteId as determined for cloud region PO instead of cloudRegion.getLcpCloudRegionId()
+ createNetworkRequest.setCloudSiteId(cloudRegionPo);
+ createNetworkRequest.setTenantId(cloudRegion.getTenantId());
+ createNetworkRequest.setNetworkId(l3Network.getNetworkId());
+ createNetworkRequest.setNetworkName(l3Network.getNetworkName());
+ //TODO fields not available
+ createNetworkRequest.setNetworkType(l3Network.getNetworkType());
+ //createNetworkRequest.setNetworkTypeVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork();
+ if (modelInfoNetwork != null){
+ createNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
+ }
+
+ //build and set Subnet list
+ createNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network));
+
+ //build and set provider Vlan Network
+ ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network);
+ createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
+
+ //build and set Contrail Network
+ ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
+ createNetworkRequest.setContrailNetwork(contrailNetwork);
+
+ //set Network Parameters from VID request
+ createNetworkRequest.setNetworkParams(userInput);
+
+ createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
+
+ createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ createNetworkRequest.setMessageId(messageId);
+ //TODO clarify callback URL build process
+ //createNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+
+ return createNetworkRequest;
+ }
+
+ public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException {
+ DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
+
+ deleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ String messageId = getRandomUuid();
+ deleteNetworkRequest.setMessageId(messageId);
+
+ ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork();
+ if (modelInfoNetwork != null){
+ deleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
+ }
+
+ deleteNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+ deleteNetworkRequest.setNetworkId(l3Network.getNetworkId());
+ deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ deleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
+ deleteNetworkRequest.setSkipAAI(true);
+ deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+
+ return deleteNetworkRequest;
+ }
+
+ /**
+ * Access method to build Rollback Network Request
+ * @return
+ * @throws UnsupportedEncodingException
+ */
+ public RollbackNetworkRequest createNetworkRollbackRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException {
+ RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
+
+ rollbackNetworkRequest = setCommonRollbackRequestFields(rollbackNetworkRequest, requestContext);
+
+ NetworkRollback networkRollback = buildNetworkRollback(l3Network, cloudRegion, cloudRegionPo, createNetworkResponse);
+ rollbackNetworkRequest.setNetworkRollback(networkRollback);
+
+ return rollbackNetworkRequest;
+ }
+
+ public UpdateNetworkRequest createNetworkUpdateRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, Customer customer) throws UnsupportedEncodingException {
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+
+ updateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ updateNetworkRequest.setTenantId(cloudRegion.getTenantId());
+ updateNetworkRequest.setNetworkId(l3Network.getNetworkId());
+ updateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ updateNetworkRequest.setNetworkName(l3Network.getNetworkName());
+ updateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType());
+ updateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion());
+ updateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID());
+ updateNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network));
+ updateNetworkRequest.setProviderVlanNetwork(buildProviderVlanNetwork(l3Network));
+ updateNetworkRequest.setContrailNetwork(buildContrailNetwork(l3Network, customer));
+ updateNetworkRequest.setNetworkParams(userInput);
+ updateNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ setFlowFlags(updateNetworkRequest, orchestrationContext);
+
+ String messageId = getRandomUuid();
+ updateNetworkRequest.setMessageId(messageId);
+ updateNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+
+ return updateNetworkRequest;
+ }
+
+ private RollbackNetworkRequest setCommonRollbackRequestFields(RollbackNetworkRequest request,RequestContext requestContext){
+ //TODO confirm flag value
+ request.setSkipAAI(true);
+ request.setMessageId(requestContext.getMsoRequestId());
+ //TODO clarify callback URL build process. This will also set SYNC flag
+ //request.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+ return request;
+ }
+
+ private NetworkRollback buildNetworkRollback(L3Network l3Network, CloudRegion cloudRegion, String cloudRegionPo, CreateNetworkResponse createNetworkResponse){
+ NetworkRollback networkRollback = new NetworkRollback();
+ networkRollback.setNetworkId(l3Network.getNetworkId());
+ networkRollback.setNeutronNetworkId(createNetworkResponse.getMessageId());
+ networkRollback.setNetworkStackId(createNetworkResponse.getNetworkStackId());
+ networkRollback.setTenantId(cloudRegion.getTenantId());
+ networkRollback.setCloudId(cloudRegionPo);
+ networkRollback.setNetworkType(l3Network.getNetworkType());
+ ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork();
+ if (modelInfoNetwork != null){
+ networkRollback.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
+ }
+ //rollback will only be called when network was actually created
+ networkRollback.setNetworkCreated(createNetworkResponse.getNetworkCreated());
+ //TODO confirm below not required for create rollback
+ //NetworkName
+ //PhysicalNetwork
+ //Vlans
+ //msoRequest
+ return networkRollback;
+ }
+
+ public MsoRequest createMsoRequest(RequestContext requestContext, ServiceInstance serviceInstance) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ return msoRequest;
+ }
+
+ protected String getRandomUuid() {
+ return UUID.randomUUID().toString();
+ }
+
+ protected String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException {
+ String endpoint = this.getEndpoint();
+
+ while (endpoint.endsWith("/")) {
+ endpoint = endpoint.substring(0, endpoint.length()-1);
+ }
+ return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/" + UriUtils.encodePathSegment(correlator, "UTF-8");
+ }
+
+ protected String getEndpoint() {
+ return UrnPropertiesReader.getVariable("mso.workflow.message.endpoint");
+ }
+ /**
+ * Use BB L3Network object to build subnets list of type org.onap.so.openstack.beans.Subnet
+ * @param L3Network
+ * @return List<org.onap.so.openstack.beans.Subnet>
+ */
+ private List<Subnet> buildOpenstackSubnetList(L3Network l3Network){
+
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
+ List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
+ //create mapper from onap Subnet to openstack bean Subnet
+ if(modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class, org.onap.so.openstack.beans.Subnet.class) == null) {
+ PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet> personMap = new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet>() {
+ protected void configure() {
+ map().setSubnetName(source.getSubnetName());
+ map(source.getSubnetId(), destination.getSubnetId());
+ map(source.getNeutronSubnetId(), destination.getNeutronId());
+ map(source.getGatewayAddress(), destination.getGatewayIp());
+ map(source.getIpVersion(), destination.getIpVersion());
+ map(source.isDhcpEnabled(), destination.getEnableDHCP());
+ }
+ };
+ modelMapper.addMappings(personMap);
+ }
+
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet subnet : subnets) {
+ org.onap.so.openstack.beans.Subnet openstackSubnet = modelMapper.map(subnet, org.onap.so.openstack.beans.Subnet.class);
+ //update cidr value
+ if (subnet.getNetworkStartAddress() != null & subnet.getCidrMask() != null)
+ openstackSubnet.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask()));
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
+ List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>();
+ org.onap.so.openstack.beans.HostRoute openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
+ //TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) {
+ openstackHostRoute.setNextHop(hostRoute.getNextHop());
+ openstackHostRoute.setPrefix(hostRoute.getRoutePrefix());
+ //add host route to the list
+ openstackHostRouteList.add(openstackHostRoute);
+ }
+ openstackSubnet.setHostRoutes(openstackHostRouteList);
+ //add subnet to the list
+ subnetList.add(openstackSubnet);
+ }
+ return subnetList;
+ }
+
+ private ProviderVlanNetwork buildProviderVlanNetwork(L3Network l3Network){
+ ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork();
+ providerVlanNetwork.setPhysicalNetworkName(l3Network.getPhysicalNetworkName());
+ List<Integer> vlans = new ArrayList<Integer>();
+ List<org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment> segmentationAssignments = l3Network.getSegmentationAssignments();
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment assignment : segmentationAssignments) {
+ vlans.add(Integer.valueOf(assignment.getSegmentationId()));
+ }
+ providerVlanNetwork.setVlans(vlans);
+ return providerVlanNetwork;
+ }
+
+ private ContrailNetwork buildContrailNetwork(L3Network l3Network, Customer customer){
+ ContrailNetwork contrailNetwork = new ContrailNetwork();
+ contrailNetwork.setExternal(Boolean.toString(l3Network.isExternalNetwork()));
+ contrailNetwork.setShared(Boolean.toString(l3Network.isSharedNetwork()));
+ contrailNetwork.setPolicyFqdns(buildPolicyFqdns(l3Network.getNetworkPolicies()));
+ contrailNetwork.setRouteTableFqdns(buildRouteTableFqdns(l3Network.getContrailNetworkRouteTableReferences()));
+ if(customer!= null)
+ contrailNetwork.setRouteTargets(buildRouteTargets(customer.getVpnBindings()));
+ //PolicyFqdns(policyFqdns); --- is set in getAAINetworkPolicy
+ //RouteTableFqdns(routeTableFqdns); --- is set in getAAINetworkTableRef
+ //RouteTargets(routeTargets); --- is set in getAAINetworkVpnBinding
+ return contrailNetwork;
+ }
+
+ private List<String> buildPolicyFqdns(List<NetworkPolicy> networkPolicies) {
+ List<String> policyFqdns = new ArrayList<>();
+ for(NetworkPolicy networkPolicy : networkPolicies) {
+ policyFqdns.add(networkPolicy.getNetworkPolicyFqdn());
+ }
+ return policyFqdns;
+ }
+
+ private List<String> buildRouteTableFqdns(List<RouteTableReference> contrailNetworkRouteTableReferences) {
+ List<String> routeTableFqdns = new ArrayList<>();
+ for(RouteTableReference routeTableReference : contrailNetworkRouteTableReferences) {
+ routeTableFqdns.add(routeTableReference.getRouteTableReferenceFqdn());
+ }
+ return routeTableFqdns;
+ }
+
+ private List<RouteTarget> buildRouteTargets(List<VpnBinding> vpnBindings) {
+ if(modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget.class, RouteTarget.class) == null) {
+ modelMapper.addMappings(new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget, RouteTarget>() {
+ @Override
+ protected void configure() {
+ map().setRouteTarget(source.getGlobalRouteTarget());
+ map().setRouteTargetRole(source.getRouteTargetRole());
+ }
+ });
+ }
+
+ List<RouteTarget> routeTargets = new ArrayList<>();
+ for(VpnBinding vpnBinding : vpnBindings) {
+ for(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget routeTarget : vpnBinding.getRouteTargets()) {
+ routeTargets.add(modelMapper.map(routeTarget, RouteTarget.class));
+ }
+ }
+ return routeTargets;
+ }
+
+ private CreateNetworkRequest setFlowFlags(CreateNetworkRequest createNetworkRequest, OrchestrationContext orchestrationContext){
+ //TODO confirm flag value
+ createNetworkRequest.setSkipAAI(true);
+ //revert suppressRollabck=TRUE into backout=FALSE and vice versa
+ createNetworkRequest.setBackout(orchestrationContext.getIsRollbackEnabled());
+ //TODO confirm value - false by default
+ createNetworkRequest.setFailIfExists(true);
+ //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
+ return createNetworkRequest;
+ }
+
+ private void setFlowFlags(UpdateNetworkRequest updateNetworkRequest, OrchestrationContext orchestrationContext){
+ updateNetworkRequest.setSkipAAI(true);
+ //revert suppressRollabck=TRUE into backout=FALSE and vice versa
+ updateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled()));
+ //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java
new file mode 100644
index 0000000000..13739faec2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
+
+public interface VnfAdapterClient {
+
+ CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) throws VnfAdapterClientException;
+
+ RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req)
+ throws VnfAdapterClientException;
+
+ DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req)
+ throws VnfAdapterClientException;
+
+ UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req)
+ throws VnfAdapterClientException;
+
+ QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId,
+ String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId)
+ throws VnfAdapterClientException;
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java
new file mode 100644
index 0000000000..b4ad9ef055
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.adapter.vnf;
+
+public class VnfAdapterClientException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7154784472485852602L;
+
+ public VnfAdapterClientException(String message) {
+ super(message);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
new file mode 100644
index 0000000000..7b9a8c5312
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
+import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfAdapterClientImpl implements VnfAdapterClient {
+
+ private static final String VF_MODULES = "/vf-modules/";
+
+ private VnfAdapterRestProperties props;
+
+ public VnfAdapterClientImpl() {
+ this.props = new VnfAdapterRestProperties();
+ }
+
+ public VnfAdapterClientImpl(VnfAdapterRestProperties props) {
+ this.props = props;
+ }
+
+ @Override
+ public CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req,
+ CreateVfModuleResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props,
+ this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req,
+ RollbackVfModuleResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
+ .delete(req, DeleteVfModuleResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
+ .put(req, UpdateVfModuleResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId,
+ String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId)
+ throws VnfAdapterClientException {
+ UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId);
+ if (cloudSiteId != null) {
+ builder.queryParam("cloudSiteId", cloudSiteId);
+ }
+ if (tenantId != null) {
+ builder.queryParam("tenantId", tenantId);
+ }
+ if (vfModuleName != null) {
+ builder.queryParam("vfModuleName", vfModuleName);
+ }
+
+ builder.queryParam("skipAAI", skipAAI);
+
+ if (requestId != null) {
+ builder.queryParam("msoRequest.requestId", requestId);
+ }
+ if (serviceInstanceId != null) {
+ builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId);
+ }
+ try {
+ return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON,
+ MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get();
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ public UriBuilder getUri(String path) {
+ return UriBuilder.fromPath(path);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java
new file mode 100644
index 0000000000..8302375c7e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.adapter.rest.AdapterRestProperties;
+
+
+public class VnfAdapterRestProperties implements AdapterRestProperties {
+
+
+ public VnfAdapterRestProperties() {
+ }
+
+ @Override
+ public String getAuth() {
+ return UrnPropertiesReader.getVariable("mso.adapters.po.auth");
+ }
+ @Override
+ public String getKey() {
+ return UrnPropertiesReader.getVariable("mso.msoKey");
+ }
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint"));
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java
new file mode 100644
index 0000000000..0626efbd03
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
+
+public interface VnfVolumeAdapterClient {
+ CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException;
+
+ DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req)
+ throws VnfAdapterClientException;
+
+ RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req)
+ throws VnfAdapterClientException;
+
+ UpdateVolumeGroupResponse updateVNFVolumes(String aaiVolumeGroupId, UpdateVolumeGroupRequest req)
+ throws VnfAdapterClientException;
+
+ QueryVolumeGroupResponse queryVNFVolumes(String aaiVolumeGroupId, String cloudSiteId, String tenantId,
+ String volumeGroupStackId, Boolean skipAAI, String requestId, String serviceInstanceId)
+ throws VnfAdapterClientException;
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
new file mode 100644
index 0000000000..0e0fd3bb5d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
+
+ private final VnfVolumeAdapterRestProperties props;
+
+ public VnfVolumeAdapterClientImpl() {
+ this.props = new VnfVolumeAdapterRestProperties();
+ }
+
+ @Override
+ public CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException {
+ try {
+ return this.getAdapterRestClient("").post(req, CreateVolumeGroupResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return this.getAdapterRestClient("/" + aaiVolumeGroupId).delete(req, DeleteVolumeGroupResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return this.getAdapterRestClient("/" + aaiVolumeGroupId + "/rollback").delete(req,
+ RollbackVolumeGroupResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public UpdateVolumeGroupResponse updateVNFVolumes(String aaiVolumeGroupId, UpdateVolumeGroupRequest req)
+ throws VnfAdapterClientException {
+ try {
+ return this.getAdapterRestClient("/" + aaiVolumeGroupId).put(req, UpdateVolumeGroupResponse.class);
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ @Override
+ public QueryVolumeGroupResponse queryVNFVolumes(String aaiVolumeGroupId, String cloudSiteId, String tenantId,
+ String volumeGroupStackId, Boolean skipAAI, String requestId, String serviceInstanceId)
+ throws VnfAdapterClientException {
+ try {
+ String path = buildQueryPath(aaiVolumeGroupId, cloudSiteId, tenantId, volumeGroupStackId, skipAAI,
+ requestId, serviceInstanceId);
+ return this.getAdapterRestClient(path).get(QueryVolumeGroupResponse.class).get();
+ } catch (InternalServerErrorException e) {
+ throw new VnfAdapterClientException(e.getMessage());
+ }
+ }
+
+ protected String buildQueryPath(String aaiVolumeGroupId, String cloudSiteId, String tenantId,
+ String volumeGroupStackId, Boolean skipAAI, String requestId, String serviceInstanceId) {
+ javax.ws.rs.core.UriBuilder builder = this.getUri("/" + aaiVolumeGroupId);
+ builder.queryParam("cloudSiteId", cloudSiteId).queryParam("tenantId", tenantId)
+ .queryParam("volumeGroupStackId", volumeGroupStackId).queryParam("skipAAI", skipAAI)
+ .queryParam("msoRequest.requestId", requestId)
+ .queryParam("msoRequest.serviceInstanceId", serviceInstanceId);
+ return builder.build().toString();
+ }
+
+ protected UriBuilder getUri(String path) {
+ return UriBuilder.fromPath(path);
+ }
+
+ protected RestClient getAdapterRestClient(String path) {
+ return new AdapterRestClient(props, this.getUri(path).build(), MediaType.APPLICATION_JSON,
+ MediaType.APPLICATION_JSON);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java
new file mode 100644
index 0000000000..80d064249b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.adapter.rest.AdapterRestProperties;
+
+
+public class VnfVolumeAdapterRestProperties implements AdapterRestProperties {
+
+ protected static final String authProp = "mso.adapters.po.auth";
+ protected static final String keyProp = "mso.msoKey";
+ protected static final String endpointProp = "mso.adapters.volume-groups.rest.endpoint";
+
+ public VnfVolumeAdapterRestProperties() {
+ }
+
+ @Override
+ public String getAuth() {
+ return UrnPropertiesReader.getVariable(authProp);
+ }
+ @Override
+ public String getKey() {
+ return UrnPropertiesReader.getVariable(keyProp);
+ }
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(UrnPropertiesReader.getVariable(endpointProp));
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
new file mode 100644
index 0000000000..7e08d8c799
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf.mapper;
+
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.entity.MsoRequest;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+@Component
+public class VnfAdapterObjectMapper {
+ private ObjectMapper mapper = new ObjectMapper();
+
+ public CreateVolumeGroupRequest createVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
+ CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest();
+
+ createVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ createVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
+ createVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ createVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName());
+ createVolumeGroupRequest.setVnfType(genericVnf.getVnfType());
+ createVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ createVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
+ createVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
+ createVolumeGroupRequest.setVolumeGroupParams(createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse));
+
+ createVolumeGroupRequest.setSkipAAI(true);
+ createVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled());
+ createVolumeGroupRequest.setFailIfExists(true);
+
+ createVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ createVolumeGroupRequest.setMessageId(messageId);
+ createVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
+
+ return createVolumeGroupRequest;
+ }
+
+ public DeleteVolumeGroupRequest deleteVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws IOException {
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+
+ deleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ deleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
+ deleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+
+ deleteVolumeGroupRequest.setSkipAAI(true);
+ deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ deleteVolumeGroupRequest.setMessageId(messageId);
+ deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
+
+ return deleteVolumeGroupRequest;
+ }
+
+ public Map<String, String> createVolumeGroupParams(RequestContext requestContext,GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
+ Map<String, String> volumeGroupParams = new HashMap<>();
+ final String USER_PARAM_NAME_KEY = "name";
+ final String USER_PARAM_VALUE_KEY = "value";
+ // sdncVfModuleQueryResponse will not be available in aLaCarte case
+ if (sdncVfModuleQueryResponse != null) {
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class);
+ buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters());
+ }
+
+ if(null != requestContext.getRequestParameters() && null != requestContext.getRequestParameters().getUserParams()) {
+ List<Map<String, Object>> userParams = requestContext.getRequestParameters().getUserParams();
+ for (Map<String, Object> userParamsMap : userParams) {
+ if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String)
+ && userParamsMap.containsKey(USER_PARAM_VALUE_KEY) && (userParamsMap.get(USER_PARAM_VALUE_KEY) instanceof String)) {
+ volumeGroupParams.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), (String) userParamsMap.get(USER_PARAM_VALUE_KEY));
+ }
+ }
+ }
+ volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
+ volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
+ volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
+ volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
+
+ return volumeGroupParams;
+ }
+
+ public MsoRequest createMsoRequest(RequestContext requestContext, ServiceInstance serviceInstance) {
+ MsoRequest msoRequest = new MsoRequest();
+
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+
+ return msoRequest;
+ }
+
+ private void buildParamsMapFromSdncParams(Map<String,String> volumeGroupParams, GenericResourceApiParam sdncParameters) {
+ if (sdncParameters != null) {
+ List<GenericResourceApiParamParam> sdncParametersList = sdncParameters.getParam();
+ if (sdncParametersList != null) {
+ for (int i = 0; i < sdncParametersList.size(); i++) {
+ GenericResourceApiParamParam param = sdncParametersList.get(i);
+ String parameterName = param.getName();
+ String parameterValue = param.getValue();
+ volumeGroupParams.put(parameterName, parameterValue);
+ }
+ }
+ }
+ }
+
+ protected String getRandomUuid() {
+ return UUID.randomUUID().toString();
+ }
+
+ protected String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException {
+ String endpoint = getProperty("mso.workflow.message.endpoint");
+
+ while (endpoint.endsWith("/")) {
+ endpoint = endpoint.substring(0, endpoint.length()-1);
+ }
+
+ return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/" + UriUtils.encodePathSegment(correlator, "UTF-8");
+ }
+
+ protected String getProperty(String key) {
+ return UrnPropertiesReader.getVariable(key);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java
new file mode 100644
index 0000000000..6b2d64f170
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf.mapper;
+
+import java.io.UnsupportedEncodingException;
+import java.util.UUID;
+
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
+
+@Component("VnfAdapterObjectMapperUtils")
+public class VnfAdapterObjectMapperUtils {
+
+ public String getRandomUuid() {
+ return UUID.randomUUID().toString();
+ }
+
+ public String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException {
+ String endpoint = getProperty("mso.workflow.message.endpoint");
+ if (endpoint != null) {
+ while (endpoint.endsWith("/")) {
+ endpoint = endpoint.substring(0, endpoint.length() - 1);
+ }
+ }
+
+ return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/"
+ + UriUtils.encodePathSegment(correlator, "UTF-8");
+ }
+
+ protected String getProperty(String key) {
+
+ return UrnPropertiesReader.getVariable(key);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
new file mode 100644
index 0000000000..88bc08826f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -0,0 +1,730 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf.mapper;
+
+import static java.util.Arrays.asList;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.jsonpath.JsonPathUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSubInterfaceNetworkData;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduleassignmentsVfModuleAssignments;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmNetworkData;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmTopologyData;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataFloatingIps;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataInterfaceRoutePrefixes;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataNetworkInformationItems;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataSriovParameters;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmtopologydataVmNames;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmtopologydataVmNetworks;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfNetworkData;
+import org.onap.sdnc.apps.client.model.*;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfresourceassignmentsVnfResourceAssignments;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnftopologyVnfTopology;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import jersey.repackaged.com.google.common.base.Joiner;
+
+@Component
+public class VnfAdapterVfModuleObjectMapper {
+ @Autowired
+ protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils;
+ private static List<String> sdncResponseParamsToSkip = asList("vnf_id", "vf_module_id", "vnf_name", "vf_module_name");
+
+ private ObjectMapper mapper = new ObjectMapper();
+ private static final JsonPathUtil jsonPath = JsonPathUtil.getInstance();
+ private static final String SUB_INT = "subint";
+ private static final String SUBNET_ID = "_subnet_id";
+ private static final String V6_SUBNET_ID = "_v6_subnet_id";
+ private static final String PORT = "port";
+ private static final String SUB_INT_COUNT = "_subintcount";
+ private static final String VLAN_IDS = "_vlan_ids";
+ private static final String NET_NAMES = "_net_names";
+ private static final String NET_IDS = "_net_ids";
+ private static final String IP = "_ip";
+ private static final String V6_IP = "_v6_ip";
+ private static final String FLOATING_IP = "_floating_ip";
+ private static final String FLOATING_V6_IP = "_floating_v6_ip";
+ private static final String UNDERSCORE = "_";
+
+ public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
+ CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
+
+ createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+ createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
+ createVfModuleRequest.setVnfType(genericVnf.getVnfType());
+ createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
+ createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+
+ createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
+
+ createVfModuleRequest.setSkipAAI(true);
+ createVfModuleRequest.setBackout(orchestrationContext.getIsRollbackEnabled());
+ createVfModuleRequest.setFailIfExists(true);
+
+ MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
+ createVfModuleRequest.setMsoRequest(msoRequest);
+
+ String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
+ createVfModuleRequest.setMessageId(messageId);
+ createVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
+
+ return createVfModuleRequest;
+ }
+
+ private MsoRequest buildMsoRequest(RequestContext requestContext,ServiceInstance serviceInstance) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ return msoRequest;
+ }
+
+ private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
+ GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class);
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class);
+ Map<String,String> paramsMap = new HashMap<>();
+
+ if(vnfTopology.getSdncGeneratedCloudResources() && vfModuleTopology.getSdncGeneratedCloudResources()) {
+ buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true);
+ buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, null, true);
+ }
+ else {
+ Map<String,String> networkRoleMap = buildNetworkRoleMap(vfModuleTopology);
+ buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, false);
+ buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, networkRoleMap, false);
+ }
+
+ buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule);
+
+ // Parameters received from the request should overwrite any parameters received from SDNC
+ paramsMap.putAll(requestContext.getUserParams());
+ return paramsMap;
+ }
+
+ private void buildMandatoryParamsMap(Map<String,String> paramsMap, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule) {
+ paramsMap.put("vnf_id", genericVnf.getVnfId());
+ paramsMap.put("vnf_name", genericVnf.getVnfName());
+ paramsMap.put("vf_module_id", vfModule.getVfModuleId());
+ paramsMap.put("vf_module_name", vfModule.getVfModuleName());
+ paramsMap.put("environment_context",serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
+ paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ Integer vfModuleIndex = vfModule.getModuleIndex();
+ if (vfModuleIndex != null) {
+ paramsMap.put("vf_module_index", vfModuleIndex.toString());
+ }
+ }
+
+ private void buildParamsMapFromVnfSdncResponse(Map<String,String> paramsMap, GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String,String> networkRoleMap, boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException {
+ // Get VNF parameters from SDNC response
+ GenericResourceApiParam vnfParametersData = vnfTopology.getVnfParametersData();
+ buildParamsMapFromSdncParams(paramsMap, vnfParametersData);
+
+ if(!skipVnfResourceAssignments) {
+ GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments = vnfTopology.getVnfResourceAssignments();
+ if (vnfResourceAssignments != null) {
+ // Availability Zones
+ buildAvailabilityZones(paramsMap, vnfResourceAssignments);
+ // VNF Networks
+ buildVnfNetworks(paramsMap, vnfResourceAssignments, networkRoleMap);
+ }
+ }
+ }
+
+ private void buildAvailabilityZones (Map<String,String> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments) {
+ GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones availabilityZones = vnfResourceAssignments.getAvailabilityZones();
+ if (availabilityZones != null) {
+ List<String> availabilityZonesList = availabilityZones.getAvailabilityZone();
+ if (availabilityZonesList != null) {
+ for(int i = 0; i < availabilityZonesList.size(); i++) {
+ paramsMap.put("availability_zone_" + i, availabilityZonesList.get(i));
+ }
+ }
+ }
+ }
+
+ private void buildVnfNetworks (Map<String,String> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments, Map<String,String> networkRoleMap) {
+ GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworks = vnfResourceAssignments.getVnfNetworks();
+ if (vnfNetworks != null) {
+ List<GenericResourceApiVnfNetworkData> vnfNetworksList = vnfNetworks.getVnfNetwork();
+ if (vnfNetworksList != null) {
+ for (int i = 0; i < vnfNetworksList.size(); i++) {
+ GenericResourceApiVnfNetworkData vnfNetwork = vnfNetworksList.get(i);
+ String networkRole = vnfNetwork.getNetworkRole();
+ String vnfNetworkKey = networkRoleMap.get(networkRole);
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole;
+ }
+
+ String vnfNetworkNeutronIdValue = vnfNetwork.getNeutronId();
+ paramsMap.put(vnfNetworkKey + "_net_id", vnfNetworkNeutronIdValue);
+ String vnfNetworkNetNameValue = vnfNetwork.getNetworkName();
+ paramsMap.put(vnfNetworkKey + "_net_name", vnfNetworkNetNameValue);
+ String vnfNetworkNetFqdnValue = vnfNetwork.getContrailNetworkFqdn();
+ paramsMap.put(vnfNetworkKey + "_net_fqdn", vnfNetworkNetFqdnValue);
+
+ buildVnfNetworkSubnets(paramsMap, vnfNetwork, vnfNetworkKey);
+
+ }
+ }
+ }
+ }
+
+ private void buildVnfNetworkSubnets(Map<String,String> paramsMap, GenericResourceApiVnfNetworkData vnfNetwork, String vnfNetworkKey) {
+ String vnfNetworkString = convertToString(vnfNetwork);
+ Optional<String> ipv4Ips = jsonPath.locateResult(vnfNetworkString, "$.subnets-data.subnet-data[*].[?(@.ip-version == 'ipv4' && @.dhcp-enabled == 'Y')].subnet-id");
+ if(ipv4Ips.isPresent())
+ addPairToMap(paramsMap, vnfNetworkKey, SUBNET_ID, ipv4Ips.get());
+
+ Optional<String> ipv6Ips = jsonPath.locateResult(vnfNetworkString, "$.subnets-data.subnet-data[*].[?(@.ip-version == 'ipv6' && @.dhcp-enabled == 'Y')].subnet-id");
+ if(ipv6Ips.isPresent())
+ addPairToMap(paramsMap, vnfNetworkKey, V6_SUBNET_ID, ipv6Ips.get());
+ }
+
+ private void buildParamsMapFromVfModuleSdncResponse(Map<String,String> paramsMap, GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments) throws JsonParseException, JsonMappingException, IOException {
+ // Get VF Module parameters from SDNC response
+ GenericResourceApiParam vfModuleParametersData = vfModuleTopology.getVfModuleParameters();
+ buildParamsMapFromSdncParams(paramsMap, vfModuleParametersData);
+
+ if(!skipVfModuleAssignments) {
+ GenericResourceApiVfmoduleassignmentsVfModuleAssignments vfModuleAssignments = vfModuleTopology.getVfModuleAssignments();
+ if (vfModuleAssignments != null) {
+ // VNF-VMS
+ GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms vms = vfModuleAssignments.getVms();
+ if (vms != null) {
+ List<GenericResourceApiVmTopologyData> vmsList = vms.getVm();
+ if (vmsList != null) {
+ for (GenericResourceApiVmTopologyData vm : vmsList){
+ String key = vm.getVmType();
+ buildVfModuleVmNames(paramsMap, vm, key);
+ GenericResourceApiVmtopologydataVmNetworks vmNetworks = vm.getVmNetworks();
+ if (vmNetworks != null) {
+ List<GenericResourceApiVmNetworkData> vmNetworksList = vmNetworks.getVmNetwork();
+ if (vmNetworksList != null) {
+ for(int n = 0; n < vmNetworksList.size(); n++){
+ GenericResourceApiVmNetworkData network = vmNetworksList.get(n);
+ network.getNetworkRoleTag();
+ String networkKey = network.getNetworkRole();
+ // Floating IPs
+ buildVfModuleFloatingIps(paramsMap, network, key, networkKey);
+ // Interface Route Prefixes
+ buildVfModuleInterfaceRoutePrefixes(paramsMap, network, key, networkKey);
+ // SRIOV Parameters
+ buildVfModuleSriovParameters(paramsMap, network, networkKey);
+ // IPV4 and IPV6 Addresses
+ buildVfModuleNetworkInformation(paramsMap, network, key, networkKey);
+ }
+ }
+ }
+
+ buildParamsMapFromVfModuleForHeatTemplate(paramsMap, vm);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void buildVfModuleVmNames(Map<String,String> paramsMap, GenericResourceApiVmTopologyData vm, String key) {
+ String values = "";
+ GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames();
+ if (vmNames != null) {
+ List<String> valueList = vmNames.getVmName();
+ if (valueList != null) {
+ for(int i = 0; i < valueList.size(); i++){
+ String value = valueList.get(i);
+ if (i != valueList.size() - 1) {
+ values += value + ",";
+ }
+ else {
+ values += value;
+ }
+ paramsMap.put(key + "_name_" + i, value);
+ }
+ paramsMap.put(key + "_names", values);
+ }
+ }
+ }
+
+ private void buildVfModuleFloatingIps(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
+ GenericResourceApiVmnetworkdataFloatingIps floatingIps = network.getFloatingIps();
+ if (floatingIps != null) {
+ List<String> floatingIpV4List = floatingIps.getFloatingIpV4();
+ if (floatingIpV4List != null) {
+ // add only one ipv4 floating ip for now
+ String floatingIPKey = key + UNDERSCORE + networkKey + FLOATING_IP;
+ String floatingIPKeyValue = floatingIpV4List.get(0);
+ if (floatingIPKeyValue != null && !floatingIPKeyValue.isEmpty()) {
+ paramsMap.put(floatingIPKey, floatingIPKeyValue);
+ }
+ }
+ // add only one ipv6 floating ip for now
+ List<String> floatingIpV6List = floatingIps.getFloatingIpV6();
+ if (floatingIpV6List != null) {
+ String floatingIPV6Key = key + UNDERSCORE + networkKey + FLOATING_V6_IP;
+ String floatingIPV6KeyValue = floatingIpV6List.get(0);
+ if (floatingIPV6KeyValue != null && !floatingIPV6KeyValue.isEmpty()) {
+ paramsMap.put(floatingIPV6Key, floatingIPV6KeyValue);
+ }
+ }
+ }
+ }
+
+ private void buildVfModuleInterfaceRoutePrefixes(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
+ GenericResourceApiVmnetworkdataInterfaceRoutePrefixes interfaceRoutePrefixes = network.getInterfaceRoutePrefixes();
+ if (interfaceRoutePrefixes != null) {
+ List<String> interfaceRoutePrefixesList = interfaceRoutePrefixes.getInterfaceRoutePrefix();
+ StringBuilder sbInterfaceRoutePrefixes = new StringBuilder();
+ sbInterfaceRoutePrefixes.append("[");
+ if (interfaceRoutePrefixesList != null) {
+ for(int a = 0; a < interfaceRoutePrefixesList.size(); a++){
+ String interfaceRoutePrefixValue = interfaceRoutePrefixesList.get(a);
+ if (a != interfaceRoutePrefixesList.size() - 1) {
+ sbInterfaceRoutePrefixes.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",");
+ }
+ else {
+ sbInterfaceRoutePrefixes.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}");
+ }
+ }
+ sbInterfaceRoutePrefixes.append("]");
+ if (interfaceRoutePrefixesList.size() > 0) {
+ paramsMap.put(key + UNDERSCORE + networkKey + "_route_prefixes", sbInterfaceRoutePrefixes.toString());
+ }
+ }
+ }
+ }
+
+ private void buildVfModuleSriovParameters(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) {
+ // SRIOV Parameters
+ GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters();
+ if (sriovParameters != null) {
+ GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters = sriovParameters.getHeatVlanFilters();
+ if (heatVlanFilters != null) {
+ List<String> heatVlanFiltersList = heatVlanFilters.getHeatVlanFilter();
+ StringBuilder sriovFilterBuf = new StringBuilder();
+ if (heatVlanFiltersList != null) {
+ for(int a = 0; a < heatVlanFiltersList.size(); a++){
+ String heatVlanFilterValue = heatVlanFiltersList.get(a);
+ if (a != heatVlanFiltersList.size() - 1) {
+ sriovFilterBuf.append(heatVlanFilterValue).append(",");
+ }
+ else {
+ sriovFilterBuf.append(heatVlanFilterValue);
+ }
+ }
+ if (heatVlanFiltersList.size() > 0) {
+ paramsMap.put(networkKey + "_ATT_VF_VLAN_FILTER", sriovFilterBuf.toString());
+ }
+ }
+ }
+ }
+ }
+
+ private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
+
+ GenericResourceApiVmnetworkdataNetworkInformationItems networkInformationItems = network.getNetworkInformationItems();
+ StringBuilder sbIpv4Ips = new StringBuilder();
+ StringBuilder sbIpv6Ips = new StringBuilder();
+
+ if (networkInformationItems != null) {
+ List<GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem> networkInformationItemList = networkInformationItems.getNetworkInformationItem();
+ if (networkInformationItemList != null) {
+ for(int a = 0; a < networkInformationItemList.size(); a++){
+ GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem ipAddress = networkInformationItemList.get(a);
+ if (ipAddress != null) {
+ GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps ips = ipAddress.getNetworkIps();
+ if (ips != null) {
+ List<String> ipsList = ips.getNetworkIp();
+ if (ipsList != null) {
+ String ipVersion = ipAddress.getIpVersion();
+ for (int b = 0; b < ipsList.size(); b++) {
+ String ipAddressValue = ipsList.get(b);
+ if (ipVersion.equals("ipv4")) {
+ if (b != ipsList.size() - 1) {
+ sbIpv4Ips.append(ipAddressValue + ",");
+ }
+ else {
+ sbIpv4Ips.append(ipAddressValue);
+ }
+ paramsMap.put(key + UNDERSCORE + networkKey + IP + UNDERSCORE + b, ipAddressValue);
+ }
+ else if (ipVersion.equals("ipv6")) {
+ if (b != ipsList.size() - 1) {
+ sbIpv6Ips.append(ipAddressValue + ",");
+ }
+ else {
+ sbIpv6Ips.append(ipAddressValue);
+ }
+ paramsMap.put(key + UNDERSCORE + networkKey + V6_IP + UNDERSCORE + b, ipAddressValue);
+ }
+ }
+ paramsMap.put(key + UNDERSCORE + networkKey + "_ips", sbIpv4Ips.toString());
+ paramsMap.put(key + UNDERSCORE + networkKey + "_v6_ips", sbIpv6Ips.toString());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Build Mapping from GenericResourceApi SDNC for Heat Template so that AIC - PO gets accurate requests for vf module assignments.
+ * Build Count of SubInterfaces, VLAN Tag, network_name, network_id,
+ * ip_address (V4 and V6) and Floating IPs Addresses (V4 and V6) for Heat Template
+ */
+ private void buildParamsMapFromVfModuleForHeatTemplate(Map<String,String> paramsMap, GenericResourceApiVmTopologyData vm) {
+ GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames();
+
+ if (vmNames != null) {
+
+ List<GenericResourceApiVmtopologydataVmnamesVnfcNames> vnfcNamesList = vmNames.getVnfcNames();
+ if (vnfcNamesList != null) {
+
+ for(int i = 0; i < vnfcNamesList.size(); i++){
+
+ GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames = vnfcNamesList.get(i);
+ parseVnfcNamesData(paramsMap, vnfcNames);
+ }
+ }
+ }
+ }
+
+ /*
+ * Parse vnfcNames data to build Mapping from GenericResourceApi SDNC for Heat Template.
+ */
+ private void parseVnfcNamesData(Map<String,String> paramsMap, GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames) {
+
+ if (vnfcNames != null) {
+ GenericResourceApiVnfcNetworkData vnfcNetworks = vnfcNames.getVnfcNetworks();
+ if (vnfcNetworks != null) {
+ List<GenericResourceApiVnfcnetworkdataVnfcNetworkData> vnfcNetworkdataList = vnfcNetworks.getVnfcNetworkData();
+
+ if (vnfcNetworkdataList != null) {
+
+ for(int networkDataIdx = 0; networkDataIdx < vnfcNetworkdataList.size(); networkDataIdx++){
+
+ GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata = vnfcNetworkdataList.get(networkDataIdx);
+ parseVnfcNetworkData(paramsMap, vnfcNetworkdata, networkDataIdx);
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Parse VnfcNetworkData to build Mapping from GenericResourceApi SDNC for Heat Template.
+ * Build Count of SubInterfaces, VLAN Tag, network_name, network_id,
+ * ip_address (V4 and V6) and Floating IPs Addresses (V4 and V6) for Heat Template
+ */
+ private void parseVnfcNetworkData(Map<String,String> paramsMap, GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) {
+
+ String vmTypeKey = vnfcNetworkdata.getVnfcType();
+ GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
+ List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> vnfcPortList = vnfcPorts.getVnfcPort();
+ if (vnfcPortList != null) {
+ for(int portIdx = 0; portIdx < vnfcPortList.size(); portIdx++){
+
+ GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort vnfcPort = vnfcPortList.get(portIdx);
+ GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces = vnfcPort.getVnicSubInterfaces();
+
+ String vnicSubInterfacesString = convertToString(vnicSubInterfaces);
+ String networkRoleKey = vnfcPort.getCommonSubInterfaceRole();
+ String subInterfaceKey = createVnfcSubInterfaceKey(vmTypeKey, networkDataIdx, networkRoleKey, portIdx);
+ String globalSubInterfaceKey = createGlobalVnfcSubInterfaceKey(vmTypeKey, networkRoleKey, portIdx);
+
+ buildVfModuleSubInterfacesCount(paramsMap, globalSubInterfaceKey, vnicSubInterfaces);
+
+ buildVfModuleVlanTag(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleNetworkName(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleNetworkId(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleIpV4AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleIpV6AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleFloatingIpV4HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleFloatingIpV6HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+ }
+ }
+ }
+
+ /*
+ * Build "count" (calculating the total number of sub-interfaces) for Heat Template
+ * Building Criteria : {vm-type}_subint_{network-role}_port_{index}_subintcount
+ * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role
+ * Example: fw_subint_ctrl_port_0_subintcount
+ *
+ */
+ private void buildVfModuleSubInterfacesCount(Map<String,String> paramsMap, String keyPrefix, GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) {
+
+ List<GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData> subInterfaceNetworkDataList = vnicSubInterfaces.getSubInterfaceNetworkData();
+
+ if ( (subInterfaceNetworkDataList != null) && !subInterfaceNetworkDataList.isEmpty() ) {
+ addPairToMap(paramsMap, keyPrefix, SUB_INT_COUNT, String.valueOf(subInterfaceNetworkDataList.size()));
+ }
+ }
+
+ protected String createVnfcSubInterfaceKey(String vmTypeKey, int networkDataIdx, String networkRoleKey, int portIdx) {
+
+ return Joiner.on(UNDERSCORE).join(Arrays.asList(vmTypeKey, networkDataIdx, SUB_INT, networkRoleKey, PORT, portIdx));
+ }
+
+ protected String createGlobalVnfcSubInterfaceKey(String vmTypeKey,String networkRoleKey, int portIdx) {
+
+ return Joiner.on(UNDERSCORE).join(Arrays.asList(vmTypeKey, SUB_INT, networkRoleKey, PORT, portIdx));
+ }
+
+ /*
+ * Build VLAN Tag for Heat Template
+ * Building Criteria : {vm-type}_{index}_subint_{network-role}_port_{index}_vlan_ids
+ * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role
+ * Example: fw_0_subint_ctrl_port_0_vlan_ids
+ *
+ */
+ protected void buildVfModuleVlanTag(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> vlanTagIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].vlan-tag-id");
+
+ addPairToMap(paramsMap, keyPrefix, VLAN_IDS, vlanTagIds);
+ }
+ /*
+ * Build "network_name" for Heat Template
+ * Building Criteria : {vm-type}_{index}_subint_{network-role}_port_{index}_net_names
+ * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role
+ * Example: fw_0_subint_ctrl_port_0_net_names
+ *
+ */
+ protected void buildVfModuleNetworkName(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> neworkNames = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-name");
+
+ addPairToMap(paramsMap, keyPrefix, NET_NAMES, neworkNames);
+ }
+
+ /*
+ * Build "network_id" for Heat Template
+ * Building Criteria : {vm-type}_{index}_subint_{network-role}_port_{index}_net_ids
+ * vmTypeKey = vm-type, networkRoleKey = common-sub-interface-role
+ * Example: fw_0_subint_ctrl_port_0_net_ids
+ *
+ */
+ protected void buildVfModuleNetworkId(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> neworkIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-id");
+
+ addPairToMap(paramsMap, keyPrefix, NET_IDS, neworkIds);
+ }
+
+ /*
+ * Build ip_address for V4 for Heat Template
+ * Building Criteria :
+ * {vm-type}_{index}_subint_{network-role}_port_{index}_ip_{index} -- for ipV4
+ * key = vm-type, networkRoleKey = NetWork-Role
+ */
+ protected void buildVfModuleIpV4AddressHeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> ipv4Ips = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv4')].network-ips.network-ip[*]");
+
+ addPairToMap(paramsMap, keyPrefix, IP, ipv4Ips);
+
+ for (int i = 0; i < ipv4Ips.size(); i++) {
+ addPairToMap(paramsMap, keyPrefix, IP + UNDERSCORE + i, ipv4Ips.get(i));
+ }
+
+ }
+
+ /*
+ * Build ip_address for Heat Template
+ * Building Criteria :
+ * {vm-type}_{index}_subint_{network-role}_port_{index}_v6_ip_{index} -- for ipV6
+ * key = vm-type, networkRoleKey = NetWork-Role
+ */
+ protected void buildVfModuleIpV6AddressHeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> ipv6Ips = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv6')].network-ips.network-ip[*]");
+
+ addPairToMap(paramsMap, keyPrefix, V6_IP, ipv6Ips);
+
+ for (int i = 0; i < ipv6Ips.size(); i++) {
+ addPairToMap(paramsMap, keyPrefix, V6_IP + UNDERSCORE + i, ipv6Ips.get(i));
+ }
+ }
+
+ /*
+ * Build floatingip_address for Heat Template
+ * Building Criteria :
+ * {vm-type}_subint_{network-role}_port_{index}_floating_ip -- for ipV4
+ */
+ protected void buildVfModuleFloatingIpV4HeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> floatingV4 = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].floating-ips.floating-ip-v4[*]");
+
+ if (!floatingV4.isEmpty()) {
+ floatingV4 = Collections.singletonList(floatingV4.get(0));
+ }
+ addPairToMap(paramsMap, keyPrefix, FLOATING_IP, floatingV4);
+
+ }
+
+ /*
+ * Build floatingip_address for Heat Template
+ * Building Criteria :
+ * {vm-type}_subint_{network-role}_port_{index}_floating_v6_ip -- for ipV6
+ */
+ protected void buildVfModuleFloatingIpV6HeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+
+ List<String> floatingV6 = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].floating-ips.floating-ip-v6[*]");
+
+ if (!floatingV6.isEmpty()) {
+ floatingV6 = Collections.singletonList(floatingV6.get(0));
+ }
+ addPairToMap(paramsMap, keyPrefix, FLOATING_V6_IP, floatingV6);
+ }
+
+ protected void addPairToMap(Map<String, String> paramsMap, String keyPrefix, String key, String value) {
+
+ addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value));
+ }
+
+ protected void addPairToMap(Map<String, String> paramsMap, String keyPrefix, String key, List<String> value) {
+
+ if (!value.isEmpty()) {
+ paramsMap.put(keyPrefix + key, Joiner.on(",").join(value));
+ }
+ }
+
+ private void buildParamsMapFromSdncParams(Map<String,String> paramsMap, GenericResourceApiParam parametersData) {
+ if (parametersData != null) {
+ List<GenericResourceApiParamParam> paramsList = parametersData.getParam();
+ if (paramsList != null) {
+ for (int i = 0; i < paramsList.size(); i++) {
+ GenericResourceApiParamParam param = paramsList.get(i);
+ String parameterName = param.getName();
+ if (!sdncResponseParamsToSkip.contains(parameterName)) {
+ String parameterValue = param.getValue();
+ paramsMap.put(parameterName, parameterValue);
+ }
+ }
+ }
+ }
+ }
+
+ private Map<String,String> buildNetworkRoleMap(GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology) throws JsonParseException, JsonMappingException, IOException {
+ Map<String, String> networkRoleMap = new HashMap<>();
+ GenericResourceApiVfmoduleassignmentsVfModuleAssignments vfModuleAssignments = vfModuleTopology.getVfModuleAssignments();
+ if (vfModuleAssignments != null) {
+ GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms vms = vfModuleAssignments.getVms();
+ if (vms != null) {
+ List<GenericResourceApiVmTopologyData> vmsList = vms.getVm();
+ if (vmsList != null) {
+ for (GenericResourceApiVmTopologyData vm : vmsList){
+ GenericResourceApiVmtopologydataVmNetworks vmNetworks = vm.getVmNetworks();
+ if (vmNetworks != null) {
+ List<GenericResourceApiVmNetworkData> vmNetworksList = vmNetworks.getVmNetwork();
+ if (vmNetworksList != null) {
+ for(int n = 0; n < vmNetworksList.size(); n++){
+ GenericResourceApiVmNetworkData network = vmNetworksList.get(n);
+ String networkRole = network.getNetworkRole();
+ String networkRoleValue = network.getNetworkRoleTag();
+ if (networkRoleValue == null || networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole;
+ }
+ networkRoleMap.put(networkRole, networkRoleValue);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return networkRoleMap;
+ }
+
+ public DeleteVfModuleRequest deleteVfModuleRequestMapper(RequestContext requestContext,CloudRegion cloudRegion,
+ ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule) throws IOException {
+ DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest();
+ deleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+ deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
+ deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId
+ deleteVfModuleRequest.setSkipAAI(true);
+ String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
+ deleteVfModuleRequest.setMessageId(messageId);
+ deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
+ MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
+ deleteVfModuleRequest.setMsoRequest(msoRequest);
+ return deleteVfModuleRequest;
+ }
+
+ private String convertToString(Object obj) {
+ String json;
+ try {
+ json = mapper.writeValueAsString(obj);
+ } catch (JsonProcessingException e) {
+ json = "{}";
+ }
+
+ return json;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java
new file mode 100644
index 0000000000..4a9f01fa53
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAICollectionResources {
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public void createCollection(Collection collection) {
+ AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ collection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection);
+ injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
+ }
+
+ public void updateCollection(Collection collection) {
+ AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection);
+ injectionHelper.getAaiClient().update(networkCollectionURI, aaiCollection);
+ }
+
+ public void deleteCollection(Collection collection) {
+ AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ injectionHelper.getAaiClient().delete(instanceGroupUri);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
new file mode 100644
index 0000000000..b84f8b6459
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIConfigurationResources {
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ /**
+ * A&AI call to create configuration
+ *
+ * @param configuration
+ */
+ public void createConfiguration(Configuration configuration) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+ injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
+ }
+
+ /**
+ * method to get Configuration details from A&AI
+ *
+ * @param configurationId
+ * @return
+ */
+ public Optional<org.onap.aai.domain.yang.Configuration> getConfiguration(String configurationId) {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
+ }
+
+ /**
+ * A&AI call to update configuration
+ *
+ * @param configuration
+ */
+ public void updateConfiguration(Configuration configuration) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+ injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration);
+ }
+ /**
+ * A&AI call to disconnect configuration relation with service instance
+ * @param configurationId
+ * @param serviceInstanceId
+ */
+
+ public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId){
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstanceId);
+ injectionHelper.getAaiClient().disconnect(configurationURI,serviceInstanceURI);
+ }
+
+ /**
+ * A&AI call to add vrf configuration relationship with Vnr Configuration
+ *
+ * @param vrfConfigurationId
+ * @param vnrConfigurationId
+ */
+ public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) {
+ AAIResourceUri vnrConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
+ AAIResourceUri vrfConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
+ injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri);
+ }
+
+ /**
+ * A&AI call to add configuration relationship with PnfObject
+ *
+ * @param pnfId
+ * @param configurationId
+ */
+ public void connectConfigurationToPnfObject(String pnfId, String configurationId) {
+ AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId);
+ AAIResourceUri configurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ injectionHelper.getAaiClient().connect(configurationUri, pnfUri);
+ }
+
+ /**
+ * A&AI call to add configuration relationship with service instance
+ *
+ * @param configurationId
+ * @param serviceInstanceId
+ */
+ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstanceId);
+ injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
+ }
+
+ /**
+ * A&AI call to add configuration relationship with generic-vnf
+ *
+ * @param configurationId
+ * @param genericVnfId
+ */
+ public void connectConfigurationToGenericVnf(String configurationId, String genericVnfId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId);
+ injectionHelper.getAaiClient().connect(configurationURI, genericVnfURI);
+ }
+
+ /**
+ * A&AI call to add configuration relationship with vpn-binding
+ *
+ * @param configurationId
+ * @param vpnId
+ */
+ public void connectConfigurationToVpnBinding(String configurationId, String vpnId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
+ injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
+ }
+ /**
+ * method to delete Configuration details in A&AI
+ *
+ * @param configurationId
+ */
+ public void deleteConfiguration(String configurationId) {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ injectionHelper.getAaiClient().delete(aaiResourceUri);
+ }
+
+ /**
+ * Get Configuration from AAI using related Link
+ * @param relatedLink related link - URI
+ * @return AAI Configuration object
+ */
+ public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink){
+ return injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
new file mode 100644
index 0000000000..4c4edb7fe9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIInstanceGroupResources {
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public void createInstanceGroup(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
+ injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup));
+ }
+
+ public void deleteInstanceGroup(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ injectionHelper.getAaiClient().delete(instanceGroupUri);
+ }
+
+ public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf) {
+ AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI);
+ }
+
+ public boolean exists(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ return injectionHelper.getAaiClient().exists(instanceGroupUri);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
new file mode 100644
index 0000000000..e4984c921d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAINetworkResources {
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public void updateNetwork(L3Network network) {
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
+ injectionHelper.getAaiClient().update(networkURI, aaiL3Network);
+ }
+
+ public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) {
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
+ injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI, serviceInstanceURI);
+ }
+
+ public void deleteNetwork(L3Network network) {
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ injectionHelper.getAaiClient().delete(networkURI);
+ }
+
+ public Optional<VpnBinding> getVpnBinding(AAIResourceUri netBindingUri) {
+ return injectionHelper.getAaiClient().get(netBindingUri).asBean(VpnBinding.class);
+ }
+
+ public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
+ return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
+ }
+
+ public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) {
+ return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class);
+ }
+
+ public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL);
+ AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri);
+ return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+ }
+
+ public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL);
+ return injectionHelper.getAaiClient().get(uri);
+ }
+
+ public void createNetworkInstanceGroup(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
+ injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup);
+ }
+
+ public void createNetworkCollection(Collection networkCollection) {
+ AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+ networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection);
+ injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
+ }
+
+ public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) {
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ injectionHelper.getAaiClient().connect(tenantURI, networkURI);
+ }
+
+ public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ injectionHelper.getAaiClient().connect(cloudRegionURI, networkURI);
+ }
+
+ public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) {
+ AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI);
+ }
+
+ public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network, ServiceInstance networkCollectionServiceInstance) {
+ AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI);
+ }
+
+ public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) {
+ AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+ AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI);
+ }
+
+ public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) {
+ AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+ AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri);
+ }
+
+ public void deleteCollection(Collection collection) {
+ AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ injectionHelper.getAaiClient().delete(collectionURI);
+ }
+
+ public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ injectionHelper.getAaiClient().delete(instanceGroupURI);
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
new file mode 100644
index 0000000000..b5738dcb40
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIServiceInstanceResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIServiceInstanceResources.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public boolean existsServiceInstance(ServiceInstance serviceInstance) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ return injectionHelper.getAaiClient().exists(serviceInstanceURI);
+ }
+
+ public void createServiceInstance(ServiceInstance serviceInstance, Customer customer) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId());
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance);
+ injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(AAIServiceInstance));
+ }
+
+ /**
+ * Create ServiceSubscription in A&AI
+ * @param customer
+ */
+ public void createServiceSubscription(Customer customer) {
+ AAIResourceUri serviceSubscriptionURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION,
+ customer.getGlobalCustomerId(),customer.getServiceSubscription().getServiceType());
+ org.onap.aai.domain.yang.ServiceSubscription serviceSubscription = aaiObjectMapper.mapServiceSubscription(customer.getServiceSubscription());
+ injectionHelper.getAaiClient().createIfNotExists(serviceSubscriptionURI , Optional.of(serviceSubscription));
+ }
+
+ public void deleteServiceInstance(ServiceInstance serviceInstance) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().delete(serviceInstanceURI);
+ }
+
+ public void createProject(Project project) {
+ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
+ org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
+ injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject));
+ }
+
+ public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) {
+ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
+ injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)).connect(projectURI, serviceInstanceURI);
+ }
+
+ public void createOwningEntity(OwningEntity owningEntity) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY,
+ owningEntity.getOwningEntityId());
+ org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
+ injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity));
+ }
+
+ public boolean existsOwningEntity(OwningEntity owningEntity) {
+ AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY,
+ owningEntity.getOwningEntityId());
+ return injectionHelper.getAaiClient().exists(owningEntityUri);
+ }
+
+ public boolean existsOwningEntityName(String owningEntityName) {
+ AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITIES).queryParam("owning-entity-name", owningEntityName);
+ AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
+ return aaiRC.exists(owningEntityUri);
+ }
+
+ public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY,
+ owningEntity.getOwningEntityId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI);
+ }
+
+ public void createOwningEntityandConnectServiceInstance(OwningEntity owningEntity,
+ ServiceInstance serviceInstance) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY,
+ owningEntity.getOwningEntityId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
+ injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)).connect(owningEntityURI,
+ serviceInstanceURI);
+ }
+
+ public void updateOrchestrationStatusServiceInstance(ServiceInstance serviceInstance, OrchestrationStatus orchestrationStatus){
+ ServiceInstance copiedServiceInstance = serviceInstance.shallowCopyId();
+
+ copiedServiceInstance.setOrchestrationStatus(orchestrationStatus);
+ copiedServiceInstance.setServiceInstanceName(serviceInstance.getServiceInstanceName());
+ serviceInstance.setOrchestrationStatus(orchestrationStatus);
+ updateServiceInstance(copiedServiceInstance);
+ }
+
+ public void updateServiceInstance(ServiceInstance serviceInstance) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance);
+ injectionHelper.getAaiClient().update(serviceInstanceURI, AAIServiceInstance);
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
new file mode 100644
index 0000000000..7fef56d965
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIVfModuleResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVfModuleResources.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public void createVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ injectionHelper.getAaiClient().createIfNotExists(vfModuleURI, Optional.of(aaiObjectMapper.mapVfModule(vfModule)));
+ }
+
+ public void deleteVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ injectionHelper.getAaiClient().delete(vfModuleURI);
+ }
+
+ public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
+
+ vfModule.setOrchestrationStatus(orchestrationStatus);
+ copiedVfModule.setOrchestrationStatus(orchestrationStatus);
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
+
+ public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, AAIVfModule);
+ }
+
+ public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
new file mode 100644
index 0000000000..19025b4b9f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIVnfResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVnfResources.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) {
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf))).connect(vnfURI, serviceInstanceURI);
+ }
+
+ public void createPlatformandConnectVnf(Platform platform, GenericVnf vnf) {
+ AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(vnfURI, platformURI);
+ }
+
+ public void createLineOfBusinessandConnectVnf(LineOfBusiness lineOfBusiness, GenericVnf vnf) {
+ AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)).connect(vnfURI, lineOfBusinessURI);
+ }
+
+ public void deleteVnf(GenericVnf vnf) {
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().delete(vnfURI);
+ }
+
+ public void updateOrchestrationStatusVnf(GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+
+ GenericVnf copiedVnf = vnf.shallowCopyId();
+
+ vnf.setOrchestrationStatus(orchestrationStatus);
+ copiedVnf.setOrchestrationStatus(orchestrationStatus);
+ injectionHelper.getAaiClient().update(vnfURI, aaiObjectMapper.mapVnf(copiedVnf));
+ }
+
+ public void updateObjectVnf(GenericVnf vnf) {
+ AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().update(vnfUri, aaiObjectMapper.mapVnf(vnf));
+ }
+
+ /**
+ * Retrieve Generic VNF from AAI using vnf Id
+ * @param vnfId - vnf-id required vnf
+ * @return AAI Generic Vnf
+ */
+ public Optional<org.onap.aai.domain.yang.GenericVnf> getGenericVnf( String vnfId) {
+ return injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ }
+
+ /**
+ * Check inMaint flag value of Generic VNF from AAI using vnf Id
+ * @param vnfId - vnf-id required vnf
+ * @return inMaint flag value
+ */
+ public boolean checkInMaintFlag(String vnfId) {
+ org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElse(new org.onap.aai.domain.yang.GenericVnf());
+ return vnf.isInMaint();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
new file mode 100644
index 0000000000..70c6724921
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIVolumeGroupResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVolumeGroupResources.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ public void createVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ injectionHelper.getAaiClient().create(uriVolumeGroup, aaiObjectMapper.mapVolumeGroup(volumeGroup));
+ }
+
+ public void updateOrchestrationStatusVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion, OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
+
+ volumeGroup.setOrchestrationStatus(orchestrationStatus);
+ copiedVolumeGroup.setOrchestrationStatus(orchestrationStatus);
+ injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
+ }
+
+ public void connectVolumeGroupToVnf(GenericVnf genericVnf, VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri uriGenericVnf = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId());
+ AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ injectionHelper.getAaiClient().connect(uriGenericVnf, uriVolumeGroup);
+ }
+
+ public void connectVolumeGroupToTenant(VolumeGroup volumeGroup , CloudRegion cloudRegion) {
+ AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(),cloudRegion.getTenantId());
+ AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ injectionHelper.getAaiClient().connect(uriTenant, uriVolumeGroup);
+ }
+
+ public void deleteVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ injectionHelper.getAaiClient().delete(uri);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
new file mode 100644
index 0000000000..8bd55f0f90
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.Optional;
+
+import javax.ws.rs.NotFoundException;
+
+import org.onap.aai.domain.yang.VpnBindings;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIVpnBindingResources {
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ /**
+ * @param customer
+ */
+ public boolean existsCustomer(Customer customer) {
+ AAIResourceUri uriCustomer = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+ return injectionHelper.getAaiClient().exists(uriCustomer);
+ }
+
+ /**
+ * @param customerVpnId
+ * @return
+ */
+ public Optional<VpnBindings> getVpnBindingByCustomerVpnId (String customerVpnId) {
+ AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDINGS)
+ .queryParam("customer-vpn-id",customerVpnId);
+ return injectionHelper.getAaiClient().get(VpnBindings.class,aaiVpnBindingsResourceUri);
+
+ }
+
+ /**
+ * @param vpnBinding
+ */
+ public void createVpnBinding(VpnBinding vpnBinding) {
+ AAIResourceUri aaiVpnBindingResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING,vpnBinding.getVpnId());
+ injectionHelper.getAaiClient().create(aaiVpnBindingResourceUri, aaiObjectMapper.mapVpnBinding(vpnBinding));
+ }
+
+ /**
+ * @param customer
+ */
+ public void createCustomer(Customer customer) {
+ AAIResourceUri uriCustomer = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+ injectionHelper.getAaiClient().create(uriCustomer, aaiObjectMapper.mapCustomer(customer));
+ }
+
+ /**
+ * Retrieve VPN Binding from AAI using vpn-id
+ * @param vpnId - vpn-id required VPN Binding
+ * @return AAI VPN Binding
+ */
+ public Optional<org.onap.aai.domain.yang.VpnBinding> getVpnBinding(String vpnId){
+ return injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.VpnBinding.class, AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId));
+ }
+
+
+ /**
+ * @param globalSubscriberId
+ * @param vpnId
+ */
+ public void connectCustomerToVpnBinding(String globalSubscriberId, String vpnId) {
+ AAIResourceUri customerURI = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId);
+ AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING,vpnId);
+ injectionHelper.getAaiClient().connect(customerURI, vpnBindingURI);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
new file mode 100644
index 0000000000..3e2b66befa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.network.NetworkAdapterClientException;
+import org.onap.so.client.adapter.network.NetworkAdapterClientImpl;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkAdapterResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterResources.class);
+
+ @Autowired
+ private NetworkAdapterClientImpl networkAdapterClient;
+
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+
+ public Optional<CreateNetworkResponse> createNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
+ return Optional.of(networkAdapterClient.createNetwork(createNetworkRequest));
+ }
+
+ public Optional<RollbackNetworkResponse> rollbackCreateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ RollbackNetworkRequest rollbackNetworkRequest = null;
+ rollbackNetworkRequest = networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
+
+ return Optional.of(networkAdapterClient.rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest));
+ }
+
+ public Optional<UpdateNetworkResponse> updateNetwork(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, Customer customer) throws UnsupportedEncodingException, NetworkAdapterClientException {
+ UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
+
+ return Optional.of(networkAdapterClient.updateNetwork(l3Network.getNetworkId(), updateNetworkRequest));
+ }
+
+ public Optional<DeleteNetworkResponse> deleteNetwork(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+ return Optional.of(networkAdapterClient.deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
new file mode 100644
index 0000000000..66256ca72e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+
+@Component
+public class SDNCConfigurationResources {
+ @Autowired
+ private GCTopologyOperationRequestMapper sdncRM;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ /**
+ * SDN-C call to assign configuration after it was created in A&AI
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @param voiceVnf
+ * @return
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public String assignVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext,
+ Customer customer,
+ Configuration vnrConfiguration,
+ GenericVnf voiceVnf)
+ throws MapperException, BadResponseException {
+ GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper(
+ SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
+ serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf);
+ return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
+ }
+
+ /**
+ * SDNC Call to Activate VNR Configuration
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @param voiceVnf
+ * @return
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public String activateVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext,
+ Customer customer,
+ Configuration vnrConfiguration,
+ GenericVnf voiceVnf)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper(
+ SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
+ serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf);
+ return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
+ }
+
+ /**
+ * method to unAssign Vnr Configuration in SDNC
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @return
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public String unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext,
+ Configuration vnrConfiguration) throws BadResponseException, MapperException {
+
+ GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper
+ (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration);
+ return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
+ }
+
+ /***
+ * Deactivate VNR SDNC Call
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public String deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration) throws BadResponseException, MapperException {
+ GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper(
+ SDNCSvcAction.DEACTIVATE,
+ serviceInstance , requestContext, vnrConfiguration);
+ return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
new file mode 100644
index 0000000000..02dd1e418d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+
+@Component
+public class SDNCNetworkResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCNetworkResources.class);
+
+ @Autowired
+ private NetworkTopologyOperationRequestMapper sdncRM;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ public String assignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext, CloudRegion cloudRegion)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+ public String rollbackAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext, CloudRegion cloudRegion)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
+ SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+ public String activateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext, CloudRegion cloudRegion)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ACTIVATE, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+ public String deactivateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, CloudRegion cloudRegion) throws MapperException, BadResponseException {
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
+ SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+ public String deleteNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext, CloudRegion cloudRegion)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
+ SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+ public String changeAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext, CloudRegion cloudRegion)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+ public String unassignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext, CloudRegion cloudRegion)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
+ SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
new file mode 100644
index 0000000000..1357d40604
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation;
+
+@Component
+public class SDNCServiceInstanceResources {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ SDNCServiceInstanceResources.class);
+
+ @Autowired
+ private ServiceTopologyOperationMapper sdncRM;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ /**
+ * SDNC call to perform Service Topology Assign for ServiceInsatnce
+ * @param serviceInstance
+ * @param customer
+ * @param requestContext
+ * @throws MapperException
+ * @throws BadResponseException
+ * @return the response as a String
+ */
+ public String assignServiceInstance(ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext) throws MapperException, BadResponseException {
+ GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
+ SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
+ }
+
+ /**
+ * SDNC call to perform Service Topology Delete for ServiceInsatnce
+ * @param serviceInstance
+ * @param customer
+ * @param requestContext
+ * @throws MapperException
+ * @throws BadResponseException
+ * @return the response as a String
+ */
+ public String deleteServiceInstance(ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext) throws MapperException, BadResponseException {
+ GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
+ SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
+ }
+
+ public String unassignServiceInstance(ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext) throws MapperException, BadResponseException {
+ GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
+ SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
+ }
+
+ /**
+ * SDNC call to perform Service Topology Deactivate for ServiceInstance
+ * @param serviceInstance
+ * @param customer
+ * @param requestContext
+ * @throws MapperException
+ * @throws BadResponseException
+ * @return the response as a String
+ */
+ public String deactivateServiceInstance(ServiceInstance serviceInstance, Customer customer,
+ RequestContext requestContext) throws MapperException, BadResponseException {
+ GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
+ SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
+ }
+
+ /**
+ * SDNC call to perform Service Topology Change Assign for the ServiceInstance
+ * @param serviceInstance
+ * @param customer
+ * @param requestContext
+ * @throws MapperException
+ * @throws BadResponseException
+ * @return the response as a String
+ */
+ public String changeModelServiceInstance(ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) throws MapperException, BadResponseException {
+ GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext);
+ return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
new file mode 100644
index 0000000000..e2146dda99
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCVfModuleResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVfModuleResources.class);
+
+ @Autowired
+ private VfModuleTopologyOperationRequestMapper sdncRM;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ public String assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ }
+
+ public String unassignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null);
+ return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ }
+
+ public String deactivateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(
+ SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance,
+ customer, cloudRegion, requestContext, null);
+ return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ }
+
+ public String queryVfModule(VfModule vfModule)
+ throws MapperException, BadResponseException {
+
+ String objectPath = vfModule.getSelflink();
+ return sdncClient.get(objectPath);
+ }
+
+ public String activateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+
+ GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ }
+
+ public String changeAssignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) throws MapperException, BadResponseException {
+ GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
new file mode 100644
index 0000000000..c43deb13d2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCVnfResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVnfResources.class);
+
+ @Autowired
+ private VnfTopologyOperationRequestMapper sdncRM;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ public String assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext, boolean homing)
+ throws MapperException, BadResponseException {
+ GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing);
+ return sdncClient.post(sdncReq, SDNCTopology.VNF);
+ }
+
+ public String activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+ GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ SDNCSvcAction.ACTIVATE,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
+ return sdncClient.post(sdncReq, SDNCTopology.VNF);
+ }
+
+
+ public String deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+ GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ SDNCSvcAction.DEACTIVATE,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
+ return sdncClient.post(sdncReq, SDNCTopology.VNF);
+ }
+
+
+ public String unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+ GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ SDNCSvcAction.UNASSIGN,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ return sdncClient.post(sdncReq, SDNCTopology.VNF);
+ }
+
+ public String deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+ GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE,vnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ return sdncClient.post(sdncReq, SDNCTopology.VNF);
+ }
+
+ public String changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException, BadResponseException {
+ GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ return sdncClient.post(sdncReq, SDNCTopology.VNF);
+ }
+
+ public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
+ String queryPath = vnf.getSelflink();
+ return sdncClient.get(queryPath);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java
new file mode 100644
index 0000000000..dac89a495d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.util.UUID;
+
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNOHealthCheckResources {
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ /**
+ * SDNO Call to Check Health Status
+ *
+ * @param vnf
+ * @param requestContext *
+ * @return healthCheckResult
+ * @throws
+ * @throws Exception
+ */
+ public boolean healthCheck(GenericVnf vnf, RequestContext requestContext) throws Exception {
+ String requestId = requestContext.getMsoRequestId();
+ String requestorId = requestContext.getRequestorId();
+ String vnfId = vnf.getVnfId();
+ UUID uuid = UUID.fromString(requestId);
+
+ return injectionHelper.getSdnoValidator().healthDiagnostic(vnfId, uuid, requestorId);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
new file mode 100644
index 0000000000..e52616677d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import java.io.IOException;
+
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfAdapterVfModuleResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterVfModuleResources.class);
+
+ @Autowired
+ private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
+
+ public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException {
+ return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+ }
+
+ public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
+ ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule) throws IOException {
+ return vnfAdapterVfModuleObjectMapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
new file mode 100644
index 0000000000..8655104830
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfAdapterVolumeGroupResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterVolumeGroupResources.class);
+
+ @Autowired
+ private VnfAdapterObjectMapper vnfAdapterObjectMapper;
+
+ @Autowired
+ private VnfVolumeAdapterClientImpl vnfVolumeAdapterClient;
+
+ public CreateVolumeGroupRequest createVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws Exception {
+ return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+ }
+
+ public DeleteVolumeGroupResponse deleteVolumeGroup(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ msoLogger.debug(deleteVolumeGroupRequest.toString());
+ return vnfVolumeAdapterClient.deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
new file mode 100644
index 0000000000..1ce7a92eb5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.util.Collections;
+
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+
+//TODO move to common location
+public class BaseClient<I,O> {
+
+ private HttpHeaders httpHeader;
+ private String targetUrl;
+
+ public HttpHeaders getHttpHeader() {
+ return httpHeader;
+ }
+
+ public void setHttpHeader(HttpHeaders httpHeader) {
+ this.httpHeader = httpHeader;
+ }
+
+ public String getTargetUrl() {
+ return targetUrl;
+ }
+
+ public void setTargetUrl(String targetUrl) {
+ this.targetUrl = targetUrl;
+ }
+
+ public O get(I data, Object... uriVariables) throws RestClientException {
+ return run(data, HttpMethod.GET, uriVariables);
+ }
+
+ public O post(I data, Object... uriVariables) throws RestClientException {
+ return run(data, HttpMethod.POST, uriVariables);
+ }
+
+ public O run(I data, HttpMethod method, Object... uriVariables) throws RestClientException {
+ HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
+ RestTemplate restTemplate = new RestTemplate();
+ ObjectMapper mapper = new ObjectMapper();
+ MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+ converter.setObjectMapper(mapper);
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ restTemplate.getMessageConverters().add(0, converter);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()));
+ ParameterizedTypeReference<O> output = new ParameterizedTypeReference<O>() {};
+ ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, output,
+ uriVariables);
+ return responseEntity.getBody();
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
new file mode 100644
index 0000000000..1f0d654a85
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc;
+
+import java.util.LinkedHashMap;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.beans.SDNCProperties;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDNCClient {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class);
+ private BaseClient<String, LinkedHashMap<?, ?>> STOClient = new BaseClient<>();
+
+ @Autowired
+ private SDNCProperties properties;
+ @Autowired
+ private SdnCommonTasks sdnCommonTasks;
+ /**
+ *
+ * @param request
+ * - takes in a generated object from sdnc client
+ * - creates a json request string and sends it to sdnc
+ * - receives and validates the linkedhashmap sent back from sdnc
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl);
+ LinkedHashMap<?, ?> output = STOClient.post(jsonRequest);
+ msoLogger.info("Validating output...");
+ return sdnCommonTasks.validateSDNResponse(output);
+ }
+
+
+ /**
+ *
+ * @param queryLink
+ * - takes in a link to topology that needs to be queried
+ * - creates a json request string and sends it to sdnc
+ * - receives and validates the linkedhashmap sent back from sdnc
+ * *
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public String get(String queryLink) throws MapperException, BadResponseException {
+
+ String request = "";
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ STOClient.setTargetUrl(targetUrl);
+ msoLogger.info("TargetUrl: " + targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ msoLogger.info("Running SDNC CLIENT...");
+ LinkedHashMap<?, ?> output = STOClient.get(jsonRequest);
+ msoLogger.info("Validating output...");
+ return sdnCommonTasks.validateSDNGetResponse(output);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
new file mode 100644
index 0000000000..d35296af9b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sdnc;
+
+import java.util.LinkedHashMap;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpStatus;
+import org.json.JSONObject;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class SdnCommonTasks {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class);
+ private static final String RESPONSE_CODE = "response-code";
+ private static final String RESPONSE_MESSAGE = "response-message";
+ private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC.";
+ private static final String BAD_RESPONSE_FROM_SDNC = "Error received a bad response from SDNC.";
+ private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s";
+ private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON = "ERROR: Could not convert SDNC pojo to json string.";
+
+ /***
+ *
+ * @param request
+ * @return
+ * @throws MapperException
+ */
+ public String buildJsonRequest(Object request) throws MapperException {
+ String jsonRequest;
+ ObjectMapper objMapper = new ObjectMapper();
+ objMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ try {
+ jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
+ } catch (JsonProcessingException e) {
+ msoLogger.error(MessageEnum.JAXB_EXCEPTION, COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, e.getMessage());
+ throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
+ }
+ jsonRequest = "{\"input\":" + jsonRequest + "}";
+ msoLogger.info(jsonRequest);
+ return jsonRequest;
+ }
+
+ /***
+ *
+ * @param auth
+ * @return
+ */
+ public HttpHeaders getHttpHeaders(String auth) {
+ HttpHeaders httpHeader = new HttpHeaders();
+ httpHeader.set("Authorization", auth);
+ httpHeader.setContentType(MediaType.APPLICATION_JSON);
+ return httpHeader;
+ }
+
+ /***
+ *
+ * @param output
+ * @return
+ * @throws BadResponseException
+ */
+ public String validateSDNResponse(LinkedHashMap<?, ?> output) throws BadResponseException {
+ if (CollectionUtils.isEmpty(output)) {
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC);
+ throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
+ }
+ String responseCode = (String) output.get(RESPONSE_CODE);
+ String responseMessage = (String) output.get(RESPONSE_MESSAGE);
+ msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage);
+ int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
+ if (isHttpCodeSuccess(code)) {
+ msoLogger.info("Successful Response from SDNC");
+ return responseMessage;
+ } else {
+ String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ /***
+ *
+ * @param output
+ * @return
+ * @throws BadResponseException
+ */
+ public String validateSDNGetResponse(LinkedHashMap<?, ?> output) throws BadResponseException {
+ if (CollectionUtils.isEmpty(output)) {
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC);
+ throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
+ }
+ ObjectMapper objMapper = new ObjectMapper();
+ msoLogger.debug("Using object mapper");
+ String stringOutput = "";
+ try {
+ stringOutput = objMapper.writeValueAsString(output);
+ }
+ catch (Exception e) {
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, BAD_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, BAD_RESPONSE_FROM_SDNC);
+ throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
+ }
+ msoLogger.debug("Received from GET request: " + stringOutput);
+ return stringOutput;
+ }
+
+ private boolean isHttpCodeSuccess(int code) {
+ return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
new file mode 100644
index 0000000000..08be73e3fd
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.beans;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix="sdnc")
+public class SDNCProperties {
+
+ private String host;
+ private String path;
+ private String auth;
+
+ public String getHost() {
+ return host;
+ }
+ public void setHost(String host) {
+ this.host = host;
+ }
+ public String getPath() {
+ return path;
+ }
+ public void setPath(String path) {
+ this.path = path;
+ }
+ public String getAuth() {
+ return auth;
+ }
+ public void setAuth(String auth) {
+ this.auth = auth;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
new file mode 100644
index 0000000000..5f7ebdd867
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.beans;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration;
+
+public enum SDNCSvcAction {
+ ACTIVATE("activate",GenericResourceApiSvcActionEnumeration.ACTIVATE),
+ DELETE("delete",GenericResourceApiSvcActionEnumeration.DELETE),
+ ASSIGN("assign",GenericResourceApiSvcActionEnumeration.ASSIGN),
+ ROLLBACK("rollback",GenericResourceApiSvcActionEnumeration.ROLLBACK),
+ UNASSIGN("unassign",GenericResourceApiSvcActionEnumeration.UNASSIGN),
+ DEACTIVATE("deactivate",GenericResourceApiSvcActionEnumeration.DEACTIVATE),
+ CHANGE_DELETE("changedelete",GenericResourceApiSvcActionEnumeration.CHANGEDELETE),
+ CHANGE_ASSIGN("changeassign",GenericResourceApiSvcActionEnumeration.CHANGEASSIGN),
+ CREATE("create",GenericResourceApiSvcActionEnumeration.CREATE),
+ ENABLE("enable",GenericResourceApiSvcActionEnumeration.ENABLE),
+ DISABLE("disable",GenericResourceApiSvcActionEnumeration.DISABLE);
+
+ private final String name;
+
+ private GenericResourceApiSvcActionEnumeration sdncApiAction ;
+
+ private SDNCSvcAction(String name , GenericResourceApiSvcActionEnumeration sdncApiAction) {
+ this.name = name;
+ this.sdncApiAction = sdncApiAction;
+ }
+
+ public GenericResourceApiSvcActionEnumeration getSdncApiAction(){
+ return this.sdncApiAction;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
new file mode 100644
index 0000000000..ba9fedccac
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.beans;
+
+public enum SDNCSvcOperation {
+
+ VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
+ NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
+ VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
+ CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
+ SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
+ PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
+ SERVICE_TOPOLOGY_OPERATION("service-topology-operation"),
+ GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation");
+
+ private final String name;
+
+ private SDNCSvcOperation(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
new file mode 100644
index 0000000000..a709e80220
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.endpoint;
+
+public enum SDNCTopology {
+
+ SERVICE("service-topology-operation"),
+ VNF("vnf-topology-operation"),
+ VFMODULE("vf-module-topology-operation"),
+ CONTRAILROUTE("contrail-route-topology-operation"),
+ PORTMIRROR("port-mirror-topology-operation"),
+ NETWORK("network-topology-operation"),
+ SECURITYZONE("security-zone-topology-operation"),
+ CONFIGURATION("generic-configuration-topology-operation");
+
+ private final String topology;
+
+ private SDNCTopology(String topology) {
+ this.topology = topology;
+ }
+
+ @Override
+ public String toString(){
+ return this.topology;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
new file mode 100644
index 0000000000..8d71cdd923
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sdnc.mapper;
+
+import org.onap.sdnc.apps.client.model.*;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.springframework.stereotype.Component;
+
+@Component(value = "sdncGCTopologyOperationRequestMapper")
+public class GCTopologyOperationRequestMapper {
+
+ private static final GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper();
+
+ public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction,
+ GenericResourceApiRequestActionEnumeration reqAction,
+ ServiceInstance serviceInstance,
+ RequestContext requestContext,
+ Customer customer,
+ Configuration vnrConfiguration,
+ GenericVnf voiceVnf) {
+
+ GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
+ String sdncReqId = requestContext.getMsoRequestId();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);// TODO Set URL
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
+ GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true);
+ GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null);
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setConfigurationInformation(configurationInformation);
+ req.setGcRequestInput(gcRequestInput);
+
+ return req;
+
+ }
+
+
+ public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction,
+ ServiceInstance serviceInstance,
+ RequestContext requestContext,
+ Configuration vnrConfiguration) {
+
+ GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
+ String sdncReqId = requestContext.getMsoRequestId();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);// TODO Set URL
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId,
+ GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
+ serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =
+ new GenericResourceApiConfigurationinformationConfigurationInformation();
+ configurationInformation.setConfigurationId(vnrConfiguration.getConfigurationId());
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setConfigurationInformation(configurationInformation);
+ return req;
+
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
new file mode 100644
index 0000000000..a62168e9a2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import org.onap.sdnc.apps.client.model.*;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GeneralTopologyObjectMapper {
+
+ /*
+ * Build GenericResourceApiRequestinformationRequestInformation
+ */
+ public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(String sdncReqId, GenericResourceApiRequestActionEnumeration requestAction){
+
+ GenericResourceApiRequestinformationRequestInformation requestInformation = new GenericResourceApiRequestinformationRequestInformation();
+ requestInformation.setRequestId(sdncReqId);
+ requestInformation.setRequestAction(requestAction);
+ requestInformation.setSource("MSO");
+ return requestInformation;
+ }
+ /*
+ * Build GenericResourceApiServiceinformationServiceInformation
+ */
+ public GenericResourceApiServiceinformationServiceInformation buildServiceInformation(ServiceInstance serviceInstance, RequestContext requestContext, Customer customer, boolean includeModelInformation){
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
+ serviceInformation.serviceId(serviceInstance.getServiceInstanceId());
+ if (requestContext != null) {
+ serviceInformation.setSubscriptionServiceType(requestContext.getProductFamilyId());
+ }
+ if (includeModelInformation) {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ onapModelInformation.setModelInvariantUuid(serviceInstance.getModelInfoServiceInstance().getModelInvariantUuid());
+ onapModelInformation.setModelVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ onapModelInformation.setModelName(serviceInstance.getModelInfoServiceInstance().getModelName());
+ onapModelInformation.setModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ serviceInformation.setOnapModelInformation(onapModelInformation );
+ }
+ serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+
+ if (customer != null) {
+ serviceInformation.setGlobalCustomerId(customer.getGlobalCustomerId());
+ if(customer.getServiceSubscription() != null){
+ serviceInformation.setSubscriptionServiceType(customer.getServiceSubscription().getServiceType());
+ }
+
+ }
+ return serviceInformation;
+ }
+ /*
+ * Build GenericResourceApiNetworkinformationNetworkInformation
+ */
+ public GenericResourceApiNetworkinformationNetworkInformation buildNetworkInformation(L3Network network){
+ GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation();
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ if (network.getModelInfoNetwork() != null) {
+ onapModelInformation.setModelInvariantUuid(network.getModelInfoNetwork().getModelInvariantUUID());
+ onapModelInformation.setModelName(network.getModelInfoNetwork().getModelName());
+ onapModelInformation.setModelVersion(network.getModelInfoNetwork().getModelVersion());
+ onapModelInformation.setModelUuid(network.getModelInfoNetwork().getModelUUID());
+ onapModelInformation.setModelCustomizationUuid(network.getModelInfoNetwork().getModelCustomizationUUID());
+ networkInformation.setOnapModelInformation(onapModelInformation);
+ }
+ networkInformation.setNetworkId(network.getNetworkId());
+ //TODO fix this after network type filed included in L3Network object type
+ //networkInformation.setNetworkType(network.getNetwork);
+ return networkInformation;
+ }
+ /*
+ * Build GenericResourceApiVnfinformationVnfInformation
+ */
+ public GenericResourceApiVnfinformationVnfInformation buildVnfInformation(GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation){
+ GenericResourceApiVnfinformationVnfInformation vnfInformation = new GenericResourceApiVnfinformationVnfInformation();
+ if (includeModelInformation && vnf.getModelInfoGenericVnf() != null) {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ onapModelInformation.setModelInvariantUuid(vnf.getModelInfoGenericVnf().getModelInvariantUuid());
+ onapModelInformation.setModelName(vnf.getModelInfoGenericVnf().getModelName());
+ onapModelInformation.setModelVersion(vnf.getModelInfoGenericVnf().getModelVersion());
+ onapModelInformation.setModelUuid(vnf.getModelInfoGenericVnf().getModelUuid());
+ onapModelInformation.setModelCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ vnfInformation.setOnapModelInformation(onapModelInformation);
+ }
+ vnfInformation.setVnfId(vnf.getVnfId());
+ vnfInformation.setVnfType(vnf.getVnfType());
+ vnfInformation.setVnfName(vnf.getVnfName());
+ return vnfInformation;
+ }
+ /*
+ * Build GenericResourceApiVfModuleinformationVfModuleInformation
+ */
+ public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation){
+ GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation();
+ if (includeModelInformation) {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName());
+ onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion());
+ onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID());
+ onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ vfModuleInformation.setOnapModelInformation(onapModelInformation);
+ }
+ if (vfModule.getModelInfoVfModule() != null) {
+ vfModuleInformation.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
+ }
+ vfModuleInformation.setVfModuleId(vfModule.getVfModuleId());
+ return vfModuleInformation;
+ }
+ public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader();
+ sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
+ sdncRequestHeader.setSvcRequestId(sdncReqId);
+ return sdncRequestHeader;
+ }
+
+ /**
+ * Build ConfigurationInformation
+ * @param configuration
+ * @param includeModelInformation
+ * @return
+ */
+ public GenericResourceApiConfigurationinformationConfigurationInformation buildConfigurationInformation(Configuration configuration, boolean includeModelInformation) {
+ GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = new GenericResourceApiConfigurationinformationConfigurationInformation();
+ configurationInformation.setConfigurationId(configuration.getConfigurationId());
+ configurationInformation.setConfigurationName(configuration.getConfigurationName());
+ configurationInformation.setConfigurationType(configuration.getConfigurationType());
+ if(includeModelInformation) {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ onapModelInformation.setModelInvariantUuid(configuration.getModelInfoConfiguration().getModelInvariantId());
+ onapModelInformation.setModelUuid(configuration.getModelInfoConfiguration().getModelVersionId());
+ onapModelInformation.setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId());
+ configurationInformation.setOnapModelInformation(onapModelInformation);
+ }
+ return configurationInformation;
+ }
+
+
+ /**
+ * Build GcRequestInformation
+ * @param vnf
+ * @param genericResourceApiParam
+ * @return
+ */
+ public GenericResourceApiGcrequestinputGcRequestInput buildGcRequestInformation(GenericVnf vnf,GenericResourceApiParam genericResourceApiParam) {
+ GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = new GenericResourceApiGcrequestinputGcRequestInput();
+ gcRequestInput.setVnfId(vnf.getVnfId());
+ if(genericResourceApiParam != null) {
+ gcRequestInput.setInputParameters(genericResourceApiParam);
+ }
+ return gcRequestInput;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
new file mode 100644
index 0000000000..c55954093b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkinformationNetworkInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation;
+
+/**
+ * Mapper creating SDNC request
+ *
+ */
+@Component
+public class NetworkTopologyOperationRequestMapper {
+
+ static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper();
+
+ public GenericResourceApiNetworkOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, L3Network network, ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext, CloudRegion cloudRegion) {
+ GenericResourceApiNetworkOperationInformation req = new GenericResourceApiNetworkOperationInformation();
+ String sdncReqId = UUID.randomUUID().toString();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network);
+ GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion);
+
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setNetworkInformation(networkInformation);
+
+ if (requestContext.getUserParams() != null) {
+ for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(entry.getValue());
+ networkInputParameters.addParamItem(paramItem);
+ networkRequestInput.setNetworkInputParameters(networkInputParameters);
+ }
+ }
+
+ req.setNetworkRequestInput(networkRequestInput);
+ return req;
+ }
+ /*
+ * Private helper to build GenericResourceApiNetworkrequestinputNetworkRequestInput
+ */
+ private GenericResourceApiNetworkrequestinputNetworkRequestInput buildNetworkRequestInput(L3Network network, ServiceInstance serviceInstance, CloudRegion cloudRegion){
+ GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = new GenericResourceApiNetworkrequestinputNetworkRequestInput();
+ networkRequestInput.setTenant(cloudRegion.getTenantId());
+ networkRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
+ if (network.getNetworkName() != null && !network.getNetworkName().equals("")) {
+ networkRequestInput.setNetworkName(network.getNetworkName());
+ }
+ if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null){
+ //set only for network created as part of the collection/instance since 1806
+ networkRequestInput.setNetworkInstanceGroupId(serviceInstance.getCollection().getInstanceGroup().getId());
+ }
+ return networkRequestInput;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
new file mode 100644
index 0000000000..9e29c66029
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServicerequestinputServiceRequestInput;
+
+@Component
+public class ServiceTopologyOperationMapper{
+
+ static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper();
+
+ public GenericResourceApiServiceOperationInformation reqMapper (SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+
+ String sdncReqId = UUID.randomUUID().toString();
+ GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, resourceAction);
+ GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
+
+ servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceId());
+
+ servOpInput.setSdncRequestHeader(sdncRequestHeader);
+ servOpInput.setRequestInformation(reqInfo);
+ servOpInput.setServiceInformation(servInfo);
+ servOpInput.setServiceRequestInput(servReqInfo);
+
+ if(requestContext.getUserParams()!=null){
+ for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
+ serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceId());
+ GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(entry.getValue());
+ serviceInputParameters.addParamItem(paramItem );
+ serviceRequestInput.serviceInputParameters(serviceInputParameters);
+ servOpInput.setServiceRequestInput(serviceRequestInput );
+ }
+ }
+ return servOpInput;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
new file mode 100644
index 0000000000..30daca14f5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -0,0 +1,164 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleResponseInformation;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class VfModuleTopologyOperationRequestMapper {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleTopologyOperationRequestMapper.class);
+ static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper();
+
+ public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) {
+ GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
+
+ boolean includeModelInformation = false;
+
+ GenericResourceApiRequestActionEnumeration requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
+ GenericResourceApiSvcActionEnumeration genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN;
+
+ if (svcAction.equals(SDNCSvcAction.ACTIVATE)) {
+ genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ACTIVATE;
+ requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
+ includeModelInformation = true;
+ } else if (svcAction.equals(SDNCSvcAction.ASSIGN)) {
+ genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN;
+ requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
+ includeModelInformation = true;
+ } else if (svcAction.equals(SDNCSvcAction.DEACTIVATE)) {
+ genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DEACTIVATE;
+ requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
+ includeModelInformation = false;
+ } else if (svcAction.equals(SDNCSvcAction.DELETE)) {
+ genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DELETE;
+ requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
+ includeModelInformation = false;
+ } else if (svcAction.equals(SDNCSvcAction.UNASSIGN)) {
+ genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.UNASSIGN;
+ requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
+ includeModelInformation = false;
+ }
+
+ String sdncReqId = UUID.randomUUID().toString();
+
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId,
+ requestAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
+ GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
+ GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper.buildVfModuleInformation(vfModule, vnf, serviceInstance, includeModelInformation);
+ GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = buildVfModuleRequestInput(vfModule, volumeGroup, cloudRegion, requestContext);
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction);
+
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setVnfInformation(vnfInformation);
+ req.setVfModuleInformation(vfModuleInformation);
+ req.setVfModuleRequestInput(vfModuleRequestInput);
+
+ return req;
+ }
+
+ private GenericResourceApiVfmodulerequestinputVfModuleRequestInput buildVfModuleRequestInput(VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion, RequestContext requestContext) {
+ GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = new GenericResourceApiVfmodulerequestinputVfModuleRequestInput();
+ if (cloudRegion != null) {
+ vfModuleRequestInput.setTenant(cloudRegion.getTenantId());
+ vfModuleRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
+ }
+ if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) {
+ vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName());
+ }
+ GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam();
+
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(entry.getValue());
+ vfModuleInputParameters.addParamItem(paramItem);
+ }
+ }
+
+ if (volumeGroup != null) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName("volume-group-id");
+ paramItem.setValue(volumeGroup.getVolumeGroupId());
+ vfModuleInputParameters.addParamItem(paramItem);
+ }
+ vfModuleRequestInput.setVfModuleInputParameters(vfModuleInputParameters);
+
+ return vfModuleRequestInput;
+ }
+
+ private GenericResourceApiSdncrequestheaderSdncRequestHeader buildVfModuleSdncRequestHeader(String sdncReqId, GenericResourceApiSvcActionEnumeration svcAction) {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader();
+
+ sdncRequestHeader.setSvcRequestId(sdncReqId);
+ sdncRequestHeader.setSvcAction(svcAction);
+
+ return sdncRequestHeader;
+ }
+
+ public String buildObjectPath(String sdncAssignResponse) {
+ String objectPath = null;
+ if (sdncAssignResponse != null) {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ GenericResourceApiVfModuleResponseInformation assignResponseInfo = mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class);
+ objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath();
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, e.getMessage(), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ }
+ }
+ return objectPath;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
new file mode 100644
index 0000000000..f9a85abc36
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.springframework.stereotype.Component;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestinformationRequestInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfrequestinputVnfRequestInput;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds;
+
+@Component
+public class VnfTopologyOperationRequestMapper {
+
+ static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper();
+
+ public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction,
+ GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ String sdncReqId = UUID.randomUUID().toString();
+ GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper
+ .buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, requestAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper
+ .buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper
+ .buildVnfInformation(vnf, serviceInstance, true);
+ GenericResourceApiVnfrequestinputVnfRequestInput vnfRequestInput = new GenericResourceApiVnfrequestinputVnfRequestInput();
+
+ vnfRequestInput.setTenant(cloudRegion.getTenantId());
+ vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
+
+ if (StringUtils.isNotBlank(vnf.getVnfName())) {
+ vnfRequestInput.setVnfName(vnf.getVnfName());
+ }
+
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setVnfInformation(vnfInformation);
+
+ GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam();
+ if (requestContext.getUserParams() != null) {
+ for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(entry.getValue());
+ vnfInputParameters.addParamItem(paramItem);
+ vnfRequestInput.setVnfInputParameters(vnfInputParameters);
+ }
+ }
+ if (vnf.getCloudParams() != null) {
+ for (Map.Entry<String, String> entry : vnf.getCloudParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(entry.getValue());
+ vnfInputParameters.addParamItem(paramItem);
+ }
+ }
+ if (homing) {
+ License license = vnf.getLicense();
+ if (license != null) {
+ if(license.getEntitlementPoolUuids() != null && !license.getEntitlementPoolUuids().isEmpty()) {
+ String entitlementPoolUuid = license.getEntitlementPoolUuids().get(0);
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName("entitlement_assignment_group_uuid");
+ paramItem.setValue(entitlementPoolUuid);
+ vnfInputParameters.addParamItem(paramItem);
+ }
+ if (license.getLicenseKeyGroupUuids() != null && !license.getLicenseKeyGroupUuids().isEmpty()) {
+ String licenseKeyGroupUuid = license.getLicenseKeyGroupUuids().get(0);
+ GenericResourceApiParamParam paramItem2 = new GenericResourceApiParamParam();
+ paramItem2.setName("license_assignment_group_uuid");
+ paramItem2.setValue(licenseKeyGroupUuid);
+ vnfInputParameters.addParamItem(paramItem2);
+ }
+ }
+ }
+ List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
+ List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>();
+
+ for (InstanceGroup instanceGroup : instanceGroups) {
+ if (ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP
+ .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds();
+ instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId());
+ networkInstanceGroupIdList.add(instanceGroupId);
+ }
+ }
+
+ vnfRequestInput.setVnfNetworkInstanceGroupIds(networkInstanceGroupIdList);
+ vnfRequestInput.setVnfInputParameters(vnfInputParameters);
+ req.setVnfRequestInput(vnfRequestInput);
+ return req;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
new file mode 100644
index 0000000000..979b9e5e80
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro;
+
+import java.util.LinkedHashMap;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.sdnc.BaseClient;
+import org.onap.so.client.sniro.beans.ManagerProperties;
+import org.onap.so.client.sniro.beans.SniroConductorRequest;
+import org.onap.so.client.sniro.beans.SniroManagerRequest;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+
+@Component
+public class SniroClient {
+
+ private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroClient.class);
+
+ @Autowired
+ private ManagerProperties managerProperties;
+
+ @Autowired
+ private SniroValidator validator;
+
+
+ /**
+ * Makes a rest call to sniro manager to perform homing and licensing for a
+ * list of demands
+ *
+ * @param homingRequest
+ * @return
+ * @throws JsonProcessingException
+ * @throws BpmnError
+ */
+ public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException, JsonProcessingException{
+ log.trace("Started Sniro Client Post Demands");
+ String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
+ log.debug("Post demands url: " + url);
+ log.debug("Post demands payload: " + homingRequest.toJsonString());
+
+ HttpHeaders header = new HttpHeaders();
+ header.setContentType(MediaType.APPLICATION_JSON);
+ header.set("Authorization", managerProperties.getHeaders().get("auth"));
+ header.set("X-patchVersion", managerProperties.getHeaders().get("patchVersion"));
+ header.set("X-minorVersion", managerProperties.getHeaders().get("minorVersion"));
+ header.set("X-latestVersion", managerProperties.getHeaders().get("latestVersion"));
+ BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString());
+ validator.validateDemandsResponse(response);
+ log.trace("Completed Sniro Client Post Demands");
+ }
+
+ /**
+ * Makes a rest call to sniro conductor to notify them of successful or unsuccessful vnf
+ * creation for previously homed resources
+ *
+ * TODO Temporarily being used in groovy therefore can not utilize autowire. Once java "release"
+ * subflow is developed it will be refactored to use autowire.
+ *
+ * @param releaseRequest
+ * @return
+ * @throws BadResponseException
+ */
+ public void postRelease(SniroConductorRequest releaseRequest) throws BadResponseException {
+ log.trace("Started Sniro Client Post Release");
+ String url = UrnPropertiesReader.getVariable("sniro.conductor.host") + UrnPropertiesReader.getVariable("sniro.conductor.uri");
+ log.debug("Post release url: " + url);
+ log.debug("Post release payload: " + releaseRequest.toJsonString());
+
+ HttpHeaders header = new HttpHeaders();
+ header.setContentType(MediaType.APPLICATION_JSON);
+ header.set("Authorization", UrnPropertiesReader.getVariable("sniro.conductor.headers.auth"));
+ BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<?, ?> response = baseClient.post(releaseRequest.toJsonString());
+ SniroValidator v = new SniroValidator();
+ v.validateReleaseResponse(response);
+ log.trace("Completed Sniro Client Post Release");
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
new file mode 100644
index 0000000000..bad45c87f2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro;
+
+
+import static org.apache.commons.lang.StringUtils.*;
+
+import java.util.LinkedHashMap;
+
+import org.json.JSONObject;
+import org.onap.so.client.exception.BadResponseException;
+
+import org.onap.so.logger.MsoLogger;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class SniroValidator {
+
+ private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroValidator.class);
+
+ /**
+ * Validates the synchronous homing response from sniro manager
+ *
+ * @throws BadResponseException
+ */
+ public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
+ log.debug("Validating Sniro Managers synchronous response");
+ if(!response.isEmpty()){
+ JSONObject jsonResponse = new JSONObject(response);
+ if(jsonResponse.has("requestStatus")){
+ String status = jsonResponse.getString("requestStatus");
+ if(status.equals("accepted")){
+ log.debug("Sniro Managers synchronous response indicates accepted");
+ }else{
+ String message = jsonResponse.getString("statusMessage");
+ if(isNotBlank(message)){
+ log.debug("Sniro Managers response indicates failed: " + message);
+ }else{
+ log.debug("Sniro Managers response indicates failed: no status message provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message);
+ }
+ }else{
+ log.debug("Sniro Managers synchronous response does not contain: request status");
+ throw new BadResponseException("Sniro Managers synchronous response does not contain: request status");
+ }
+ }else{
+ log.debug("Sniro Managers synchronous response is empty");
+ throw new BadResponseException("Sniro Managers synchronous response i is empty");
+ }
+ }
+
+ /**
+ * Validates the asynchronous/callback response from sniro manager which
+ * contains the homing and licensing solutions
+ *
+ * @throws BadResponseException
+ */
+ public static void validateSolution(String response) throws BadResponseException{
+ log.debug("Validating Sniro Managers asynchronous callback response");
+ if(isNotBlank(response)) {
+ JSONObject jsonResponse = new JSONObject(response);
+ if(!jsonResponse.has("serviceException")){
+ log.debug("Sniro Managers asynchronous response is valid");
+ }else{
+ String message = jsonResponse.getJSONObject("serviceException").getString("text");
+ if(isNotBlank(message)){
+ log.debug("Sniro Managers response contains a service exception: " + message);
+ }else{
+ log.debug("Sniro Managers response contains a service exception: no service exception text provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException("Sniro Managers asynchronous response contains a service exception: " + message);
+ }
+ }else{
+ log.debug("Sniro Managers asynchronous response is empty");
+ throw new BadResponseException("Sniro Managers asynchronous response is empty");
+ }
+ }
+
+
+ /**
+ * Validates the release response from sniro conductor
+ *
+ * @throws BadResponseException
+ */
+ public void validateReleaseResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
+ log.debug("Validating Sniro Conductors response");
+ if(!response.isEmpty()){
+ String status = (String) response.get("status");
+ if(isNotBlank(status)){
+ if(status.equals("success")){
+ log.debug("Sniro Conductors synchronous response indicates success");
+ }else{
+ String message = (String) response.get("message");
+ if(isNotBlank(message)){
+ log.debug("Sniro Conductors response indicates failed: " + message);
+ }else{
+ log.debug("Sniro Conductors response indicates failed: error message not provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException("Sniro Conductors synchronous response indicates failed: " + message);
+ }
+ }else{
+ log.debug("Sniro Managers Conductors response does not contain: status");
+ throw new BadResponseException("Sniro Conductors synchronous response does not contain: status");
+ }
+ }else{
+ log.debug("Sniro Conductors response is empty");
+ throw new BadResponseException("Sniro Conductors response is empty");
+ }
+
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
new file mode 100644
index 0000000000..6e60bfa293
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro.beans;
+
+import java.util.Map;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix = "sniro.conductor")
+public class ConductorProperties {
+
+ private String host;
+ private String uri;
+
+ private Map<String, String> headers;
+
+
+ public String getHost() {
+ return host;
+ }
+ public void setHost(String host) {
+ this.host = host;
+ }
+ public String getUri() {
+ return uri;
+ }
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
+
+
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
new file mode 100644
index 0000000000..0070f2fe04
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro.beans;
+
+import java.util.Map;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix = "sniro.manager")
+public class ManagerProperties {
+
+ private String host;
+ private Map<String, String> uri;
+ private Map<String, String> headers;
+
+
+ public String getHost() {
+ return host;
+ }
+ public void setHost(String host) {
+ this.host = host;
+ }
+ public Map<String, String> getUri() {
+ return uri;
+ }
+ public void setUri(Map<String, String> uri) {
+ this.uri = uri;
+ }
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
new file mode 100644
index 0000000000..0d7e44224e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+
+@JsonRootName("requestInfo")
+public class RequestInfo implements Serializable{
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("transactionId")
+ String transactionId;
+ @JsonProperty("requestId")
+ String requestId;
+
+ public String getTransactionId(){
+ return transactionId;
+ }
+
+ public void setTransactionId(String transactionId){
+ this.transactionId = transactionId;
+ }
+
+ public String getRequestId(){
+ return requestId;
+ }
+
+ public void setRequestId(String requestId){
+ this.requestId = requestId;
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java
new file mode 100644
index 0000000000..8441a01072
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Resource implements Serializable{
+
+ private static final long serialVersionUID = 5949861520571440421L;
+
+ @JsonProperty("service-resource-id")
+ private String serviceResourceId;
+ @JsonProperty("status")
+ private String status;
+
+
+ public String getServiceResourceId(){
+ return serviceResourceId;
+ }
+
+ public void setServiceResourceId(String serviceResourceId){
+ this.serviceResourceId = serviceResourceId;
+ }
+
+ public String getStatus(){
+ return status;
+ }
+
+ public void setStatus(String status){
+ this.status = status;
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
new file mode 100644
index 0000000000..bc8e27ce86
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.so.logger.MsoLogger;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+
+public class SniroConductorRequest implements Serializable{
+
+ private static final long serialVersionUID = 1906052095861777655L;
+ private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroConductorRequest.class);
+
+ @JsonProperty("release-locks")
+ private List<Resource> resources = new ArrayList<Resource>();
+
+
+ public List<Resource> getResources(){
+ return resources;
+ }
+
+ @JsonInclude(Include.NON_NULL)
+ public String toJsonString(){
+ String json = "";
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
+ try{
+ json = ow.writeValueAsString(this);
+ }catch (Exception e){
+ log.error("Unable to convert SniroConductorRequest to string", e);
+ }
+ return json;
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
new file mode 100644
index 0000000000..19b752ffd1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+import org.onap.so.logger.MsoLogger;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRawValue;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+
+public class SniroManagerRequest implements Serializable{
+
+ private static final long serialVersionUID = -1541132882892163132L;
+ private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroManagerRequest.class);
+
+ @JsonRawValue
+ @JsonProperty("requestInfo")
+ private String requestInformation;
+ @JsonRawValue
+ @JsonProperty("serviceInfo")
+ private String serviceInformation;
+ @JsonRawValue
+ @JsonProperty("placementInfo")
+ private String placementInformation;
+ @JsonRawValue
+ @JsonProperty("licenseInfo")
+ private String licenseInformation;
+
+
+ public String getRequestInformation() {
+ return requestInformation;
+ }
+ public void setRequestInformation(String requestInformation) {
+ this.requestInformation = requestInformation;
+ }
+ public String getServiceInformation() {
+ return serviceInformation;
+ }
+ public void setServiceInformation(String serviceInformation) {
+ this.serviceInformation = serviceInformation;
+ }
+ public String getPlacementInformation() {
+ return placementInformation;
+ }
+ public void setPlacementInformation(String placementInformation) {
+ this.placementInformation = placementInformation;
+ }
+ public String getLicenseInformation() {
+ return licenseInformation;
+ }
+ public void setLicenseInformation(String licenseInformation) {
+ this.licenseInformation = licenseInformation;
+ }
+
+
+ @JsonInclude(Include.NON_NULL)
+ public String toJsonString(){
+ String json = "";
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
+ try{
+ json = ow.writeValueAsString(this);
+ }catch (Exception e){
+ log.error("Unable to convert SniroManagerRequest to string", e);
+ }
+ return json.replaceAll("\\\\", "");
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java
new file mode 100644
index 0000000000..e527b587b7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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;
+
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.buildingblock.SniroHomingV2;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.client.orchestration.SDNOHealthCheckResources;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@ContextConfiguration
+public abstract class BaseTest extends TestDataSetup {
+
+ @SpyBean
+ protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources;
+
+ @MockBean
+ protected SniroHomingV2 sniroHoming;
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..a29df9cbcf
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test"})
+public class EmbeddedMariaDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ MariaDB4jSpringService service = new MariaDB4jSpringService();
+
+
+ service.getConfiguration().addArg("--lower_case_table_names=1");
+ return service;
+ }
+
+ @Bean
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ //Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder
+ .create()
+ .username(datasourceUsername)
+ .password(datasourcePassword)
+ .url(config.getURL(databaseName))
+ .driverClassName(datasourceDriver)
+ .build();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java
new file mode 100644
index 0000000000..e35fe0db9f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ *
+ * File utility class.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Sep 15, 2017
+ */
+public class FileUtil {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class);
+
+ /**
+ * Read the specified resource file and return the contents as a String.
+ *
+ * @param fileName Name of the resource file
+ * @return the contents of the resource file as a String
+ * @throws IOException if there is a problem reading the file
+ */
+ public static String readResourceFile(String fileName) {
+ InputStream stream;
+ try {
+ stream = getResourceAsStream(fileName);
+ byte[] bytes;
+ bytes = new byte[stream.available()];
+ if(stream.read(bytes) > 0) {
+ stream.close();
+ return new String(bytes);
+ } else {
+ stream.close();
+ return "";
+ }
+ } catch (IOException e) {
+ LOGGER.debug("Exception:", e);
+ return "";
+ }
+ }
+
+ /**
+ * Get an InputStream for the resource specified.
+ *
+ * @param resourceName Name of resource for which to get InputStream.
+ * @return an InputStream for the resource specified.
+ * @throws IOException If we can't get the InputStream for whatever reason.
+ */
+ private static InputStream getResourceAsStream(String resourceName) throws IOException {
+ InputStream stream =
+ FileUtil.class.getClassLoader().getResourceAsStream(resourceName);
+ if (stream == null) {
+ throw new IOException("Can't access resource '" + resourceName + "'");
+ }
+ return stream;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
new file mode 100644
index 0000000000..6401d5516d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
@@ -0,0 +1,54 @@
+package org.onap.so;
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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=========================================================
+ */
+
+
+
+import java.io.IOException;
+
+import javax.annotation.PreDestroy;
+
+import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
+import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Profile;
+
+@SpringBootApplication
+@Profile("test")
+@EnableProcessApplication("MSO CommonBPMN Test Application")
+@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
+ @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
+ @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+public class TestApplication {
+ public static void main(String... args) {
+ SpringApplication.run(TestApplication.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("server.name", "Springboot");
+
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
new file mode 100644
index 0000000000..501e64f4d4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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;
+
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.onap.so.TestApplication;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.onap.so.client.orchestration.AAIVpnBindingResources;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
+import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
+import org.onap.so.client.orchestration.SDNCVfModuleResources;
+import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
+import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public abstract class BaseTaskTest extends TestDataSetup {
+ @MockBean
+ protected AAIVolumeGroupResources aaiVolumeGroupResources;
+
+ @MockBean
+ protected AAIServiceInstanceResources aaiServiceInstanceResources;
+
+ @MockBean
+ protected AAIVnfResources aaiVnfResources;
+
+ @MockBean
+ protected AAIVfModuleResources aaiVfModuleResources;
+
+ @MockBean
+ protected AAIVpnBindingResources aaiVpnBindingResources;
+
+ @MockBean
+ protected AAINetworkResources aaiNetworkResources;
+
+ @MockBean
+ protected AAICollectionResources aaiCollectionResources;
+
+ @MockBean
+ protected NetworkAdapterResources networkAdapterResources;
+
+ @MockBean
+ protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
+
+ @MockBean
+ protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+
+ @MockBean
+ protected SDNCVnfResources sdncVnfResources;
+
+ @MockBean
+ protected SDNCNetworkResources sdncNetworkResources;
+
+ @MockBean
+ protected SDNCVfModuleResources sdncVfModuleResources;
+
+ @MockBean
+ protected SDNCServiceInstanceResources sdncServiceInstanceResources;
+
+ @MockBean
+ protected AssignNetworkBBUtils assignNetworkBBUtils;
+
+ @MockBean
+ protected NetworkAdapterObjectMapper networkAdapterObjectMapper;
+
+ @MockBean
+ protected AAIInstanceGroupResources aaiInstanceGroupResources;
+
+ @MockBean
+ protected CatalogDbClient catalogDbClient;
+
+ @Mock
+ protected BBInputSetupUtils bbSetupUtils;
+
+ @Mock
+ protected BBInputSetup bbInputSetup;
+
+ @SpyBean
+ protected SDNCClient SPY_sdncClient;
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
new file mode 100644
index 0000000000..946c5dfe80
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.common.aai.tasks;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIFlagTasksTest extends TestDataSetup {
+
+ @InjectMocks
+ private AAIFlagTasks aaiFlagTasks = new AAIFlagTasks();
+
+ @Mock
+ private AAIVnfResources aaiVnfResources;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Mock
+ private ExceptionBuilder exceptionUtil;
+
+ private GenericVnf genericVnf;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf);
+ }
+
+ @Test
+ public void checkVnfInMaintTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF is in maintenance in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class));
+ doReturn(true).when(aaiVnfResources).checkInMaintFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfInMaintFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF is in maintenance in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfInMaintTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class));
+ aaiFlagTasks.checkVnfInMaintFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfInMaintFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(Exception.class).when(aaiVnfResources).checkInMaintFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfInMaintFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+
+ }
+
+ @Test
+ public void modifyVnfInMaintFlagTest() throws Exception {
+ doNothing().when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class));
+ aaiFlagTasks.modifyVnfInMaintFlag(execution, true);
+ verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
+ }
+
+ @Test
+ public void modifyVnfInMaintFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class));
+ try {
+ aaiFlagTasks.modifyVnfInMaintFlag(execution, true);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
new file mode 100644
index 0000000000..a20b68b147
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
@@ -0,0 +1,665 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.common.data;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.assertj.core.util.Arrays;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.ExpectedException;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+public class TestDataSetup{
+ private int collectionCounter;
+ private int configurationCounter;
+ private int customerCounter;
+ private int genericVnfCounter;
+ private int instanceGroupCounter;
+ private int l3NetworkCounter;
+ private int owningEntityCounter;
+ private int pnfCounter;
+ private int projectCounter;
+ private int serviceInstanceCounter;
+ private int serviceProxyCounter;
+ private int serviceSubscriptionCounter;
+ private int vfModuleCounter;
+ private int volumeGroupCounter;
+ private int vpnBindingCounter;
+ private int vpnBondingLinkCounter;
+
+ protected BuildingBlockExecution execution;
+
+ protected GeneralBuildingBlock gBBInput;
+
+ protected HashMap<ResourceKey, String> lookupKeyMap;
+
+ protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ protected DelegateExecution delegateExecution;
+
+ @Before
+ public void buildingBlockTestDataSetupBefore() {
+ collectionCounter = 0;
+ configurationCounter = 0;
+ customerCounter = 0;
+ genericVnfCounter = 0;
+ instanceGroupCounter = 0;
+ l3NetworkCounter = 0;
+ owningEntityCounter = 0;
+ pnfCounter = 0;
+ projectCounter = 0;
+ serviceInstanceCounter = 0;
+ serviceProxyCounter = 0;
+ serviceSubscriptionCounter = 0;
+ vfModuleCounter = 0;
+ volumeGroupCounter = 0;
+ vpnBindingCounter = 0;
+ vpnBondingLinkCounter = 0;
+
+ execution = new DelegateExecutionImpl(new ExecutionImpl());
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+
+ gBBInput = new GeneralBuildingBlock();
+ execution.setVariable("gBBInput", gBBInput);
+
+ lookupKeyMap = new HashMap<ResourceKey, String>();
+ execution.setVariable("lookupKeyMap", lookupKeyMap);
+
+ ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class);
+ doReturn("test").when(mockExecutionImpl).getProcessInstanceId();
+
+ ExecutionImpl executionImpl = new ExecutionImpl();
+ executionImpl.setProcessInstance(mockExecutionImpl);
+
+ delegateExecution = (DelegateExecution) executionImpl;
+ delegateExecution.setVariable("testProcessKey", "testProcessKeyValue");
+ }
+
+ public Map<String, String> buildUserInput() {
+ Map<String, String> userInput = new HashMap<>();
+ userInput.put("testUserInputKey", "testUserInputValue");
+
+ return userInput;
+ }
+
+ public Map<String, String> setUserInput() {
+ Map<String, String> userInput = buildUserInput();
+
+ gBBInput.setUserInput(userInput);
+
+ return userInput;
+ }
+
+ public RequestContext buildRequestContext() {
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId(UUID.randomUUID().toString());
+ requestContext.setProductFamilyId("testProductFamilyId");
+ requestContext.setRequestorId("testRequestorId");
+
+ requestContext.setUserParams(new HashMap<>());
+
+ Map<String,Object> dataMap = new HashMap<>();
+ dataMap.put("vpnId","testVpnId");
+ dataMap.put("vpnRegion","testVpnRegion");
+ dataMap.put("vpnRt","testVpnRt");
+ dataMap.put("vpnName","vpnName");
+ dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"}));
+
+ HashMap<String,Object> userParams = new HashMap<>();
+ userParams.put("vpnData",dataMap);
+
+ List<Map<String,Object>> userParamsList = new ArrayList<>();
+ userParamsList.add(userParams);
+
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(userParamsList);
+ requestContext.setRequestParameters(requestParameters);
+
+ return requestContext;
+ }
+
+ public RequestContext setRequestContext() {
+ RequestContext requestContext = buildRequestContext();
+
+ gBBInput.setRequestContext(requestContext);
+
+ return requestContext;
+ }
+
+ public CloudRegion buildCloudRegion() {
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
+ cloudRegion.setTenantId("testTenantId");
+ cloudRegion.setCloudOwner("testCloudOwner");
+
+ return cloudRegion;
+ }
+
+ public CloudRegion setCloudRegion() {
+ CloudRegion cloudRegion = buildCloudRegion();
+
+ gBBInput.setCloudRegion(cloudRegion);
+
+ return cloudRegion;
+ }
+
+ public OrchestrationContext buildOrchestrationContext() {
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+
+ return orchestrationContext;
+ }
+
+ public OrchestrationContext setOrchestrationContext() {
+ OrchestrationContext orchestrationContext = buildOrchestrationContext();
+
+ gBBInput.setOrchContext(orchestrationContext);
+
+ return orchestrationContext;
+ }
+
+ public Collection buildCollection() {
+ collectionCounter++;
+
+ Collection collection = new Collection();
+ collection.setId("testId" + collectionCounter);
+ collection.setInstanceGroup(buildInstanceGroup());
+
+ return collection;
+ }
+
+ public Configuration buildConfiguration() {
+ configurationCounter++;
+
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("testConfigurationId" + configurationCounter);
+ configuration.setConfigurationName("testConfigurationName" + configurationCounter);
+
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter);
+ modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter);
+ modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
+
+ configuration.setModelInfoConfiguration(modelInfoConfiguration);
+
+ return configuration;
+ }
+
+ public OwningEntity buildOwningEntity() {
+ owningEntityCounter++;
+
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
+ owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
+
+ return owningEntity;
+ }
+
+ public Project buildProject() {
+ projectCounter++;
+
+ Project project = new Project();
+ project.setProjectName("testProjectName" + projectCounter);
+
+ return project;
+ }
+
+ public ServiceSubscription buildServiceSubscription() {
+ serviceSubscriptionCounter++;
+
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
+ serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
+
+ return serviceSubscription;
+ }
+
+ public Customer buildCustomer() {
+ customerCounter++;
+
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
+ customer.setSubscriberType("testSubscriberType" + customerCounter);
+
+ customer.setServiceSubscription(buildServiceSubscription());
+
+ return customer;
+ }
+
+ public ServiceInstance buildServiceInstance() {
+ serviceInstanceCounter++;
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter);
+ serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter);
+
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter);
+ modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter);
+ modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter);
+ modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter);
+ modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ serviceInstance.setProject(buildProject());
+
+ serviceInstance.setOwningEntity(buildOwningEntity());
+
+ serviceInstance.setCollection(buildCollection());
+
+ serviceInstance.getConfigurations().add(buildConfiguration());
+
+ return serviceInstance;
+ }
+
+ public ServiceInstance setServiceInstance() {
+ ServiceInstance serviceInstance = buildServiceInstance();
+
+ if(gBBInput.getCustomer() == null) {
+ gBBInput.setCustomer(buildCustomer());
+ }
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance);
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
+
+ return serviceInstance;
+ }
+
+ public Customer setCustomer() {
+ if(gBBInput.getCustomer() != null) return gBBInput.getCustomer();
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("testGlobalCustomerId");
+ customer.setSubscriberType("testSubscriberType");
+
+ customer.setServiceSubscription(buildServiceSubscription());
+
+ gBBInput.setCustomer(customer);
+
+ return customer;
+ }
+
+ public Collection setCollection() {
+ Collection collection = new Collection();
+ collection.setId("testId");
+
+ ServiceInstance serviceInstance = null;
+
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+
+ serviceInstance.setCollection(collection);
+
+ return collection;
+ }
+
+ public InstanceGroup setInstanceGroup() {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId");
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
+
+ Collection collection = null;
+
+ try {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ collection = serviceInstance.getCollection();
+
+ if (collection == null) {
+ collection = setCollection();
+ }
+ } catch(BBObjectNotFoundException e) {
+ collection = setCollection();
+ }
+
+ collection.setInstanceGroup(instanceGroup);
+
+ return instanceGroup;
+ }
+
+ public VpnBinding buildVpnBinding() {
+ vpnBindingCounter++;
+
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
+ vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
+ vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
+
+ return vpnBinding;
+ }
+
+ public VpnBinding setVpnBinding() {
+ VpnBinding vpnBinding = buildVpnBinding();
+
+ Customer customer = gBBInput.getCustomer();
+
+ if(customer == null){
+ customer = buildCustomer();
+ }
+
+ customer.getVpnBindings().add(vpnBinding);
+ lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
+
+ return vpnBinding;
+ }
+
+ public InstanceGroup buildInstanceGroup() {
+ instanceGroupCounter++;
+
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("testId" + instanceGroupCounter);
+ instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
+
+ return instanceGroup;
+ }
+
+ public L3Network buildL3Network() {
+ l3NetworkCounter++;
+
+ L3Network network = new L3Network();
+ network.setNetworkId("testNetworkId" + l3NetworkCounter);
+ network.setNetworkName("testNetworkName" + l3NetworkCounter);
+ network.setNetworkType("testNetworkType" + l3NetworkCounter);
+
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter);
+ modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter);
+ modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter);
+ modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter);
+ network.setModelInfoNetwork(modelInfoNetwork);
+
+ return network;
+ }
+
+ public L3Network setL3Network() {
+ L3Network network = buildL3Network();
+
+ ServiceInstance serviceInstance = null;
+
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+
+ serviceInstance.getNetworks().add(network);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
+
+ return network;
+ }
+
+ public GenericVnf buildGenericVnf() {
+ genericVnfCounter++;
+
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("testVnfId" + genericVnfCounter);
+ genericVnf.setVnfName("testVnfName" + genericVnfCounter);
+ genericVnf.setVnfType("testVnfType" + genericVnfCounter);
+
+ Platform platform = new Platform();
+ platform.setPlatformName("testPlatformName");
+ genericVnf.setPlatform(platform);
+
+ LineOfBusiness lob = new LineOfBusiness();
+ lob.setLineOfBusinessName("testLineOfBusinessName");
+ genericVnf.setLineOfBusiness(lob);
+
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter);
+ modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter);
+ modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter);
+ modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter);
+ modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter);
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ return genericVnf;
+ }
+
+ public GenericVnf setGenericVnf() {
+ GenericVnf genericVnf = buildGenericVnf();
+
+ ServiceInstance serviceInstance = null;
+
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+
+ serviceInstance.getVnfs().add(genericVnf);
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
+
+ return genericVnf;
+ }
+
+ public VfModule buildVfModule() {
+ vfModuleCounter++;
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
+ vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
+
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter);
+ modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter);
+ modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter);
+ modelInfoVfModule.setModelName("testModelName" + vfModuleCounter);
+ modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter);
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ return vfModule;
+ }
+
+ public VfModule setVfModule() {
+ VfModule vfModule = buildVfModule();
+
+ GenericVnf genericVnf = null;
+
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ } catch(BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
+
+ genericVnf.getVfModules().add(vfModule);
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
+
+ return vfModule;
+ }
+
+ public VolumeGroup buildVolumeGroup() {
+ volumeGroupCounter++;
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
+ volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
+ volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
+
+ return volumeGroup;
+ }
+
+ public VolumeGroup setVolumeGroup() {
+ VolumeGroup volumeGroup = buildVolumeGroup();
+
+ GenericVnf genericVnf = null;
+
+ try {
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ } catch(BBObjectNotFoundException e) {
+ genericVnf = setGenericVnf();
+ }
+
+ genericVnf.getVolumeGroups().add(volumeGroup);
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+
+ return volumeGroup;
+ }
+
+ public Pnf buildPnf() {
+ pnfCounter++;
+
+ Pnf pnf = new Pnf();
+ pnf.setPnfId("testPnfId" + pnfCounter);
+ pnf.setPnfName("testPnfName" + pnfCounter);
+
+ return pnf;
+ }
+
+ public ServiceProxy buildServiceProxy() {
+ serviceProxyCounter++;
+
+ ServiceProxy serviceProxy = new ServiceProxy();
+ serviceProxy.setServiceInstance(buildServiceInstance());
+ serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf());
+
+ Pnf primaryPnf = buildPnf();
+ primaryPnf.setRole("Primary");
+ serviceProxy.getServiceInstance().getPnfs().add(primaryPnf);
+
+ Pnf secondaryPnf = buildPnf();
+ secondaryPnf.setRole("Secondary");
+ serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf);
+
+ return serviceProxy;
+ }
+
+ public VpnBondingLink buildVpnBondingLink() {
+ vpnBondingLinkCounter++;
+
+ VpnBondingLink vpnBondingLink = new VpnBondingLink();
+ vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
+
+ Configuration vnrConfiguration = buildConfiguration();
+ vnrConfiguration.setNetwork(buildL3Network());
+ vpnBondingLink.setVnrConfiguration(vnrConfiguration);
+
+ vpnBondingLink.setVrfConfiguration(buildConfiguration());
+
+ vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy());
+
+ vpnBondingLink.setTransportServiceProxy(buildServiceProxy());
+
+ return vpnBondingLink;
+ }
+
+ public VpnBondingLink setVpnBondingLink() {
+ VpnBondingLink vpnBondingLink = buildVpnBondingLink();
+
+ ServiceInstance serviceInstance = null;
+
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+
+ serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
+ lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
+
+
+ return vpnBondingLink;
+ }
+
+ public Customer setAvpnCustomer() {
+ Customer customer = buildCustomer();
+
+ gBBInput.setCustomer(customer);
+
+ return customer;
+ }
+
+ public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
+ ServiceProxy serviceProxy = new ServiceProxy();
+ serviceProxy.setId("testProxyId" + uniqueIdentifier);
+ serviceProxy.setType(type);
+
+ ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
+ modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
+ modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
+ modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
+ modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
+
+ serviceProxy.setModelInfoServiceProxy(modelInfo);
+
+ return serviceProxy;
+ }
+
+ public AllottedResource setAllottedResource(String uniqueIdentifier) {
+ AllottedResource ar = new AllottedResource();
+ ar.setId("testAllottedResourceId" + uniqueIdentifier);
+
+ ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource();
+ modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
+ modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
+ modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
+ modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
+
+ ar.setModelInfoAllottedResource(modelInfo);
+
+ return ar;
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
new file mode 100644
index 0000000000..51a7f1ab04
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -0,0 +1,387 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AAICreateTasksTest extends BaseTaskTest{
+ @Autowired
+ private AAICreateTasks aaiCreateTasks;
+
+ private ServiceInstance serviceInstance;
+ private L3Network network;
+ private GenericVnf genericVnf;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private VfModule vfModule;
+ private Customer customer;
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ genericVnf = setGenericVnf();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ vfModule = setVfModule();
+
+ }
+
+ @Test
+ public void createServiceInstanceTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer);
+ aaiCreateTasks.createServiceInstance(execution);
+ verify(aaiServiceInstanceResources, times(1)).createServiceInstance(serviceInstance, customer);
+ }
+
+ @Test
+ public void createServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound");
+ doThrow(Exception.class).when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer);
+ aaiCreateTasks.createServiceInstance(execution);
+ }
+
+ @Test
+ public void createVolumeGroupTest() throws Exception {
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ doNothing().when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion);
+ doNothing().when(aaiVolumeGroupResources).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
+
+ aaiCreateTasks.createVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).createVolumeGroup(volumeGroup, cloudRegion);
+ verify(aaiVolumeGroupResources, times(1)).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
+ verify(aaiVolumeGroupResources, times(1)).connectVolumeGroupToTenant(volumeGroup, cloudRegion);
+ }
+
+ @Test
+ public void createVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ doThrow(Exception.class).when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiCreateTasks.createVolumeGroup(execution);
+ }
+
+ @Test
+ public void createProjectTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ aaiCreateTasks.createProject(execution);
+ verify(aaiServiceInstanceResources, times(1)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ }
+
+ @Test
+ public void createPlatformTest() throws Exception {
+ doNothing().when(aaiVnfResources).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf);
+ aaiCreateTasks.createPlatform(execution);
+ verify(aaiVnfResources, times(1)).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf);
+ }
+
+ @Test
+ public void createLineOfBusinessTest() throws Exception {
+ doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf);
+ aaiCreateTasks.createLineOfBusiness(execution);
+ verify(aaiVnfResources, times(1)).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf);
+ }
+
+ @Test
+ public void createProjectExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound");
+ doThrow(Exception.class).when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ aaiCreateTasks.createProject(execution);
+ }
+
+ @Test
+ public void createProjectNullProjectNameTest() throws Exception {
+ serviceInstance.getProject().setProjectName(null);
+ doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ aaiCreateTasks.createProject(execution);
+ verify(aaiServiceInstanceResources, times(0)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ }
+
+ @Test
+ public void createProjectEmptyProjectNameTest() throws Exception {
+ serviceInstance.getProject().setProjectName("");
+ doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ aaiCreateTasks.createProject(execution);
+ verify(aaiServiceInstanceResources, times(0)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
+ }
+
+ @Test
+ public void createOwningEntityTest() throws Exception {
+ doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
+ doNothing().when(aaiServiceInstanceResources).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(),serviceInstance);
+ aaiCreateTasks.createOwningEntity(execution);
+ verify(aaiServiceInstanceResources, times(1)).existsOwningEntity(serviceInstance.getOwningEntity());
+ verify(aaiServiceInstanceResources, times(1)).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance);
+ }
+
+ @Test
+ public void createOwningEntityNotExistsOwningEntityTest() throws Exception {
+ doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
+ doNothing().when(aaiServiceInstanceResources).createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(),serviceInstance);
+ aaiCreateTasks.createOwningEntity(execution);
+ verify(aaiServiceInstanceResources, times(1)).existsOwningEntity(serviceInstance.getOwningEntity());
+ verify(aaiServiceInstanceResources, times(1)).createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(), serviceInstance);
+ }
+
+ @Test
+ public void createOwningEntityNullOwningEntityIdTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ serviceInstance.getOwningEntity().setOwningEntityId(null);
+
+ aaiCreateTasks.createOwningEntity(execution);
+ }
+
+ @Test
+ public void createOwningEntityEmptyOwningEntityIdTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ serviceInstance.getOwningEntity().setOwningEntityId("");
+
+ aaiCreateTasks.createOwningEntity(execution);
+ }
+
+ @Test
+ public void createOwningEntityNullOwningEntityNameTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ serviceInstance.getOwningEntity().setOwningEntityName(null);
+
+ doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
+
+ aaiCreateTasks.createOwningEntity(execution);
+ }
+
+ @Test
+ public void createOwningEntityEmptyOwningEntityNameTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ serviceInstance.getOwningEntity().setOwningEntityName("");
+
+ doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
+
+ aaiCreateTasks.createOwningEntity(execution);
+ }
+
+ @Test
+ public void createOwningEntityExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
+
+ doThrow(Exception.class).when(aaiServiceInstanceResources).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance);
+
+ aaiCreateTasks.createOwningEntity(execution);
+ }
+
+ @Test
+ public void createVnfTest() throws Exception {
+ doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ aaiCreateTasks.createVnf(execution);
+ verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ }
+
+ @Test
+ public void createVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound");
+ doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ aaiCreateTasks.createVnf(execution);
+ verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ }
+
+
+ @Test
+ public void createVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).createVfModule(vfModule, genericVnf);
+ aaiCreateTasks.createVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).createVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void createServiceSubscriptionTest(){
+ doNothing().when(aaiServiceInstanceResources).createServiceSubscription(customer);
+ aaiCreateTasks.createServiceSubscription(execution);
+ verify(aaiServiceInstanceResources, times(1)).createServiceSubscription(customer);
+ }
+
+ @Test
+ public void createServiceSubscriptionTestExceptionHandling(){
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiServiceInstanceResources).createServiceSubscription(customer);
+ aaiCreateTasks.createServiceSubscription(execution);
+ }
+
+ @Test
+ public void createServiceSubscriptionTestCustomerIsNull(){
+ expectedException.expect(BpmnError.class);
+ gBBInput.setCustomer(null);
+ aaiCreateTasks.createServiceSubscription(execution);
+ }
+
+ @Test
+ public void createVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiVfModuleResources).createVfModule(vfModule, genericVnf);
+ aaiCreateTasks.createVfModule(execution);
+ }
+
+ @Test
+ public void connectVfModuleToVolumeGroupTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup, cloudRegion);
+ aaiCreateTasks.connectVfModuleToVolumeGroup(execution);
+ verify(aaiVfModuleResources, times(1)).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup, cloudRegion);
+ }
+
+ @Test
+ public void createNetworkTest() throws Exception {
+ network.getModelInfoNetwork().setNeutronNetworkType("PROVIDER");
+
+ doNothing().when(aaiNetworkResources).createNetworkConnectToServiceInstance(network,serviceInstance);
+ aaiCreateTasks.createNetwork(execution);
+ verify(aaiNetworkResources, times(1)).createNetworkConnectToServiceInstance(network, serviceInstance);
+ }
+
+ @Test
+ public void createNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, "notfound");
+ doThrow(Exception.class).when(aaiNetworkResources).createNetworkConnectToServiceInstance(network,serviceInstance);
+ aaiCreateTasks.createNetwork(execution);
+ }
+
+ @Test
+ public void createCustomerTest() throws Exception {
+ doNothing().when(aaiVpnBindingResources).createCustomer(customer);
+
+ aaiCreateTasks.createCustomer(execution);
+
+ verify(aaiVpnBindingResources, times(1)).createCustomer(customer);
+ }
+
+ @Test
+ public void createCustomerExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiVpnBindingResources).createCustomer(customer);
+
+ aaiCreateTasks.createCustomer(execution);
+ }
+
+ @Test
+ public void createNetworkCollectionTest() throws Exception {
+ doNothing().when(aaiNetworkResources).createNetworkCollection(serviceInstance.getCollection());
+ execution.setVariable("networkCollectionName", "testNetworkCollectionName");
+ aaiCreateTasks.createNetworkCollection(execution);
+ verify(aaiNetworkResources, times(1)).createNetworkCollection(serviceInstance.getCollection());
+ }
+
+ @Test
+ public void createNetworkCollectionInstanceGroupTest() throws Exception {
+ doNothing().when(aaiNetworkResources).createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ aaiCreateTasks.createNetworkCollectionInstanceGroup(execution);
+ verify(aaiNetworkResources, times(1)).createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ }
+
+ @Test
+ public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception {
+ doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance);
+ aaiCreateTasks.connectNetworkToNetworkCollectionServiceInstance(execution);
+ verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance);
+ }
+
+ @Test
+ public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception {
+ doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup());
+ aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution);
+ verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup());
+ }
+
+ @Test
+ public void connectNetworkToNullNetworkCollectionInstanceGroupTest() throws Exception {
+ //reset test data to have no network collection instance group
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("testServiceInstanceId");
+ L3Network network = new L3Network();
+ network.setNetworkId("testNetworkId");
+ serviceInstance.getNetworks().add(network);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
+ gBBInput.setServiceInstance(serviceInstance);
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
+ //verify connection call was not executednetwork
+ exception.expect(BpmnError.class);
+ aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution);
+ verify(aaiNetworkResources, never()).connectNetworkToNetworkCollectionInstanceGroup(network, null);
+ }
+
+ @Test
+ public void connectNetworkToCloudRegionTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiNetworkResources).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion());
+ aaiCreateTasks.connectNetworkToCloudRegion(execution);
+ verify(aaiNetworkResources, times(1)).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion());
+ }
+
+ @Test
+ public void connectNetworkToTenantTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiNetworkResources).connectNetworkToTenant(network, gBBInput.getCloudRegion());
+ aaiCreateTasks.connectNetworkToTenant(execution);
+ verify(aaiNetworkResources, times(1)).connectNetworkToTenant(network, gBBInput.getCloudRegion());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
new file mode 100644
index 0000000000..6ad263a935
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -0,0 +1,427 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.aai.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AAIUpdateTasksTest extends BaseTaskTest{
+ @Autowired
+ private AAIUpdateTasks aaiUpdateTasks;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private VfModule vfModule;
+ private GenericVnf genericVnf;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ network = setL3Network();
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedServiceTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution);
+
+ verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActiveServiceTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveService(execution);
+
+ verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveService(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedVnfTest() throws Exception {
+ doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActiveVnfTest() throws Exception {
+ doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+ assertEquals("", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception {
+ doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
+ aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception {
+ doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
+
+ aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
+ }
+
+ @Test
+ public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception {
+ doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception {
+ doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception {
+ doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
+ aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception {
+ doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
+
+ aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
+ aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution);
+ }
+
+ @Test
+ public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception {
+ doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
+ assertEquals("", volumeGroup.getHeatStackId());
+ }
+
+ @Test
+ public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
+ }
+ @Test
+ public void updateOstatusAssignedNetworkTest() throws Exception {
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedNetwork(execution);
+
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ assertEquals("", network.getHeatStackId());
+ }
+
+ @Test
+ public void updateOstatusAssignedNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedNetwork(execution);
+ }
+
+ @Test
+ public void updateOstatusActivedNetworkTest() throws Exception {
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution);
+
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ }
+
+ @Test
+ public void updateOstatusCreatedNetworkTest() throws Exception {
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution);
+
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ }
+
+ @Test
+ public void updateOstatusActiveNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution);
+ }
+
+ @Test
+ public void updateOstatusActivedNetworkCollectionTest() throws Exception {
+ doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection());
+ aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution);
+ verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection());
+ }
+
+ @Test
+ public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection());
+ aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActivateVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE);
+ }
+
+ @Test
+ public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception {
+ doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution);
+ }
+
+ @Test
+ public void updateNetworkCreatedTest() throws Exception {
+ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
+ createNetworkResponse.setNetworkFqdn("testNetworkFqdn");
+ createNetworkResponse.setNetworkStackId("testNetworkStackId");
+
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+ aaiUpdateTasks.updateNetworkCreated(execution);
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+
+ assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn());
+ assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus());
+ assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId());
+ assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId());
+ }
+
+ @Test
+ public void updateNetworkCreatedkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
+ aaiUpdateTasks.updateNetworkCreated(execution);
+ }
+
+ @Test
+ public void updateObjectNetworkTest() {
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateObjectNetwork(execution);
+
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ }
+
+ @Test
+ public void updateObjectNetworkExceptionText() {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network);
+
+ aaiUpdateTasks.updateObjectNetwork(execution);
+ }
+
+ @Test
+ public void test_updateServiceInstance() {
+ doNothing().when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance);
+ aaiUpdateTasks.updateServiceInstance(execution);
+ verify(aaiServiceInstanceResources, times(1)).updateServiceInstance(serviceInstance);
+ }
+
+ @Test
+ public void test_updateServiceInstance_exception() {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance);
+ aaiUpdateTasks.updateServiceInstance(execution);
+ }
+
+ @Test
+ public void updateObjectVnfTest() {
+ doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
+
+ aaiUpdateTasks.updateObjectVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
+ }
+
+ @Test
+ public void updateObjectVnfExceptionTest() {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(genericVnf);
+ aaiUpdateTasks.updateObjectVnf(execution);
+ }
+
+ @Test
+ public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeleteVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+ assertEquals("", vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void updateModelVfModuleTest() {
+ doNothing().when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
+ aaiUpdateTasks.updateModelVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void updateModelVfModuleExceptionTest() {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
+ aaiUpdateTasks.updateModelVfModule(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java
new file mode 100644
index 0000000000..64760c03a0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.network.tasks;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Map;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class NetworkAdapterCreateTasksTest extends BaseTaskTest{
+ @Autowired
+ private NetworkAdapterCreateTasks networkAdapterCreateTasks;
+
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private L3Network l3Network;
+ private Map<String, String> userInput;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ l3Network = setL3Network();
+ userInput = setUserInput();
+ userInput.put("userInputKey1", "userInputValue1");
+ requestContext = setRequestContext();
+ cloudRegion = setCloudRegion();
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+ }
+
+ @Test
+ public void createNetworkTest() throws Exception {
+ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
+ createNetworkResponse.setNetworkStackId("networkStackId");
+ createNetworkResponse.setNetworkCreated(true);
+ Optional<CreateNetworkResponse> oCreateNetworkResponse = Optional.of(createNetworkResponse);
+
+ String cloudRegionPo = "cloudRegionPo";
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
+
+ doReturn(oCreateNetworkResponse).when(networkAdapterResources).createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo,customer);
+ networkAdapterCreateTasks.createNetwork(execution);
+ verify(networkAdapterResources, times(1)).createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo,customer);
+ }
+
+ @Test
+ public void rollbackCreateNetworkTest() throws Exception {
+ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
+ createNetworkResponse.setNetworkStackId("networkStackId");
+ createNetworkResponse.setNetworkCreated(true);
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+ Optional<CreateNetworkResponse> oCreateNetworkResponse = Optional.of(createNetworkResponse);
+
+ String cloudRegionPo = "cloudRegionPo";
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
+
+ doReturn(oCreateNetworkResponse).when(networkAdapterResources).rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
+ networkAdapterCreateTasks.rollbackCreateNetwork(execution);
+ verify(networkAdapterResources, times(1)).rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java
new file mode 100644
index 0000000000..88b654fd45
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.network.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Optional;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.client.adapter.network.NetworkAdapterClientException;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class NetworkAdapterDeleteTasksTest extends BaseTaskTest{
+ @Autowired
+ private NetworkAdapterDeleteTasks networkAdapterDeleteTasks;
+
+ private ServiceInstance serviceInstance;
+ private L3Network l3Network;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private String cloudRegionPo;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ l3Network = setL3Network();
+ requestContext = setRequestContext();
+ cloudRegion = setCloudRegion();
+ }
+
+ @Test
+ public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ DeleteNetworkResponse deleteNetworkResponse = new DeleteNetworkResponse();
+ deleteNetworkResponse.setNetworkDeleted(true);
+ deleteNetworkResponse.setNetworkId(l3Network.getNetworkId());
+ Optional<DeleteNetworkResponse> oDeleteNetworkResponse = Optional.of(deleteNetworkResponse);
+ doReturn(oDeleteNetworkResponse).when(networkAdapterResources).deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network);
+
+ networkAdapterDeleteTasks.deleteNetwork(execution);
+
+ verify(networkAdapterResources, times(1)).deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network);
+ assertEquals(deleteNetworkResponse, execution.getVariable("deleteNetworkResponse"));
+ }
+
+ @Test
+ public void test_deleteNetwork_exception() {
+ expectedException.expect(BpmnError.class);
+
+ networkAdapterDeleteTasks.deleteNetwork(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
new file mode 100644
index 0000000000..6489c9b149
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.adapter.network.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Map;
+import java.util.Optional;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{
+ @Autowired
+ private NetworkAdapterUpdateTasks networkAdapterUpdateTasks;
+
+ private ServiceInstance serviceInstance;
+ private L3Network network;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private Map<String, String> userInput;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ requestContext = setRequestContext();
+ cloudRegion = setCloudRegion();
+ orchestrationContext = setOrchestrationContext();
+ userInput = setUserInput();
+ userInput.put("userInputKey1", "userInputValue1");
+
+ }
+
+ @Test
+ public void updateNetworkTest() throws Exception {
+ UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
+ updateNetworkResponse.setMessageId("messageId");
+ updateNetworkResponse.setNetworkId("networkId");
+ Optional<UpdateNetworkResponse> oUpdateNetworkResponse = Optional.of(updateNetworkResponse);
+
+ doReturn(oUpdateNetworkResponse).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
+
+ networkAdapterUpdateTasks.updateNetwork(execution);
+
+ verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
+ assertEquals(updateNetworkResponse, execution.getVariable("NetworkAdapterUpdateNetworkResponse"));
+ }
+
+ @Test
+ public void updateNetworkNoResponseTest() throws Exception {
+ doReturn(Optional.empty()).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
+
+ networkAdapterUpdateTasks.updateNetwork(execution);
+
+ verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
+ assertNull(execution.getVariable("NetworkAdapterUpdateNetworkResponse"));
+ }
+
+ @Test
+ public void updateNetworkExceptionTest() {
+ expectedException.expect(BpmnError.class);
+
+ networkAdapterUpdateTasks.updateNetwork(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java
new file mode 100644
index 0000000000..f54e3faf1d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.vnf.tasks;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+public class VnfAdapterCreateTasksTest extends BaseTaskTest{
+ @Autowired
+ private VnfAdapterCreateTasks vnfAdapterCreateTasks;
+
+ @Test
+ public void test_createVolumeGroupRequest() throws Exception {
+ RequestContext requestContext = setRequestContext();
+
+ ServiceInstance serviceInstance = setServiceInstance();
+
+ GenericVnf genericVnf = setGenericVnf();
+
+ VfModule vfModule = setVfModule();
+ vfModule.setSelflink("vfModuleSelfLink");
+ VolumeGroup volumeGroup = setVolumeGroup();
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ CloudRegion cloudRegion = setCloudRegion();
+
+ OrchestrationContext orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ String sdncVnfQueryResponse = "SDNCVnfQueryResponse";
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVnfQueryResponse);
+
+ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
+ request.setVolumeGroupId("volumeGroupStackId");
+
+ doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
+
+ vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
+
+ verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
+
+ assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
+ }
+
+ @Test
+ public void test_createVolumeGroupRequest_for_alaCarte_flow() throws Exception {
+ RequestContext requestContext = setRequestContext();
+ ServiceInstance serviceInstance = setServiceInstance();
+ GenericVnf genericVnf = setGenericVnf();
+ VolumeGroup volumeGroup = setVolumeGroup();
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ CloudRegion cloudRegion = setCloudRegion();
+
+ OrchestrationContext orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
+ request.setVolumeGroupId("volumeGroupStackId");
+
+ doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
+
+ vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
+
+ verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
+
+ assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
+ }
+
+ @Test
+ public void test_createVolumeGroupRequest_exception() throws Exception {
+ // run with no data setup, and it will throw a BBObjectNotFoundException
+ expectedException.expect(BpmnError.class);
+
+ vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
+ }
+
+ @Test
+ public void test_createVfModule() throws Exception {
+ RequestContext requestContext = setRequestContext();
+
+ ServiceInstance serviceInstance = setServiceInstance();
+
+ GenericVnf genericVnf = setGenericVnf();
+
+ VfModule vfModule = setVfModule();
+
+ CloudRegion cloudRegion = setCloudRegion();
+
+ OrchestrationContext orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ CreateVfModuleRequest modRequest = new CreateVfModuleRequest();
+ modRequest.setVfModuleId(vfModule.getVfModuleId());
+ modRequest.setBaseVfModuleStackId("baseVfModuleStackId");
+ modRequest.setVfModuleName(vfModule.getVfModuleName());
+ CreateVfModuleRequest createVfModuleRequest = modRequest;
+
+ String sdncVfModuleQueryResponse = "{someJson}";
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse);
+
+ String sdncVnfQueryResponse = "{someJson}";
+ execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse);
+
+ doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ vnfAdapterCreateTasks.createVfModule(execution);
+
+ verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString());
+ }
+
+ @Test
+ public void createVfModuleExceptionTest() throws Exception {
+ // run with no data setup, and it will throw a BBObjectNotFoundException
+ expectedException.expect(BpmnError.class);
+ vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
new file mode 100644
index 0000000000..4ea11c235b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.adapter.vnf.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class VnfAdapterDeleteTasksTest extends BaseTaskTest{
+ @Autowired
+ private VnfAdapterDeleteTasks vnfAdapterDeleteTasks;
+
+ private VolumeGroup volumeGroup;
+ private VfModule vfModule;
+ private GenericVnf genericVnf;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private ServiceInstance serviceInstance;
+ private OrchestrationContext orchestrationContext;
+
+ @Before
+ public void before() throws Exception {
+ requestContext = setRequestContext();
+
+ serviceInstance = setServiceInstance();
+
+ cloudRegion = setCloudRegion();
+
+ genericVnf = setGenericVnf();
+
+ vfModule = setVfModule();
+
+ volumeGroup = setVolumeGroup();
+
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+ }
+
+ @Test
+ public void test_deleteVfModule() throws Exception {
+ DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest();
+ deleteVfModuleRequest.setVfModuleId("vfModuleId");
+
+ doReturn(deleteVfModuleRequest).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
+
+ vnfAdapterDeleteTasks.deleteVfModule(execution);
+
+ verify(vnfAdapterVfModuleResources, times(1)).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
+ assertEquals(execution.getVariable("VNFREST_Request"), deleteVfModuleRequest.toXmlString());
+ }
+
+ @Test
+ public void deleteVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
+
+ vnfAdapterDeleteTasks.deleteVfModule(execution);
+ }
+
+ @Test
+ public void test_deleteVolumeGroup() throws Exception {
+ DeleteVolumeGroupResponse deleteVolumeGroupResponse = new DeleteVolumeGroupResponse();
+
+ doReturn(deleteVolumeGroupResponse).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+
+ vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
+
+ verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ }
+
+ @Test
+ public void deleteVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+
+ vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
new file mode 100644
index 0000000000..24a99c97f4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.adapter.vnf.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.FileUtil;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class VnfAdapterImplTest extends BaseTaskTest {
+ @Autowired
+ private VnfAdapterImpl vnfAdapterImpl;
+
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private VfModule vfModule;
+ private VolumeGroup volumeGroup;
+
+ private static final String VNF_ADAPTER_REST_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestDeleteResponse.xml");
+ private static final String VNF_ADAPTER_REST_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml");
+ private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml");
+ private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn";
+ private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1";
+
+ @Before
+ public void before() {
+ requestContext = setRequestContext();
+ serviceInstance = setServiceInstance();
+ vfModule = setVfModule();
+ volumeGroup = setVolumeGroup();
+ vfModule.setHeatStackId(null);
+ }
+
+ @Test
+ public void preProcessVnfAdapterTest() {
+ vnfAdapterImpl.preProcessVnfAdapter(execution);
+
+ assertEquals("true", execution.getVariable("isDebugLogEnabled"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("mso-request-id"));
+ assertEquals(serviceInstance.getServiceInstanceId(), execution.getVariable("mso-service-instance-id"));
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest() {
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
+ }
+
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() {
+ execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() {
+ execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest() {
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_ResponseNullTest() {
+ execution.setVariable("vnfAdapterRestV1Response", null);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_ResponseEmptyTest() {
+ execution.setVariable("vnfAdapterRestV1Response", "");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
+ execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
+ execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ }
+
+ @Test
+ public void preProcessVnfAdapterExceptionTest() {
+ expectedException.expect(BpmnError.class);
+ lookupKeyMap.clear();
+ vnfAdapterImpl.preProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateVolumeResponseTest() {
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapterExceptionTest() {
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ expectedException.expect(BpmnError.class);
+ lookupKeyMap.clear();
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java
new file mode 100644
index 0000000000..dff953802e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+
+public class AssignNetworkBBUtilsTest extends BaseTaskTest {
+ //Necessary because AssignNetworkBBUtils is already mocked using MockBean in the base class for use in other tests
+ private AssignNetworkBBUtils nonMockAssignNetworkBBUtils = new AssignNetworkBBUtils();
+
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void before() {
+ cloudRegion = setCloudRegion();
+ }
+
+ @Test
+ public void getCloudRegionTest25() throws Exception {
+ cloudRegion.setCloudRegionVersion("2.5");
+
+ nonMockAssignNetworkBBUtils.getCloudRegion(execution);
+
+ assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionPo"));
+ assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc"));
+ }
+
+ @Test
+ public void getCloudRegionTest30() throws Exception {
+ cloudRegion.setCloudRegionVersion("3.0");
+
+ nonMockAssignNetworkBBUtils.getCloudRegion(execution);
+
+ assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionPo"));
+ assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc"));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
new file mode 100644
index 0000000000..a206140014
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AssignNetworkTest extends BaseTaskTest {
+
+ @Autowired
+ private AssignNetwork assignNetwork;
+
+ private ServiceInstance serviceInstance;
+ private L3Network network;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ }
+
+ @Test
+ public void hasCollectionTest() throws Exception {
+ setServiceInstance();
+ //collection present by default base test setup
+ boolean hasCollection = assignNetwork.hasCollection(execution);
+ assertEquals(true, hasCollection);
+
+ boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
+ assertEquals(false, skip);
+ }
+
+ @Test
+ public void hasNoCollectionTest() throws Exception {
+ //clear collection
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ serviceInstance.setCollection(null);
+ boolean hasCollection = assignNetwork.hasCollection(execution);
+ assertEquals(false, hasCollection);
+
+ boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
+ assertEquals(true, skip);
+ }
+
+ @Test
+ public void hasNoCollectionNoNetworkTest() throws Exception {
+ //clear collection and updated network status to PRECREATED - when it was NOT found by name
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ serviceInstance.setCollection(null);
+ network.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ boolean hasCollection = assignNetwork.hasCollection(execution);
+ boolean networkFound = assignNetwork.networkFoundByName(execution);
+ assertEquals(false, hasCollection);
+ assertEquals(false, networkFound);
+
+ boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
+ assertEquals(true, skip);
+ }
+
+ @Test
+ public void hasNetworkNoCollectionTest() throws Exception {
+ //clear collection and updated network status to INVENTORIED - when it was found by name
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ serviceInstance.setCollection(null);
+ network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ boolean hasCollection = assignNetwork.hasCollection(execution);
+ boolean networkFound = assignNetwork.networkFoundByName(execution);
+ assertEquals(false, hasCollection);
+ assertEquals(true, networkFound);
+
+ boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
+ assertEquals(true, skip);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java
new file mode 100644
index 0000000000..e1b652a140
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.List;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AssignVnfTest extends BaseTaskTest {
+ @Autowired
+ private AssignVnf assignVnf;
+
+ private InstanceGroup instanceGroup1;
+ private InstanceGroup instanceGroup2;
+ private InstanceGroup instanceGroup3;
+ private InstanceGroup instanceGroup4;
+ private GenericVnf genericVnf;
+
+ @Before
+ public void before() {
+ ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
+ modelVnfc.setType("VNFC");
+ modelVnfc.setFunction("function");
+
+ ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup();
+ modelNetworkInstanceGroup.setType("networkInstanceGroup");
+ modelNetworkInstanceGroup.setFunction("function");
+
+ instanceGroup1 = new InstanceGroup();
+ instanceGroup1.setId("test-001");
+ instanceGroup1.setModelInfoInstanceGroup(modelVnfc);
+
+ instanceGroup2 = new InstanceGroup();
+ instanceGroup2.setId("test-002");
+ instanceGroup2.setModelInfoInstanceGroup(modelVnfc);
+
+ instanceGroup3 = new InstanceGroup();
+ instanceGroup3.setId("test-003");
+ instanceGroup3.setModelInfoInstanceGroup(modelNetworkInstanceGroup);
+
+ instanceGroup4 = new InstanceGroup();
+ instanceGroup4.setId("test-004");
+ instanceGroup4.setModelInfoInstanceGroup(modelNetworkInstanceGroup);
+
+ genericVnf = setGenericVnf();
+ genericVnf.setVnfName("vnfName");
+ }
+
+ @Test
+ public void createInstanceGroupsSunnyDayTest() throws Exception {
+
+ List<InstanceGroup> instanceGroupList = genericVnf.getInstanceGroups();
+ instanceGroupList.add(instanceGroup1);
+ instanceGroupList.add(instanceGroup2);
+ instanceGroupList.add(instanceGroup3);
+ instanceGroupList.add(instanceGroup4);
+
+ assignVnf.createInstanceGroups(execution);
+ verify(aaiInstanceGroupResources, times(1)).createInstanceGroup(instanceGroup1);
+ verify(aaiInstanceGroupResources, times(1)).createInstanceGroup(instanceGroup2);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup1, genericVnf);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup2, genericVnf);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup3, genericVnf);
+ verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup4, genericVnf);
+ }
+
+ @Test
+ public void createVnfcInstanceGroupNoneTest() throws Exception {
+ assignVnf.createInstanceGroups(execution);
+ verify(aaiInstanceGroupResources, times(0)).createInstanceGroup(any(InstanceGroup.class));
+ verify(aaiInstanceGroupResources, times(0)).connectInstanceGroupToVnf(any(InstanceGroup.class), any(GenericVnf.class));
+ }
+
+ @Test
+ public void createVnfcInstanceGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ genericVnf.setVnfId("test-999");
+ assignVnf.createInstanceGroups(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
new file mode 100644
index 0000000000..cde7797ed0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+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.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class CreateNetworkCollectionTest extends BaseTaskTest{
+ @Autowired
+ private CreateNetworkCollection createNetworkCollection;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private OrchestrationContext orchestrationContext;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+
+ List<L3Network> l3NetworkList = new ArrayList<L3Network>();
+ l3NetworkList.add(network);
+ ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
+ modelInfoInstanceGroup.setFunction("function");
+ serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup);
+
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+ }
+
+ @Test
+ public void buildCreateNetworkRequestTest() throws Exception {
+ createNetworkCollection.buildNetworkCollectionName(execution);
+
+ assertEquals(serviceInstance.getServiceInstanceName() + "_" + serviceInstance.getCollection().getInstanceGroup().getModelInfoInstanceGroup().getFunction(), execution.getVariable("networkCollectionName"));
+ }
+
+ @Test(expected = BpmnError.class)
+ public void buildCreateNetworkRequestInstanceGroupModelInfoFunctionNullExceptionTest() throws Exception {
+ ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
+ serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup);
+ createNetworkCollection.buildNetworkCollectionName(execution);
+ }
+
+ @Test(expected = BpmnError.class)
+ public void buildCreateNetworkRequestInstanceGroupModelInfoNullTest() throws Exception {
+ serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(null);
+ createNetworkCollection.buildNetworkCollectionName(execution);
+ }
+
+ @Test
+ public void connectCollectionToInstanceGroupTest() throws Exception {
+ doNothing().when(aaiNetworkResources).connectNetworkCollectionInstanceGroupToNetworkCollection(serviceInstance.getCollection().getInstanceGroup(), serviceInstance.getCollection());
+ createNetworkCollection.connectCollectionToInstanceGroup(execution);
+ verify(aaiNetworkResources, times(1)).connectNetworkCollectionInstanceGroupToNetworkCollection(serviceInstance.getCollection().getInstanceGroup(), serviceInstance.getCollection());
+ }
+
+ @Test
+ public void connectCollectionToServiceInstanceTest() throws Exception {
+ doNothing().when(aaiNetworkResources).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance);
+ createNetworkCollection.connectCollectionToServiceInstance(execution);
+ verify(aaiNetworkResources, times(1)).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java
new file mode 100644
index 0000000000..f23df3312f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.flowspecific.tasks;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class CreateNetworkTest extends BaseTaskTest{
+ @Autowired
+ private CreateNetwork createNetwork;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private Map<String, String> userInput;
+ private RequestContext requestContext;
+ private String cloudRegionPo = "testCloudRegionPo";
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ cloudRegion = setCloudRegion();
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+ requestContext = setRequestContext();
+ userInput = setUserInput();
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+ }
+
+ @Test
+ public void buildCreateNetworkRequestTest() throws Exception {
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
+
+ CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest();
+
+ doReturn(expectedCreateNetworkRequest).when(networkAdapterObjectMapper).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, cloudRegionPo, customer);
+
+ createNetwork.buildCreateNetworkRequest(execution);
+
+ verify(networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, cloudRegionPo, customer);
+
+ assertThat(expectedCreateNetworkRequest, sameBeanAs(execution.getVariable("createNetworkRequest")));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java
new file mode 100644
index 0000000000..4966a8b42d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class NetworkBBUtilsTest extends BaseTaskTest{
+ @Autowired
+ private NetworkBBUtils networkBBUtils;
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/";
+
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void before() {
+ cloudRegion = setCloudRegion();
+ }
+
+ @Test
+ public void isRelationshipRelatedToExistsTrueTest() throws Exception {
+ final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ Optional<L3Network> l3network = aaiResultWrapper.asBean(L3Network.class);
+
+ boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module");
+ assertTrue(isVfModule);
+
+ }
+
+ @Test
+ public void isRelationshipRelatedToExistsFalseTest() throws Exception {
+ final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAAIResponse.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ Optional<L3Network> l3network = aaiResultWrapper.asBean(L3Network.class);
+
+ boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module");
+ assertFalse(isVfModule);
+
+ }
+
+ @Test
+ public void getCloudRegionSDNC25Test() throws Exception {
+ cloudRegion.setCloudRegionVersion("2.5");
+
+ NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class);
+ String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.SDNC);
+ Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.SDNC);
+
+ assertEquals("AAIAIC25", cloudRegionId);
+ }
+
+ @Test
+ public void getCloudRegionSDNC30Test() throws Exception {
+ cloudRegion.setCloudRegionVersion("3.0");
+
+ NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class);
+ String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.SDNC);
+ Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.SDNC);
+
+ assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionId);
+ }
+
+ @Test
+ public void getCloudRegionPO25Test() throws Exception {
+ cloudRegion.setCloudRegionVersion("2.5");
+
+ NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class);
+ String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.PO);
+ Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.PO);
+
+ assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionId);
+ }
+
+ @Test
+ public void getCloudRegionPO30Test() throws Exception {
+ cloudRegion.setCloudRegionVersion("3.0");
+
+ NetworkBBUtils spyAssignPO = Mockito.spy(NetworkBBUtils.class);
+ String cloudRegionIdPO = spyAssignPO.getCloudRegion(execution, SourceSystem.PO);
+ Mockito.verify(spyAssignPO).getCloudRegion(execution, SourceSystem.PO);
+
+ assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionIdPO);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
new file mode 100644
index 0000000000..6a117902ea
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class UnassignNetworkBBTest extends BaseTaskTest {
+ @Autowired
+ private UnassignNetworkBB unassignNetworkBB;
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/";
+
+ @Test
+ public void checkRelationshipRelatedToTrueTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper);
+
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
+ }
+
+ @Test
+ public void checkRelationshipRelatedToFalseTest() throws Exception {
+ final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper);
+
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "kfc-module");
+ //expected result is no exception
+ }
+
+ @Test
+ public void getCloudSdncRegion25Test() throws Exception {
+ CloudRegion cloudRegion = setCloudRegion();
+ cloudRegion.setCloudRegionVersion("2.5");
+ unassignNetworkBB.getCloudSdncRegion(execution);
+ assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc"));
+ }
+
+ @Test
+ public void getCloudSdncRegion30Test() throws Exception {
+ CloudRegion cloudRegion = setCloudRegion();
+ cloudRegion.setCloudRegionVersion("3.0");
+ gBBInput.setCloudRegion(cloudRegion);
+ unassignNetworkBB.getCloudSdncRegion(execution);
+ assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc"));
+ }
+
+ @Test
+ public void errorEncounteredTest_rollback() throws Exception {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first.");
+ execution.setVariable("isRollbackNeeded", true);
+ unassignNetworkBB.errorEncountered(execution);
+ }
+
+ @Test
+ public void errorEncounteredTest_noRollback() throws Exception {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first.");
+ unassignNetworkBB.errorEncountered(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java
new file mode 100644
index 0000000000..98c1f185fe
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.flowspecific.tasks;
+
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class UnassignVnfTest extends BaseTaskTest{
+ @Autowired
+ private UnassignVnf unassignVnf;
+
+ @Test
+ public void deleteInstanceGroupsSunnyDayTest() throws Exception {
+ GenericVnf genericVnf = setGenericVnf();
+
+ ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
+ modelVnfc.setType("VNFC");
+
+ InstanceGroup instanceGroup1 = new InstanceGroup();
+ instanceGroup1.setId("test-001");
+ instanceGroup1.setModelInfoInstanceGroup(modelVnfc);
+ genericVnf.getInstanceGroups().add(instanceGroup1);
+
+ InstanceGroup instanceGroup2 = new InstanceGroup();
+ instanceGroup2.setId("test-002");
+ instanceGroup2.setModelInfoInstanceGroup(modelVnfc);
+ genericVnf.getInstanceGroups().add(instanceGroup2);
+
+ unassignVnf.deleteInstanceGroups(execution);
+ verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup1));
+ verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup2));
+ }
+
+ @Test
+ public void deletecreateVnfcInstanceGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ unassignVnf.deleteInstanceGroups(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
new file mode 100644
index 0000000000..d3b421eedb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class SDNCActivateTaskTest extends BaseTaskTest{
+ @Autowired
+ private SDNCActivateTasks sdncActivateTasks;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+ customer = setCustomer();
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+
+ }
+
+ @Test
+ public void activateVnfTest() throws Exception {
+ doReturn("success").when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer, cloudRegion,requestContext);
+ sdncActivateTasks.activateVnf(execution);
+ verify(sdncVnfResources, times(1)).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext);
+ }
+
+ @Test
+ public void activateVnfTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext);
+ sdncActivateTasks.activateVnf(execution);
+ }
+
+ @Test
+ public void activateNetworkTest() throws Exception {
+ doReturn("response").when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class));
+ sdncActivateTasks.activateNetwork(execution);
+ verify(sdncNetworkResources, times(1)).activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ }
+
+ @Test
+ public void activateNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class));
+ sdncActivateTasks.activateNetwork(execution);
+ }
+
+ @Test
+ public void activateVfModuleTest() throws Exception {
+ doReturn("success").when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncActivateTasks.activateVfModule(execution);
+
+ verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ }
+
+ @Test
+ public void activateVfModuleTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncActivateTasks.activateVfModule(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
new file mode 100644
index 0000000000..6a40db3eaa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class SDNCAssignTasksTest extends BaseTaskTest{
+ @Autowired
+ private SDNCAssignTasks sdncAssignTasks;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private VolumeGroup volumeGroup;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ network = setL3Network();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ volumeGroup = setVolumeGroup();
+
+ }
+
+ @Test
+ public void assignServiceInstanceTest() throws Exception {
+ doReturn("response").when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext);
+
+ sdncAssignTasks.assignServiceInstance(execution);
+
+ verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext);
+ assertTrue(execution.getVariable("SDNCResponse").equals("response"));
+ }
+
+ @Test
+ public void assignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext);
+
+ sdncAssignTasks.assignServiceInstance(execution);
+ }
+
+ @Test
+ public void assignVnfTest() throws Exception {
+ doReturn("response").when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+
+ sdncAssignTasks.assignVnf(execution);
+
+ verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false);
+ assertTrue(execution.getVariable("SDNCResponse").equals("response"));
+ }
+
+ @Test
+ public void assignVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+
+ sdncAssignTasks.assignVnf(execution);
+ }
+
+ @Test
+ public void assignVfModuleTest() throws Exception {
+ doReturn("response").when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncAssignTasks.assignVfModule(execution);
+
+ verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ assertTrue(execution.getVariable("SDNCAssignResponse_" + vfModule.getVfModuleId()).equals("response"));
+ }
+
+ @Test
+ public void assignVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncAssignTasks.assignVfModule(execution);
+ }
+
+ @Test
+ public void assignNetworkTest() throws Exception {
+ doReturn("response").when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ sdncAssignTasks.assignNetwork(execution);
+
+ verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ }
+
+ @Test
+ public void assignNetworkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ sdncAssignTasks.assignNetwork(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
new file mode 100644
index 0000000000..fc2d182b52
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class SDNCChangeAssignTasksTest extends BaseTaskTest{
+ @Autowired
+ private SDNCChangeAssignTasks sdncChangeAssignTasks;
+
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+ private VfModule vfModule;
+ private GenericVnf genericVnf;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+
+ }
+
+ @Test
+ public void changeModelVnfTest() throws Exception {
+ String response = "sdncChangeModelServiceInstance";
+
+ doReturn(response).when(sdncServiceInstanceResources).changeModelServiceInstance(serviceInstance, customer, requestContext);
+
+ sdncChangeAssignTasks.changeModelServiceInstance(execution);
+
+ verify(sdncServiceInstanceResources, times(1)).changeModelServiceInstance(serviceInstance, customer, requestContext);
+
+ assertEquals(response, execution.getVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response"));
+ }
+
+ @Test
+ public void changeModelVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncChangeAssignTasks.changeModelVnf(execution);
+ }
+
+ @Test
+ public void changeAssignModelVfModuleTest() throws Exception {
+ String response = "response";
+ doReturn(response).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncChangeAssignTasks.changeAssignModelVfModule(execution);
+
+ verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ assertTrue(execution.getVariable("SDNCChangeAssignVfModuleResponse").equals(response));
+ }
+
+ @Test
+ public void changeAssignModelVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncChangeAssignTasks.changeAssignModelVfModule(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
new file mode 100644
index 0000000000..ed281ce317
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class SDNCDeactivateTaskTest extends BaseTaskTest {
+ @Autowired
+ private SDNCDeactivateTasks sdncDeactivateTasks;
+
+ private ServiceInstance serviceInstance;
+ private CloudRegion cloudRegion;
+ private RequestContext requestContext;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private L3Network network;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ cloudRegion = setCloudRegion();
+ requestContext = setRequestContext();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ network = setL3Network();
+
+ }
+
+ @Test
+ public void deactivateVfModuleTest() throws Exception {
+ doReturn("success").when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncDeactivateTasks.deactivateVfModule(execution);
+
+ verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ }
+
+ @Test
+ public void deactivateVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncDeactivateTasks.deactivateVfModule(execution);
+ }
+
+ @Test
+ public void deactivateVnfTest() throws Exception {
+ doReturn("success").when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncDeactivateTasks.deactivateVnf(execution);
+
+ verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ }
+
+ @Test
+ public void deactivateVnfExceptionTest() throws Exception {
+ doThrow(Exception.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ expectedException.expect(BpmnError.class);
+ sdncDeactivateTasks.deactivateVnf(execution);
+ }
+
+ @Test
+ public void deactivateServiceInstanceTest() throws Exception {
+ doReturn("response").when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext);
+
+ sdncDeactivateTasks.deactivateServiceInstance(execution);
+
+ verify(sdncServiceInstanceResources, times(1)).deactivateServiceInstance(serviceInstance, customer, requestContext);
+ assertEquals("response", execution.getVariable("deactivateServiceInstanceSDNCResponse"));
+ assertTrue(execution.getVariable("sdncServiceInstanceRollback"));
+ }
+
+ @Test
+ public void deactivateServiceInstanceExceptionTest() throws Exception {
+ doThrow(Exception.class).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext);
+ expectedException.expect(BpmnError.class);
+ sdncDeactivateTasks.deactivateServiceInstance(execution);
+ }
+
+ @Test
+ public void test_deactivateNetwork() throws Exception {
+ String expectedResponse = "return";
+
+ doReturn(expectedResponse).when(sdncNetworkResources).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ sdncDeactivateTasks.deactivateNetwork(execution);
+
+ verify(sdncNetworkResources, times(1)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ assertEquals(expectedResponse, execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response"));
+
+ assertTrue(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback"));
+ }
+
+ @Test
+ public void test_deactivateNetwork_exception() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ try {
+ lookupKeyMap.remove(ResourceKey.NETWORK_ID);
+
+ sdncDeactivateTasks.deactivateNetwork(execution);
+ } finally {
+ verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ assertNull(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response"));
+
+ assertFalse(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback"));
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
new file mode 100644
index 0000000000..b98ab71d1d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class SDNCQueryTasksTest extends BaseTaskTest{
+ @Autowired
+ private SDNCQueryTasks sdncQueryTasks;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+
+ @Before
+ public void before() {
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ }
+
+ @Test
+ public void queryVfModuleTest() throws Exception {
+ String sdncQueryResponse = "response";
+ vfModule.setSelflink("vfModuleSelfLink");
+
+ doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()));
+ sdncQueryTasks.queryVfModule(execution);
+ assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()));
+
+ verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule);
+ }
+
+ @Test
+ public void queryVnfTest() throws Exception {
+ String sdncQueryResponse = "response";
+
+ doReturn(sdncQueryResponse).when(sdncVnfResources).queryVnf(genericVnf);
+
+ assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()));
+ sdncQueryTasks.queryVnf(execution);
+ assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()));
+
+ verify(sdncVnfResources, times(1)).queryVnf(genericVnf);
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupTest() throws Exception {
+ String sdncQueryResponse = "response";
+ vfModule.setSelflink("vfModuleSelfLink");
+
+ doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()));
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+ assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()));
+
+ verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule);
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ vfModule.setSelflink("");
+
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupVfObjectExceptionTest() throws Exception {
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().get(0).getVfModules().clear();
+
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(sdncVfModuleResources, times(0)).queryVfModule(any(VfModule.class));
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupNonVfObjectExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
new file mode 100644
index 0000000000..14243c5909
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
@@ -0,0 +1,202 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdnc.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class SDNCUnassignTasksTest extends BaseTaskTest{
+ @Autowired
+ private SDNCUnassignTasks sdncUnassignTasks;
+
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private CloudRegion cloudRegion;
+ private L3Network network;
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = setCustomer();
+ serviceInstance = setServiceInstance();
+ requestContext = setRequestContext();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ cloudRegion = setCloudRegion();
+ network = setL3Network();
+
+ }
+
+ @Test
+ public void unassignServiceInstanceTest() throws Exception {
+ doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext);
+
+ sdncUnassignTasks.unassignServiceInstance(execution);
+
+ verify(sdncServiceInstanceResources, times(1)).unassignServiceInstance(serviceInstance, customer, requestContext);
+ }
+
+ @Test
+ public void unassignServiceInstanceTest_inventoried() throws Exception {
+ doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext);
+
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ sdncUnassignTasks.unassignServiceInstance(execution);
+
+ verify(sdncServiceInstanceResources, times(0)).unassignServiceInstance(serviceInstance, customer, requestContext);
+ }
+
+ @Test
+ public void unassignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext);
+
+ sdncUnassignTasks.unassignServiceInstance(execution);
+ }
+
+ @Test
+ public void unassignVfModuleTest() throws Exception {
+ doReturn("response").when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance);
+
+ sdncUnassignTasks.unassignVfModule(execution);
+
+ verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance);
+ assertEquals("response", execution.getVariable("SDNCResponse"));
+ }
+
+ @Test
+ public void unassignVfModuleTest_inventoried() throws Exception {
+ vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ sdncUnassignTasks.unassignVfModule(execution);
+
+ verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance);
+ assertNull(execution.getVariable("SDNCResponse"));
+ }
+
+ @Test
+ public void unassignVfModuleTest_pendingCreate() throws Exception {
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_CREATE);
+
+ sdncUnassignTasks.unassignVfModule(execution);
+
+ verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance);
+ assertNull(execution.getVariable("SDNCResponse"));
+ }
+
+ @Test
+ public void unassignVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance);
+
+ sdncUnassignTasks.unassignVfModule(execution);
+ }
+
+ @Test
+ public void unassignVnfTest() throws Exception {
+ doReturn("response").when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ sdncUnassignTasks.unassignVnf(execution);
+
+ verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ assertTrue(execution.getVariable("sdncUnassignVnfResponse").equals("response"));
+ }
+
+ @Test
+ public void unassignVnfTest_inventoried() throws Exception {
+ genericVnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ sdncUnassignTasks.unassignVnf(execution);
+
+ verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ assertNull(execution.getVariable("sdncUnassignVnfResponse"));
+ }
+
+ @Test
+ public void unassignVnfTest_created() throws Exception {
+ genericVnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
+
+ sdncUnassignTasks.unassignVnf(execution);
+
+ verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ assertNull(execution.getVariable("sdncUnassignVnfResponse"));
+ }
+
+ @Test
+ public void unassignVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ sdncUnassignTasks.unassignVnf(execution);
+ }
+
+ @Test
+ public void unassignNetworkTest() throws Exception {
+ String cloudRegionSdnc = "AAIAIC25";
+
+ cloudRegion.setCloudRegionVersion("2.5");
+
+ execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
+
+ doReturn("response").when(sdncNetworkResources).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ assertNotEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId());
+ sdncUnassignTasks.unassignNetwork(execution);
+
+ verify(sdncNetworkResources, times(1)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ assertEquals("response", execution.getVariable("SDNCUnAssignNetworkResponse"));
+ assertEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId());
+ }
+
+ @Test
+ public void unassignNetworkTest_inventoried() throws Exception {
+ network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ sdncUnassignTasks.unassignNetwork(execution);
+
+ verify(sdncNetworkResources, times(0)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ assertNull(execution.getVariable("SDNCUnAssignNetworkResponse"));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
new file mode 100644
index 0000000000..b0b07d8cd7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -0,0 +1,182 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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 static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.db.catalog.beans.BuildingBlockDetail;
+import org.onap.so.db.catalog.beans.OrchestrationAction;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
+import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
+import org.onap.so.db.catalog.beans.ResourceType;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class OrchestrationStatusValidatorTest extends BaseTaskTest {
+ @Autowired
+ protected OrchestrationStatusValidator orchestrationStatusValidator;
+
+ @Test
+ public void test_validateOrchestrationStatus() throws Exception {
+ String flowToBeCalled = "AssignServiceInstanceBB";
+ setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.SERVICE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE, execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusConfiguration() throws Exception {
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String flowToBeCalled = "UnassignFabricConfigurationBB";
+ ServiceInstance si = setServiceInstance();
+ List<Configuration> configurations = new ArrayList<>();
+ Configuration config = new Configuration();
+
+ si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ config.setConfigurationId("configurationId");
+ config.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ configurations.add(config);
+ si.setConfigurations(configurations);
+
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.CONFIGURATION);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.CONFIGURATION);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.UNASSIGN);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.CONFIGURATION, OrchestrationStatus.PRECREATED, OrchestrationAction.UNASSIGN);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
+ }
+
+ @Test
+ public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ String flowToBeCalled = "AssignServiceInstanceBB";
+
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ doReturn(null).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+ }
+
+ @Test
+ public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ String flowToBeCalled = "AssignServiceInstanceBB";
+
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.SERVICE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+ }
+
+ @Test
+ public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ String flowToBeCalled = "AssignServiceInstanceBB";
+
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.SERVICE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.NETWORK, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
new file mode 100644
index 0000000000..d856b5e184
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -0,0 +1,188 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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 static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.when;
+
+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.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class WorkflowActionBBTasksTest extends BaseTaskTest {
+
+ @Autowired
+ protected WorkflowAction workflowAction;
+
+ @Autowired
+ protected WorkflowActionBBTasks workflowActionBBTasks;
+
+ private DelegateExecution execution;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Before
+ public void before() throws Exception {
+ execution = new DelegateExecutionFake();
+ org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ servInstance.setServiceInstanceId("TEST");
+ when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance);
+ workflowAction.setBbInputSetupUtils(bbSetupUtils);
+ workflowAction.setBbInputSetup(bbInputSetup);
+ }
+
+ @Test
+ public void selectBBTest() throws Exception{
+ String gAction = "Delete-Network-Collection";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable("homing", false);
+ execution.setVariable("calledHoming", false);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ flowsToExecute.add(ebb);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ workflowActionBBTasks.selectBB(execution);
+ boolean success = (boolean) execution.getVariable("completed");
+ assertEquals(true,success);
+ }
+
+ @Test
+ public void select2BBTest() throws Exception{
+ String gAction = "Delete-Network-Collection";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable("homing", false);
+ execution.setVariable("calledHoming", false);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ flowsToExecute.add(ebb);
+ flowsToExecute.add(ebb2);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ workflowActionBBTasks.selectBB(execution);
+ boolean success = (boolean) execution.getVariable("completed");
+ assertEquals(false,success);
+ }
+
+ @Test
+ public void msoCompleteProcessTest() throws Exception{
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", "createInstance");
+ execution.setVariable("resourceId", "123");
+ execution.setVariable("source","MSO");
+ execution.setVariable("resourceName", "Service");
+ execution.setVariable("aLaCarte", true);
+ workflowActionBBTasks.setupCompleteMsoProcess(execution);
+ String response = (String) execution.getVariable("CompleteMsoProcessRequest");
+ assertEquals(response,"<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>MSO</source></request-info><status-message>ALaCarte-Service-createInstance request was executed correctly.</status-message><serviceInstanceId>123</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>");
+ }
+
+ @Test
+ public void setupFalloutHandlerTest(){
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("serviceInstanceId", "123");
+ execution.setVariable("WorkflowActionErrorMessage", "Error in WorkFlowAction");
+ execution.setVariable("requestAction", "createInstance");
+ workflowActionBBTasks.setupFalloutHandler(execution);
+ assertEquals(execution.getVariable("falloutRequest"),"<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"xmlns:ns=\"http://org.onap/so/request/types/v1\"xmlns:wfsch=\"http://org.onap/so/workflow/schema/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>VID</source></request-info><aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>Error in WorkFlowAction</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException></aetgt:FalloutHandlerRequest>");
+ }
+
+ @Test
+ public void rollbackExecutionPathTest(){
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("CreateNetworkBB");
+ flowsToExecute.add(ebb1);
+ ebb1.setBuildingBlock(bb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("ActivateNetworkBB");
+ flowsToExecute.add(ebb2);
+ ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("CreateVolumeGroupBB");
+ flowsToExecute.add(ebb3);
+ ebb3.setBuildingBlock(bb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("ActivateVolumeGroupBB");
+ flowsToExecute.add(ebb4);
+ ebb4.setBuildingBlock(bb4);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
+ BuildingBlock bb5 = new BuildingBlock();
+ bb5.setBpmnFlowName("CreateVfModuleBB");
+ flowsToExecute.add(ebb5);
+ ebb5.setBuildingBlock(bb5);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
+ BuildingBlock bb6 = new BuildingBlock();
+ bb6.setBpmnFlowName("ActivateVfModuleBB");
+ flowsToExecute.add(ebb6);
+ ebb6.setBuildingBlock(bb6);
+ ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock();
+ BuildingBlock bb7 = new BuildingBlock();
+ bb7.setBpmnFlowName("ActivateVnfBB");
+ ebb7.setBuildingBlock(bb7);
+ flowsToExecute.add(ebb7);
+ ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock();
+ BuildingBlock bb8 = new BuildingBlock();
+ bb8.setBpmnFlowName("ActivateServiceInstance");
+ ebb8.setBuildingBlock(bb8);
+ flowsToExecute.add(ebb8);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 6);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ }
+
+ @Test
+ public void checkRetryStatusTest(){
+ execution.setVariable("handlingCode","Retry");
+ execution.setVariable("retryCount", 1);
+ execution.setVariable("gCurrentSequence",1);
+ workflowActionBBTasks.checkRetryStatus(execution);
+ assertEquals(0,execution.getVariable("gCurrentSequence"));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
new file mode 100644
index 0000000000..c910ad19fa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -0,0 +1,1494 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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 static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResource;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
+import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.SubscriberInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class WorkflowActionTest extends BaseTaskTest {
+ @Autowired
+ protected WorkflowAction workflowAction;
+
+ private DelegateExecution execution;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Before
+ public void before() throws Exception {
+ execution = new DelegateExecutionFake();
+ org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ servInstance.setServiceInstanceId("TEST");
+ when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance);
+ workflowAction.setBbInputSetupUtils(bbSetupUtils);
+ workflowAction.setBbInputSetup(bbInputSetup);
+ }
+ /**
+ * ALACARTE TESTS
+ */
+ @Test
+ public void selectExecutionListALaCarteNetworkCreateTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "Network";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/networks/123");
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignNetwork1802BB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch3);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest);
+
+
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignNetwork1802BB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception{
+ String gAction = "deleteInstance";
+ String resource = "Network";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/networks/123");
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("DeactivateNetworkBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("DeleteNetworkBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("UnassignNetwork1802BB");
+ orchFlows.add(orch3);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetwork1802BB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteServiceCreateTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignServiceInstanceBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch2);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
+ }
+
+ /**
+ * SERVICE MACRO TESTS
+ */
+ @Test
+ public void selectExecutionListServiceMacroAssignTest() throws Exception{
+ String gAction = "assignInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignServiceInstanceBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("AssignNetworkBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("AssignVnfBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("AssignVolumeGroupBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("AssignVfModuleBB");
+ orchFlows.add(orch5);
+
+ 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(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).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);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignVnfBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignVolumeGroupBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB");
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroActivateTest() throws Exception{
+ String gAction = "activateInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/si0");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("CreateVolumeGroupBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("ActivateVolumeGroupBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("CreateVfModuleBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("ActivateVfModuleBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("ActivateVnfBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch8);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("si0");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ vnf.setVnfId("vnf0");
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModule0");
+ vnf.getVfModules().add(vfModule);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule2.setVfModuleId("vfModule1");
+ vnf.getVfModules().add(vfModule2);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroup0");
+ vnf.getVolumeGroups().add(volumeGroup);
+
+ serviceInstanceMSO.getVnfs().add(vnf);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals("CreateVolumeGroupBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
+ assertEquals("ActivateVolumeGroupBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+ assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
+ assertEquals("CreateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
+ assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("CreateVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName());
+ assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("ActivateVfModuleBB", ebbs.get(4).getBuildingBlock().getBpmnFlowName());
+ assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("ActivateVfModuleBB", ebbs.get(5).getBuildingBlock().getBpmnFlowName());
+ assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("ActivateVnfBB", ebbs.get(6).getBuildingBlock().getBpmnFlowName());
+ assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
+ assertEquals("ActivateServiceInstanceBB", ebbs.get(7).getBuildingBlock().getBpmnFlowName());
+ assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
+
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroDeactivateTest() throws Exception{
+ String gAction = "deactivateInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch = new OrchestrationFlow();
+ orch.setFlowName("DeactivateServiceInstanceBB");
+ orchFlows.add(orch);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroEmptyServiceTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setIsToplevelflow(true);
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignServiceInstanceBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("CreateNetworkCollectionBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("AssignNetworkBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("AssignVnfBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("AssignVolumeGroupBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("AssignVfModuleBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch8);
+ OrchestrationFlow orch9 = new OrchestrationFlow();
+ orch9.setFlowName("CreateVolumeGroupBB");
+ orchFlows.add(orch9);
+ OrchestrationFlow orch10 = new OrchestrationFlow();
+ orch10.setFlowName("ActivateVolumeGroupBB");
+ orchFlows.add(orch10);
+ OrchestrationFlow orch11 = new OrchestrationFlow();
+ orch11.setFlowName("CreateVfModuleBB");
+ orchFlows.add(orch11);
+ OrchestrationFlow orch12 = new OrchestrationFlow();
+ orch12.setFlowName("ActivateVfModuleBB");
+ orchFlows.add(orch12);
+ OrchestrationFlow orch13 = new OrchestrationFlow();
+ orch13.setFlowName("ActivateVnfBB");
+ orchFlows.add(orch13);
+ OrchestrationFlow orch14 = new OrchestrationFlow();
+ orch14.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch15);
+
+ Service service = new Service();
+ doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroCreateJustNetworkTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setIsToplevelflow(true);
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignServiceInstanceBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("CreateNetworkCollectionBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("AssignNetworkBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("AssignVnfBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("AssignVolumeGroupBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("AssignVfModuleBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch8);
+ OrchestrationFlow orch9 = new OrchestrationFlow();
+ orch9.setFlowName("CreateVolumeGroupBB");
+ orchFlows.add(orch9);
+ OrchestrationFlow orch10 = new OrchestrationFlow();
+ orch10.setFlowName("ActivateVolumeGroupBB");
+ orchFlows.add(orch10);
+ OrchestrationFlow orch11 = new OrchestrationFlow();
+ orch11.setFlowName("CreateVfModuleBB");
+ orchFlows.add(orch11);
+ OrchestrationFlow orch12 = new OrchestrationFlow();
+ orch12.setFlowName("ActivateVfModuleBB");
+ orchFlows.add(orch12);
+ OrchestrationFlow orch13 = new OrchestrationFlow();
+ orch13.setFlowName("ActivateVnfBB");
+ orchFlows.add(orch13);
+ OrchestrationFlow orch14 = new OrchestrationFlow();
+ orch14.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch15);
+
+ Service service = new Service();
+ NetworkResourceCustomization networkCustomization = new NetworkResourceCustomization();
+ networkCustomization.setModelCustomizationUUID("1234");
+ service.getNetworkCustomizations().add(networkCustomization);
+ doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setIsToplevelflow(true);
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignServiceInstanceBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("CreateNetworkCollectionBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("AssignNetworkBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("AssignVnfBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("AssignVolumeGroupBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("AssignVfModuleBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch8);
+ OrchestrationFlow orch9 = new OrchestrationFlow();
+ orch9.setFlowName("CreateVolumeGroupBB");
+ orchFlows.add(orch9);
+ OrchestrationFlow orch10 = new OrchestrationFlow();
+ orch10.setFlowName("ActivateVolumeGroupBB");
+ orchFlows.add(orch10);
+ OrchestrationFlow orch11 = new OrchestrationFlow();
+ orch11.setFlowName("CreateVfModuleBB");
+ orchFlows.add(orch11);
+ OrchestrationFlow orch12 = new OrchestrationFlow();
+ orch12.setFlowName("ActivateVfModuleBB");
+ orchFlows.add(orch12);
+ OrchestrationFlow orch13 = new OrchestrationFlow();
+ orch13.setFlowName("ActivateVnfBB");
+ orchFlows.add(orch13);
+ OrchestrationFlow orch14 = new OrchestrationFlow();
+ orch14.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch15);
+
+ Service service = new Service();
+ List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>();
+ NetworkResourceCustomization networkCust = new NetworkResourceCustomization();
+ networkCust.setModelCustomizationUUID("123");
+ networkCustomizations.add(networkCust);
+ service.setNetworkCustomizations(networkCustomizations);
+ NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization();
+ collectionResourceCustomization.setModelCustomizationUUID("123");
+
+ CollectionResource collectionResource = new CollectionResource();
+ collectionResource.setToscaNodeType("NetworkCollection");
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setToscaNodeType("NetworkCollectionResource");
+ instanceGroup.setCollectionNetworkResourceCustomizations(new ArrayList<>());
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization();
+ collectionNetworkResourceCust.setModelCustomizationUUID("123");
+ instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust );
+ List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>();
+ CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
+ collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3);
+ collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization);
+ collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup);
+ instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations);
+ collectionResource.setInstanceGroup(instanceGroup);
+ collectionResourceCustomization.setCollectionResource(collectionResource);;
+ service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
+ doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+ doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB");
+ assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception{
+ String gAction = "createInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AssignServiceInstanceBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("CreateNetworkCollectionBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("AssignNetworkBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("AssignVnfBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("AssignVolumeGroupBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("AssignVfModuleBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch8);
+ OrchestrationFlow orch9 = new OrchestrationFlow();
+ orch9.setFlowName("CreateVolumeGroupBB");
+ orchFlows.add(orch9);
+ OrchestrationFlow orch10 = new OrchestrationFlow();
+ orch10.setFlowName("ActivateVolumeGroupBB");
+ orchFlows.add(orch10);
+ OrchestrationFlow orch11 = new OrchestrationFlow();
+ orch11.setFlowName("CreateVfModuleBB");
+ orchFlows.add(orch11);
+ OrchestrationFlow orch12 = new OrchestrationFlow();
+ orch12.setFlowName("ActivateVfModuleBB");
+ orchFlows.add(orch12);
+ OrchestrationFlow orch13 = new OrchestrationFlow();
+ orch13.setFlowName("ActivateVnfBB");
+ orchFlows.add(orch13);
+ OrchestrationFlow orch14 = new OrchestrationFlow();
+ orch14.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch15);
+
+ 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(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).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);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB");
+ assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignVnfBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignVolumeGroupBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateVolumeGroupBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateVolumeGroupBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(13).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(ebbs.get(14).getBuildingBlock().getBpmnFlowName(),"ActivateVnfBB");
+ assertEquals(UUID.randomUUID().toString().length(),ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
+ assertEquals(ebbs.get(15).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
+ assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroDeleteTest() throws Exception{
+ String gAction = "deleteInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("DeactivateVfModuleBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("DeleteVfModuleBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("DeactivateVolumeGroupBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("DeleteVolumeGroupBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("DeactivateVnfBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("DeactivateNetworkBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("DeleteNetworkBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("DeleteNetworkCollectionBB");
+ orchFlows.add(orch8);
+ OrchestrationFlow orch9 = new OrchestrationFlow();
+ orch9.setFlowName("DeactivateServiceInstanceBB");
+ orchFlows.add(orch9);
+ OrchestrationFlow orch10 = new OrchestrationFlow();
+ orch10.setFlowName("UnassignVfModuleBB");
+ orchFlows.add(orch10);
+ OrchestrationFlow orch11 = new OrchestrationFlow();
+ orch11.setFlowName("UnassignVolumeGroupBB");
+ orchFlows.add(orch11);
+ OrchestrationFlow orch12 = new OrchestrationFlow();
+ orch12.setFlowName("UnassignVnfBB");
+ orchFlows.add(orch12);
+ OrchestrationFlow orch13 = new OrchestrationFlow();
+ orch13.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch13);
+ OrchestrationFlow orch14 = new OrchestrationFlow();
+ orch14.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch14);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("aaisi123");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ vnf.setVnfId("vnfId123");
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModule1");
+ vnf.getVfModules().add(vfModule);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule2.setVfModuleId("vfModule2");
+ vnf.getVfModules().add(vfModule2);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup();
+ volumeGroup.setVolumeGroupId("vg123");
+ vnf.getVolumeGroups().add(volumeGroup);
+
+ serviceInstanceMSO.getVnfs().add(vnf);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB");
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB");
+ assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeactivateVnfBB");
+ assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB");
+ assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB");
+ assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB");
+ assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"UnassignVolumeGroupBB");
+ assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"UnassignVnfBB");
+ assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroUnassignTest() throws Exception{
+ String gAction = "unassignInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("UnassignVfModuleBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("UnassignVolumeGroupBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("UnassignVnfBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch5);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("aaisi123");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ vnf.setVnfId("vnfId123");
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModule1");
+ vnf.getVfModules().add(vfModule);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule2.setVfModuleId("vfModule2");
+ vnf.getVfModules().add(vfModule2);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup();
+ volumeGroup.setVolumeGroupId("vg123");
+ vnf.getVolumeGroups().add(volumeGroup);
+
+ serviceInstanceMSO.getVnfs().add(vnf);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVolumeGroupBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"UnassignVnfBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception{
+ String gAction = "deleteInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("DeactivateVfModuleBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("DeleteVfModuleBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("DeactivateVolumeGroupBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("DeleteVolumeGroupBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("DeactivateVnfBB");
+ orchFlows.add(orch5);
+ OrchestrationFlow orch6 = new OrchestrationFlow();
+ orch6.setFlowName("DeactivateNetworkBB");
+ orchFlows.add(orch6);
+ OrchestrationFlow orch7 = new OrchestrationFlow();
+ orch7.setFlowName("DeleteNetworkBB");
+ orchFlows.add(orch7);
+ OrchestrationFlow orch8 = new OrchestrationFlow();
+ orch8.setFlowName("DeleteNetworkCollectionBB");
+ orchFlows.add(orch8);
+ OrchestrationFlow orch9 = new OrchestrationFlow();
+ orch9.setFlowName("DeactivateServiceInstanceBB");
+ orchFlows.add(orch9);
+ OrchestrationFlow orch10 = new OrchestrationFlow();
+ orch10.setFlowName("UnassignVfModuleBB");
+ orchFlows.add(orch10);
+ OrchestrationFlow orch11 = new OrchestrationFlow();
+ orch11.setFlowName("UnassignVolumeGroupBB");
+ orchFlows.add(orch11);
+ OrchestrationFlow orch12 = new OrchestrationFlow();
+ orch12.setFlowName("UnassignVnfBB");
+ orchFlows.add(orch12);
+ OrchestrationFlow orch13 = new OrchestrationFlow();
+ orch13.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch13);
+ OrchestrationFlow orch14 = new OrchestrationFlow();
+ orch14.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch14);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("aaisi123");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network();
+ network.setNetworkId("123");
+ serviceInstanceMSO.getNetworks().add(network);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network();
+ network2.setNetworkId("321");
+ serviceInstanceMSO.getNetworks().add(network2);
+
+ Collection collection = new Collection();
+ serviceInstanceMSO.setCollection(collection);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
+ assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB");
+ assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB");
+ assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB");
+ }
+
+ @Ignore
+ @Test
+ public void selectExecutionListNetworkCollectionMacroCreate() throws Exception{
+ String gAction = "createInstance";
+ String resource = "NetworkCollection";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("CreateNetworkCollectionBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("AssignNetworkBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("CreateNetworkBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("ActivateNetworkBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch5);
+
+ Service service = new Service();
+ CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization();
+ CollectionResource collectionResource = new CollectionResource();
+ collectionResource.setToscaNodeType("Data NetworkCollection Data");
+ collectionResourceCustomization.setCollectionResource(collectionResource);
+ service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB");
+ }
+
+ @Ignore
+ @Test
+ public void selectExecutionListNetworkCollectionMacroDelete() throws Exception{
+ String gAction = "deleteInstance";
+ String resource = "NetworkCollection";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("DeactivateNetworkBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("DeleteNetworkBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("DeactivateNetworkCollectionBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("DeleteNetworkCollectionBB");
+ orchFlows.add(orch5);
+
+ Service service = new Service();
+ CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization();
+ CollectionResource collectionResource = new CollectionResource();
+ collectionResource.setToscaNodeType("Data NetworkCollection Data");
+ collectionResourceCustomization.setCollectionResource(collectionResource);
+ service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
+ assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
+ assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkCollectionBB");
+ assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB");
+ }
+
+ /**
+ * WorkflowActionBB Tests
+ */
+
+ @Test
+ public void pluralTest() {
+ List<String> items = Arrays.asList(
+ "serviceInstances, Service",
+ "vnfs, Vnf",
+ "vfModules, VfModule",
+ "networks, Network",
+ "invalidNames, invalidNames");
+ items.forEach(item -> {
+ String[] split = item.split(",");
+ String type = split[0].trim();
+ String expected = split[1].trim();
+ assertThat(workflowAction.convertTypeFromPlural(type), equalTo(expected));
+ });
+ }
+
+ @Test
+ public void sortExecutionPathByObjectForVlanTaggingCreateTest() throws Exception{
+ List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ BuildingBlock bb = new BuildingBlock();
+ bb.setBpmnFlowName("AssignNetworkBB");
+ bb.setKey("0");
+ ebb.setBuildingBlock(bb);
+ executeFlows.add(ebb);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("AssignNetworkBB");
+ bb2.setKey("1");
+ ebb2.setBuildingBlock(bb2);
+ executeFlows.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("CreateNetworkBB");
+ bb3.setKey("0");
+ ebb3.setBuildingBlock(bb3);
+ executeFlows.add(ebb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("CreateNetworkBB");
+ bb4.setKey("1");
+ ebb4.setBuildingBlock(bb4);
+ executeFlows.add(ebb4);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
+ BuildingBlock bb5 = new BuildingBlock();
+ bb5.setBpmnFlowName("ActivateNetworkBB");
+ bb5.setKey("0");
+ ebb5.setBuildingBlock(bb5);
+ executeFlows.add(ebb5);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
+ BuildingBlock bb6 = new BuildingBlock();
+ bb6.setBpmnFlowName("ActivateNetworkBB");
+ bb6.setKey("1");
+ ebb6.setBuildingBlock(bb6);
+ executeFlows.add(ebb6);
+
+ List<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"createInstance");
+ assertEquals(sorted.get(0).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(sorted.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(sorted.get(2).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ assertEquals(sorted.get(3).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB");
+ assertEquals(sorted.get(4).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB");
+ assertEquals(sorted.get(5).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB");
+ }
+
+ @Test
+ public void sortExecutionPathByObjectForVlanTaggingDeleteTest() throws Exception{
+ List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ BuildingBlock bb = new BuildingBlock();
+ bb.setBpmnFlowName("DeactivateNetworkBB");
+ bb.setKey("0");
+ ebb.setBuildingBlock(bb);
+ executeFlows.add(ebb);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("DeactivateNetworkBB");
+ bb2.setKey("1");
+ ebb2.setBuildingBlock(bb2);
+ executeFlows.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("DeleteNetworkBB");
+ bb3.setKey("0");
+ ebb3.setBuildingBlock(bb3);
+ executeFlows.add(ebb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("DeleteNetworkBB");
+ bb4.setKey("1");
+ ebb4.setBuildingBlock(bb4);
+ executeFlows.add(ebb4);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
+ BuildingBlock bb5 = new BuildingBlock();
+ bb5.setBpmnFlowName("UnassignNetworkBB");
+ bb5.setKey("0");
+ ebb5.setBuildingBlock(bb5);
+ executeFlows.add(ebb5);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
+ BuildingBlock bb6 = new BuildingBlock();
+ bb6.setBpmnFlowName("UnassignNetworkBB");
+ bb6.setKey("1");
+ ebb6.setBuildingBlock(bb6);
+ executeFlows.add(ebb6);
+
+ List<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"deleteInstance");
+ assertEquals(sorted.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(sorted.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(sorted.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
+ assertEquals(sorted.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB");
+ assertEquals(sorted.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB");
+ assertEquals(sorted.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB");
+ }
+ @Test
+ public void queryNorthBoundRequestCatalogDbNestedTest() throws MalformedURLException {
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = new LinkedList<>();
+ OrchestrationFlow orch1 = new OrchestrationFlow();
+ orch1.setFlowName("AAICheckVnfInMaintBB");
+ orchFlows.add(orch1);
+ OrchestrationFlow orch2 = new OrchestrationFlow();
+ orch2.setFlowName("AAISetVnfInMaintBB");
+ orchFlows.add(orch2);
+ OrchestrationFlow orch3 = new OrchestrationFlow();
+ orch3.setFlowName("VNF-Macro-Replace");
+ orchFlows.add(orch3);
+ OrchestrationFlow orch4 = new OrchestrationFlow();
+ orch4.setFlowName("SDNOVnfHealthCheckBB");
+ orchFlows.add(orch4);
+ OrchestrationFlow orch5 = new OrchestrationFlow();
+ orch5.setFlowName("AAIUnsetVnfInMaintBB");
+ orchFlows.add(orch5);
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ List<OrchestrationFlow> macroFlows = new LinkedList<>();
+ OrchestrationFlow o1 = new OrchestrationFlow();
+ o1.setFlowName("DeactivateVfModuleBB");
+ macroFlows.add(o1);
+ OrchestrationFlow o2 = new OrchestrationFlow();
+ o2.setFlowName("DeleteVfModuleBB");
+ macroFlows.add(o2);
+ OrchestrationFlow o3 = new OrchestrationFlow();
+ o3.setFlowName("DeactivateVnfBB");
+ macroFlows.add(o3);
+ OrchestrationFlow o4 = new OrchestrationFlow();
+ o4.setFlowName("CreateVfModuleBB");
+ macroFlows.add(o4);
+ OrchestrationFlow o5 = new OrchestrationFlow();
+ o5.setFlowName("ActivateVfModuleBB");
+ macroFlows.add(o5);
+ OrchestrationFlow o6 = new OrchestrationFlow();
+ o6.setFlowName("ActivateVnfBB");
+ macroFlows.add(o6);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope("replaceInstance","Vnf",false)).thenReturn(northBoundRequest);
+ when(catalogDbClient.getOrchestrationFlowByAction("VNF-Macro-Replace")).thenReturn(macroFlows);
+ List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance", WorkflowType.VNF, false);
+ assertEquals(flows.get(0).getFlowName(),"AAICheckVnfInMaintBB");
+ assertEquals(flows.get(1).getFlowName(),"AAISetVnfInMaintBB");
+ assertEquals(flows.get(2).getFlowName(),"DeactivateVfModuleBB");
+ assertEquals(flows.get(3).getFlowName(),"DeleteVfModuleBB");
+ assertEquals(flows.get(4).getFlowName(),"DeactivateVnfBB");
+ assertEquals(flows.get(5).getFlowName(),"CreateVfModuleBB");
+ assertEquals(flows.get(6).getFlowName(),"ActivateVfModuleBB");
+ assertEquals(flows.get(7).getFlowName(),"ActivateVnfBB");
+ assertEquals(flows.get(8).getFlowName(),"SDNOVnfHealthCheckBB");
+ assertEquals(flows.get(9).getFlowName(),"AAIUnsetVnfInMaintBB");
+ }
+
+ @Test
+ public void extractResourceIdAndTypeFromUriTest(){
+ String uri = "/v6/serviceInstances/123";
+ String uri2 = "/v6/serviceInstances/123/vnfs/1234";
+ String uri3 = "/v6/serviceInstances";
+ String uri4 = "/v6/serviceInstances/assign";
+ String uri5 = "'/v6/serviceInstances/123/vnfs";
+ String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction";
+ String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace";
+
+ 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 result = workflowAction.extractResourceIdAndTypeFromUri(uri);
+ assertEquals(expected1.getResourceId(),result.getResourceId());
+ assertEquals(expected1.getResourceType(),result.getResourceType());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri2);
+ assertEquals(expected2.getResourceId(),result.getResourceId());
+ assertEquals(expected2.getResourceType(),result.getResourceType());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri3);
+ assertEquals("Service", result.getResourceType().toString());
+ assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri4);
+ assertEquals("Service", result.getResourceType().toString());
+ assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri5);
+ assertEquals("Vnf", result.getResourceType().toString());
+ assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri6);
+ assertEquals(expected3.getResourceId(),result.getResourceId());
+ assertEquals(expected3.getResourceType(),result.getResourceType());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri7);
+ assertEquals(expected4.getResourceId(),result.getResourceId());
+ assertEquals(expected4.getResourceType(),result.getResourceType());
+ }
+
+ @Test
+ public void extractResourceIdAndTypeFromUriInvalidTypeTest() {
+ this.expectedException.expect(IllegalArgumentException.class);
+ this.expectedException.expectMessage(containsString("Uri could not be parsed. No type found."));
+ workflowAction.extractResourceIdAndTypeFromUri("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace");
+ }
+
+ @Test
+ public void extractResourceIdAndTypeFromUriInvalidUriTest() {
+ this.expectedException.expect(IllegalArgumentException.class);
+ this.expectedException.expectMessage(containsString("Uri could not be parsed:"));
+ workflowAction.extractResourceIdAndTypeFromUri("something that doesn't match anything");
+ }
+
+ @Test
+ public void populateResourceIdsFromApiHandlerTest(){
+ execution.setVariable("serviceInstanceId", "123");
+ execution.setVariable("vnfId", "888");
+ WorkflowResourceIds x = workflowAction.populateResourceIdsFromApiHandler(execution);
+ assertEquals("123",x.getServiceInstanceId());
+ assertEquals("888",x.getVnfId());
+ assertNull(x.getVolumeGroupId());
+ }
+
+ @Test
+ public void validateResourceIdInAAITest() throws Exception{
+ //SI
+ RequestDetails reqDetails = new RequestDetails();
+ SubscriberInfo subInfo = new SubscriberInfo();
+ subInfo.setGlobalSubscriberId("id123");
+ reqDetails.setSubscriberInfo(subInfo);
+ RequestParameters reqParams = new RequestParameters();
+ reqParams.setSubscriptionServiceType("subServiceType123");
+ reqDetails.setRequestParameters(reqParams );
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ ServiceInstance si = new ServiceInstance();
+ si.setServiceInstanceId("siId123");
+ Optional<ServiceInstance> siOp = Optional.of(si);
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp);
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111")).thenReturn(Optional.empty());
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, workflowResourceIds);
+ assertEquals("siId123",id);
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", reqDetails, workflowResourceIds);
+ assertEquals("generatedId123",id2);
+
+ //Network
+ L3Network network = new L3Network();
+ network.setNetworkId("id123");
+ network.setNetworkName("name123");
+ workflowResourceIds.setServiceInstanceId("siId123");
+ Optional<L3Network> opNetwork = Optional.of(network);
+ when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123","name123")).thenReturn(opNetwork);
+ when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123","111111")).thenReturn(Optional.empty());
+ id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, workflowResourceIds);
+ assertEquals("id123",id);
+ id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, workflowResourceIds);
+ assertEquals("generatedId123",id2);
+
+ //Vnf
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("id123");
+ vnf.setVnfName("vnfName123");
+ Optional<GenericVnf> opVnf = Optional.of(vnf);
+ when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123","name123")).thenReturn(opVnf);
+ when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123","111111")).thenReturn(Optional.empty());
+ id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "name123", reqDetails, workflowResourceIds);
+ assertEquals("id123",id);
+ id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails, workflowResourceIds);
+ assertEquals("generatedId123",id2);
+
+ //VfModule
+ VfModules vfModules = new VfModules();
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("id123");
+ vfModule.setVfModuleName("name123");
+ vfModules.getVfModule().add(vfModule);
+ vnf.setVfModules(vfModules);
+ workflowResourceIds.setVnfId("id123");
+ when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf);
+ id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", reqDetails, workflowResourceIds);
+ assertEquals("id123",id);
+
+ GenericVnf vnf2 = new GenericVnf();
+ VfModules vfModules2 = new VfModules();
+ VfModule vfModule2 = new VfModule();
+ vfModule2.setVfModuleId("id123");
+ vfModule2.setVfModuleName("name123");
+ vfModules2.getVfModule().add(vfModule2);
+ vnf2.setVfModules(vfModules2);
+ workflowResourceIds.setVnfId("id111");
+ when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf2);
+ id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", reqDetails, workflowResourceIds);
+ assertEquals("generatedId123",id2);
+
+ //VolumeGroup
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("id123");
+ volumeGroup.setVolumeGroupName("name123");
+ workflowResourceIds.setVnfId("id123");
+ Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup);
+ when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123","name123")).thenReturn(opVolumeGroup);
+ id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds);
+ assertEquals("id123",id);
+
+ workflowResourceIds.setVnfId("id444");
+ when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf);
+ when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123","111111")).thenReturn(opVolumeGroup);
+ when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444","111111")).thenReturn(Optional.empty());
+ id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, workflowResourceIds);
+ assertEquals("id123",id2);
+ }
+
+ @Test
+ public void handleRuntimeExceptionTest(){
+ execution.setVariable("BPMN_javaExpMsg", "test runtime error message");
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+ try{
+ workflowAction.handleRuntimeException(execution);
+ } catch (BpmnError wfe) {
+ assertEquals("MSOWorkflowException",wfe.getErrorCode());
+ }
+ }
+
+ @Test
+ public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException{
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+ Service service = new Service();
+ List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>();
+ NetworkResourceCustomization networkCust = new NetworkResourceCustomization();
+ networkCust.setModelCustomizationUUID("123");
+ networkCustomizations.add(networkCust);
+ service.setNetworkCustomizations(networkCustomizations);
+ NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization();
+ collectionResourceCustomization.setModelCustomizationUUID("123");
+ CollectionResource collectionResource = new CollectionResource();
+ collectionResource.setToscaNodeType("NetworkCollection");
+ InstanceGroup instanceGroup = new InstanceGroup();
+ List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>();
+ CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
+ collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3);
+ collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization);
+ instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations);
+ collectionResource.setInstanceGroup(instanceGroup);
+ collectionResourceCustomization.setCollectionResource(collectionResource);;
+ service.setModelUUID("abc");
+ service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
+ service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
+ doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+ doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ List<Resource> resourceCounter = new ArrayList<>();
+ thrown.expect(BpmnError.class);
+ workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter);
+ }
+
+ @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 = workflowAction.sortVfModulesByBaseFirst(resources);
+ assertEquals("333",result.get(0).getResourceId());
+ assertEquals("222",result.get(1).getResourceId());
+ assertEquals("111",result.get(2).getResourceId());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java
new file mode 100644
index 0000000000..10599bdab4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.sdno.tasks;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNOHealthCheckResources;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNOHealthCheckTasksTest extends TestDataSetup {
+
+ @InjectMocks
+ protected SDNOHealthCheckTasks sdnoHealthCheckTasks = new SDNOHealthCheckTasks();
+
+ @Mock
+ SDNOHealthCheckResources MOCK_sdnoHealthCheckResources;
+
+
+ @Mock
+ private ExceptionBuilder exceptionUtil;
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+
+ private RequestContext requestContext;
+ private GenericVnf genericVnf;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ requestContext = setRequestContext();
+ when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf);
+
+ }
+
+ @Test
+ public void sdnoHealthCheckTest() throws Exception {
+ doReturn(true).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext);
+ sdnoHealthCheckTasks.sdnoHealthCheck(execution);
+ verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext);
+ }
+
+ @Test
+ public void sdnoHealthCheckNoResponseTest() throws Exception {
+
+ doReturn(false).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext);
+ try {
+ sdnoHealthCheckTasks.sdnoHealthCheck(execution);
+ } catch (Exception e) {
+ verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+
+ }
+
+ @Test
+ public void sdnoHealthCheckExceptionTest() throws Exception {
+ doThrow(new Exception("Unknown Error")).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext);
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ try {
+ sdnoHealthCheckTasks.sdnoHealthCheck(execution);
+ } catch (Exception e) {
+ verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
new file mode 100644
index 0000000000..88f8526f31
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -0,0 +1,623 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.aai.mapper;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+public class AAIObjectMapperTest{
+ private AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+
+ @Test
+ public void mapConfigurationTest() {
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configId");
+ configuration.setConfigurationName("VNR");
+ configuration.setConfigurationType("VNR-TYPE");
+ configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ configuration.setManagementOption("managementOption");
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelCustomizationId("modelCustId");
+ modelInfoConfiguration.setModelInvariantId("modelInvariantId");
+ modelInfoConfiguration.setModelVersionId("modelVersionId");
+ configuration.setModelInfoConfiguration(modelInfoConfiguration);
+
+ org.onap.aai.domain.yang.Configuration expectedConfiguration = new org.onap.aai.domain.yang.Configuration();
+ expectedConfiguration.setConfigurationId(configuration.getConfigurationId());
+ expectedConfiguration.setConfigurationName(configuration.getConfigurationName());
+ expectedConfiguration.setConfigurationType(configuration.getConfigurationType());
+ expectedConfiguration.setOrchestrationStatus(configuration.getOrchestrationStatus().toString());
+ expectedConfiguration.setManagementOption(configuration.getManagementOption());
+ expectedConfiguration.setModelInvariantId(configuration.getModelInfoConfiguration().getModelInvariantId());
+ expectedConfiguration.setModelVersionId(configuration.getModelInfoConfiguration().getModelVersionId());
+ expectedConfiguration.setModelCustomizationId(configuration.getModelInfoConfiguration().getModelCustomizationId());
+
+ org.onap.aai.domain.yang.Configuration actualConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+
+ assertThat(actualConfiguration, sameBeanAs(expectedConfiguration));
+ }
+
+ @Test
+ public void mapVolumeGroupTest() throws Exception {
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setHeatStackId("heatStackId");
+ volumeGroup.setModelInfoVfModule(new ModelInfoVfModule());
+ volumeGroup.getModelInfoVfModule().setModelCustomizationUUID("modelCustomizationId");
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ volumeGroup.setVnfType("vnfType");
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+
+ org.onap.aai.domain.yang.VolumeGroup expectedVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup();
+ expectedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
+ expectedVolumeGroup.setModelCustomizationId(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
+ expectedVolumeGroup.setOrchestrationStatus(volumeGroup.getOrchestrationStatus().toString());
+ expectedVolumeGroup.setVfModuleModelCustomizationId(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
+ expectedVolumeGroup.setVnfType(volumeGroup.getVnfType());
+ expectedVolumeGroup.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ expectedVolumeGroup.setVolumeGroupName(volumeGroup.getVolumeGroupName());
+
+ org.onap.aai.domain.yang.VolumeGroup actualVolumeGroup = aaiObjectMapper.mapVolumeGroup(volumeGroup);
+
+ assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup));
+ }
+
+ @Test
+ public void serviceInstanceMap() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("SIID");
+ serviceInstance.setServiceInstanceName("SINAME");
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setServiceType("SITYPE");
+ modelInfoServiceInstance.setServiceRole("SIROLE");
+ modelInfoServiceInstance.setModelInvariantUuid("MIUUID");
+ modelInfoServiceInstance.setModelUuid("MUUID");
+ modelInfoServiceInstance.setEnvironmentContext("EC");
+ modelInfoServiceInstance.setWorkloadContext("WC");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance);
+
+ assertEquals(AAIServiceInstance.getServiceInstanceId(),serviceInstance.getServiceInstanceId());
+ assertEquals(AAIServiceInstance.getServiceInstanceName(),serviceInstance.getServiceInstanceName());
+ assertEquals(AAIServiceInstance.getOrchestrationStatus().toString(),serviceInstance.getOrchestrationStatus().toString());
+ assertEquals(AAIServiceInstance.getServiceType(),serviceInstance.getModelInfoServiceInstance().getServiceType());
+ assertEquals(AAIServiceInstance.getServiceRole(),serviceInstance.getModelInfoServiceInstance().getServiceRole());
+ assertEquals(AAIServiceInstance.getModelInvariantId(),serviceInstance.getModelInfoServiceInstance().getModelInvariantUuid());
+ assertEquals(AAIServiceInstance.getModelVersionId(),serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ assertEquals(AAIServiceInstance.getEnvironmentContext(),serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
+ assertEquals(AAIServiceInstance.getWorkloadContext(),serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ }
+
+ @Test
+ public void projectMap(){
+ Project project = new Project();
+ project.setProjectName("abc");
+
+ org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
+
+ assertEquals(AAIProject.getProjectName(),project.getProjectName());
+ }
+
+ @Test
+ public void serviceSubscriptionMap(){
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType("IP-FLEX");
+ serviceSubscription.setTempUbSubAccountId("Account-ID");
+ org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionMapped = aaiObjectMapper.mapServiceSubscription(serviceSubscription);
+ assertNotNull(serviceSubscriptionMapped);
+ assertEquals(serviceSubscription.getTempUbSubAccountId(),serviceSubscriptionMapped.getTempUbSubAccountId());
+ assertEquals(serviceSubscription.getServiceType(),serviceSubscriptionMapped.getServiceType());
+ }
+
+ @Test
+ public void owningEntityMap(){
+ OwningEntity oe = new OwningEntity();
+ oe.setOwningEntityId("abc");
+ oe.setOwningEntityName("bbb");
+
+ org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(oe);
+
+ assertEquals(AAIOwningEntity.getOwningEntityId(),oe.getOwningEntityId());
+ assertEquals(AAIOwningEntity.getOwningEntityName(),oe.getOwningEntityName());
+
+ }
+
+ @Test
+ public void vnfMap(){
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("a");
+ vnf.setVnfName("b");
+ vnf.setServiceId("c");
+ vnf.setVnfType("d");
+ vnf.setProvStatus("e");
+ vnf.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelCustomizationUuid("f");
+ modelInfoGenericVnf.setModelInvariantUuid("g");
+ modelInfoGenericVnf.setModelUuid("h");
+ modelInfoGenericVnf.setNfRole("i");
+ modelInfoGenericVnf.setNfType("j");
+ modelInfoGenericVnf.setNfFunction("k");
+ modelInfoGenericVnf.setNfNamingCode("l");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ org.onap.aai.domain.yang.GenericVnf AAIVnf = aaiObjectMapper.mapVnf(vnf);
+
+ assertEquals(AAIVnf.getVnfId(),vnf.getVnfId());
+ assertEquals(AAIVnf.getVnfName(),vnf.getVnfName());
+ assertEquals(AAIVnf.getServiceId(),vnf.getServiceId());
+ assertEquals(AAIVnf.getVnfType(),vnf.getVnfType());
+ assertEquals(AAIVnf.getProvStatus(),vnf.getProvStatus());
+ assertEquals(AAIVnf.getOrchestrationStatus().toString(),vnf.getOrchestrationStatus().toString());
+ assertEquals(AAIVnf.getModelCustomizationId(),vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ assertEquals(AAIVnf.getModelInvariantId(),vnf.getModelInfoGenericVnf().getModelInvariantUuid());
+ assertEquals(AAIVnf.getModelVersionId(),vnf.getModelInfoGenericVnf().getModelUuid());
+ assertEquals(AAIVnf.getModelVersionId(),vnf.getModelInfoGenericVnf().getModelUuid());
+ assertEquals(AAIVnf.getNfType(),vnf.getModelInfoGenericVnf().getNfType());
+ assertEquals(AAIVnf.getNfFunction(),vnf.getModelInfoGenericVnf().getNfFunction());
+ assertEquals(AAIVnf.getNfNamingCode(),vnf.getModelInfoGenericVnf().getNfNamingCode());
+ }
+
+ @Test
+ public void vfModuleMap() throws Exception {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("a");
+ vfModule.setVfModuleName("b");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelCustomizationUUID("f");
+ modelInfoVfModule.setModelInvariantUUID("g");
+ modelInfoVfModule.setModelUUID("h");
+ modelInfoVfModule.setIsBaseBoolean(false);
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleMap.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.VfModule reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ org.onap.aai.domain.yang.VfModule.class);
+
+ assertThat(reqMapper1, sameBeanAs(AAIVfModule));
+
+ }
+
+ @Test
+ public void testMapInstanceGroup() {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("test-id");
+ instanceGroup.setDescription("test-description");
+ instanceGroup.setInstanceGroupName("test-instanceGroupName");
+ instanceGroup.setResourceVersion("test-resourceVersion");
+
+
+ ModelInfoInstanceGroup model = new ModelInfoInstanceGroup();
+ model.setFunction("test-function");
+ model.setInstanceGroupRole("SUB-INTERFACE");
+ model.setType("VNFC");
+ model.setModelInvariantUUID("modelInvariantUUID-000");
+ model.setModelUUID("modelUUID-000");
+ model.setDescription("test-description");
+
+ instanceGroup.setModelInfoInstanceGroup(model);
+
+
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
+
+ try {
+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+ String json = mapper.writeValueAsString(aaiInstanceGroup);
+ System.out.println("GGG - json:\n" + json);
+
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ assertEquals(aaiInstanceGroup.getId(), instanceGroup.getId());
+ assertEquals(aaiInstanceGroup.getDescription(), instanceGroup.getDescription());
+ assertEquals(aaiInstanceGroup.getInstanceGroupRole(), instanceGroup.getModelInfoInstanceGroup().getInstanceGroupRole());
+ assertEquals(aaiInstanceGroup.getModelInvariantId(), instanceGroup.getModelInfoInstanceGroup().getModelInvariantUUID());
+ assertEquals(aaiInstanceGroup.getModelVersionId(), instanceGroup.getModelInfoInstanceGroup().getModelUUID());
+ assertEquals(aaiInstanceGroup.getResourceVersion(), instanceGroup.getResourceVersion());
+ assertEquals(aaiInstanceGroup.getInstanceGroupType(), instanceGroup.getModelInfoInstanceGroup().getType());
+ }
+
+ @Test
+ public void mapCustomerTest() {
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setSubscriberName("subscriberName");
+ customer.setSubscriberType("subscriberType");
+
+ org.onap.aai.domain.yang.Customer expectedCustomer = new org.onap.aai.domain.yang.Customer();
+ expectedCustomer.setGlobalCustomerId("globalCustomerId");
+ expectedCustomer.setSubscriberName("subscriberName");
+ expectedCustomer.setSubscriberType("subscriberType");
+
+ org.onap.aai.domain.yang.Customer actualCustomer = aaiObjectMapper.mapCustomer(customer);
+
+ assertThat(actualCustomer, sameBeanAs(expectedCustomer));
+ }
+
+ @Test
+ public void networkMap() throws Exception {
+ L3Network l3Network = new L3Network();
+ l3Network.setNetworkId("networkId");
+ l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ l3Network.setNetworkName("networkName");
+ l3Network.setNetworkRole("networkRole");
+ l3Network.setNetworkTechnology("networkTechnology");
+ l3Network.setNeutronNetworkId("neutronNetworkId");
+ l3Network.setNetworkRoleInstance(0L);
+ l3Network.setContrailNetworkFqdn("contrailNetworkFqdn");
+ l3Network.setIsBoundToVpn(false);
+ l3Network.setIsCascaded(false);
+ l3Network.setIsExternalNetwork(false);
+ l3Network.setHeatStackId("heatStackId");
+ l3Network.setOperationalStatus("operationalStatus");
+ l3Network.setPhysicalNetworkName("physicalNetworkName");
+ l3Network.setIsProviderNetwork(false);
+ l3Network.setSelflink("selflink");
+ l3Network.setServiceId("serviceId");
+
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
+ modelInfoNetwork.setModelInvariantUUID("modelInvariantUUID");
+ modelInfoNetwork.setModelUUID("modelUUID");
+
+ l3Network.setModelInfoNetwork(modelInfoNetwork);
+
+ org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(l3Network);
+
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.L3Network network = omapper.readValue(
+ getJson("aaiL3NetworkMapped.json"),
+ org.onap.aai.domain.yang.L3Network.class);
+
+ com.shazam.shazamcrest.MatcherAssert.assertThat(aaiL3Network, sameBeanAs(network));
+
+ }
+
+ @Test
+ public void mapCollectionTest() {
+ Collection networkCollection = new Collection();
+ networkCollection.setId("networkCollectionId");
+ ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
+ modelInfoCollection.setCollectionFunction("networkCollectionFunction");
+ modelInfoCollection.setCollectionRole("networkCollectionRole");
+ networkCollection.setModelInfoCollection(modelInfoCollection);
+ networkCollection.setName("networkCollectionName");
+
+ org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection();
+ expectedCollection.setCollectionId("networkCollectionId");
+ expectedCollection.setCollectionFunction("networkCollectionFunction");
+ expectedCollection.setCollectionRole("networkCollectionRole");
+ expectedCollection.setCollectionName("networkCollectionName");
+
+ org.onap.aai.domain.yang.Collection actualCollection = aaiObjectMapper.mapCollection(networkCollection);
+
+ assertThat(actualCollection, sameBeanAs(expectedCollection));
+ }
+
+ /*
+ * Helper method to load JSON data
+ */
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename)));
+ }
+
+ @Test
+ public void mapNetworkTest() throws Exception {
+ L3Network l3Network = new L3Network();
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ modelInfoNetwork.setModelCustomizationUUID("modelCustomization_id");
+ modelInfoNetwork.setModelInvariantUUID("modelInvariant_id");
+ modelInfoNetwork.setModelUUID("modelCustomization_id");
+ modelInfoNetwork.setNetworkType("CONTRAIL_EXTERNAL");
+ modelInfoNetwork.setNetworkRole("dmz_direct");
+ modelInfoNetwork.setNetworkTechnology("contrail");
+ l3Network.setModelInfoNetwork(modelInfoNetwork);
+ l3Network.setNetworkId("TESTING_ID");
+ l3Network.setNetworkName("TESTING_NAME");
+ l3Network.setIsBoundToVpn(true);
+ l3Network.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ l3Network.setNetworkRoleInstance(1L);
+ l3Network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ l3Network.setHeatStackId("heatStack_id");
+ l3Network.setContrailNetworkFqdn("contrailNetwork_fqdn");
+ l3Network.setWidgetModelId("widgetModel_id");
+ l3Network.setWidgetModelVersion("widgetModel_version");
+ l3Network.setPhysicalNetworkName("physicalNetwork_name");
+ l3Network.setIsProviderNetwork(true);
+ l3Network.setIsSharedNetwork(false);
+ l3Network.setIsExternalNetwork(false);
+ l3Network.setSelflink("self_link");
+ l3Network.setOperationalStatus("operationalStatus");
+
+ List<Subnet> subnets = new ArrayList<Subnet>();
+ Subnet subnet1 = new Subnet();
+ subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc");
+ subnet1.setSubnetName("subnetName");
+ subnet1.setGatewayAddress("192.168.52.1");
+ subnet1.setNetworkStartAddress("192.168.52.0");
+ subnet1.setCidrMask("24");
+ subnet1.setIpVersion("4");
+ subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ subnet1.setIpAssignmentDirection("true");
+ subnet1.setDhcpEnabled(true);
+ subnet1.setDhcpStart("dhcpStart");
+ subnet1.setDhcpEnd("dhcpEnd");
+ subnet1.setSubnetRole("subnetRole");
+ subnet1.setIpAssignmentDirection("true");
+ subnet1.setSubnetSequence(new Integer(3));
+
+ List<HostRoute> hostRoutes = new ArrayList<HostRoute>();
+ HostRoute hostRoute1 = new HostRoute();
+ hostRoute1.setHostRouteId("string");
+ hostRoute1.setRoutePrefix("192.10.16.0/24");
+ hostRoute1.setNextHop("192.10.16.100/24");
+ hostRoute1.setNextHopType("ip-address");
+ HostRoute hostRoute2 = new HostRoute();
+ hostRoute2.setHostRouteId("string");
+ hostRoute2.setRoutePrefix("192.110.17.0/24");
+ hostRoute2.setNextHop("192.110.17.110/24");
+ hostRoute2.setNextHopType("ip-address");
+ hostRoutes.add(hostRoute1);
+ hostRoutes.add(hostRoute2);
+ subnet1.getHostRoutes().addAll(hostRoutes);
+
+ subnets.add(subnet1);
+ subnets.add(subnet1);
+ l3Network.getSubnets().addAll(subnets);
+
+ List<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
+ CtagAssignment ctagAssignment1 = new CtagAssignment();
+ ctagAssignment1.setVlanIdInner(1L);
+ ctagAssignments.add(ctagAssignment1);
+ l3Network.getCtagAssignments().addAll(ctagAssignments);
+
+ List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
+ SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment();
+ segmentationAssignment1.setSegmentationId("segmentationId1");
+ SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment();
+ segmentationAssignment2.setSegmentationId("segmentationId2");
+ segmentationAssignments.add(segmentationAssignment1);
+ segmentationAssignments.add(segmentationAssignment2);
+ l3Network.getSegmentationAssignments().addAll(segmentationAssignments);
+
+ AAIObjectMapper l3NetworkMapper = new AAIObjectMapper();
+ org.onap.aai.domain.yang.L3Network v12L3Network = l3NetworkMapper.mapNetwork(l3Network);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiL3NetworkMapped_to_aai.json")));
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.L3Network network = omapper.readValue(jsonToCompare,
+ org.onap.aai.domain.yang.L3Network.class);
+
+ ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+ String jsonGenerated = ow.writeValueAsString(v12L3Network);
+ String jsonExpected = ow.writeValueAsString(network);
+ assertEquals(jsonExpected, jsonGenerated);
+
+ }
+
+ @Test
+ public void mapToAAISubNetsTest() throws Exception {
+ List<Subnet> subnets = new ArrayList<Subnet>();
+ Subnet subnet1 = new Subnet();
+ subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc");
+ subnet1.setSubnetName("subnetName");
+ subnet1.setGatewayAddress("192.168.52.1");
+ subnet1.setNetworkStartAddress("192.168.52.0");
+ subnet1.setCidrMask("24");
+ subnet1.setIpVersion("4");
+ subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ subnet1.setIpAssignmentDirection("true");
+ subnet1.setDhcpEnabled(true);
+ subnet1.setDhcpStart("dhcpStart");
+ subnet1.setDhcpEnd("dhcpEnd");
+ subnet1.setSubnetRole("subnetRole");
+ subnet1.setIpAssignmentDirection("true");
+ subnet1.setSubnetSequence(new Integer(3));
+
+ List<HostRoute> hostRoutes = new ArrayList<HostRoute>();
+ HostRoute hostRoute1 = new HostRoute();
+ hostRoute1.setHostRouteId("string");
+ hostRoute1.setRoutePrefix("192.10.16.0/24");
+ hostRoute1.setNextHop("192.10.16.100/24");
+ hostRoute1.setNextHopType("ip-address");
+ HostRoute hostRoute2 = new HostRoute();
+ hostRoute2.setHostRouteId("string");
+ hostRoute2.setRoutePrefix("192.110.17.0/24");
+ hostRoute2.setNextHop("192.110.17.110/24");
+ hostRoute2.setNextHopType("ip-address");
+ hostRoutes.add(hostRoute1);
+ hostRoutes.add(hostRoute2);
+ subnet1.getHostRoutes().addAll(hostRoutes);
+
+ subnets.add(subnet1);
+ subnets.add(subnet1);
+
+ AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
+ org.onap.aai.domain.yang.Subnets v12Subnets = aaiObjectMapper.mapToAAISubNets(subnets);
+
+ assertEquals(subnets.get(0).getDhcpEnd(), v12Subnets.getSubnet().get(0).getDhcpEnd());
+ assertEquals(subnets.get(0).getCidrMask(), v12Subnets.getSubnet().get(0).getCidrMask());
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json")));
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.Subnets subnet = omapper.readValue(jsonToCompare,
+ org.onap.aai.domain.yang.Subnets.class);
+ ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+ String jsonGenerated = ow.writeValueAsString(v12Subnets);
+ String jsonExpected = ow.writeValueAsString(subnet);
+ assertEquals(jsonExpected, jsonGenerated);
+ }
+
+ @Test
+ public void mapToAAICtagAssignmentListTest() throws Exception {
+ List<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
+ CtagAssignment ctagAssignment1 = new CtagAssignment();
+ ctagAssignment1.setVlanIdInner(1L);
+ ctagAssignments.add(ctagAssignment1);
+
+ AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
+ org.onap.aai.domain.yang.CtagAssignments v12CtagAssingments = aaiObjectMapper.mapToAAICtagAssignmentList(ctagAssignments);
+
+ assertEquals(ctagAssignments.get(0).getVlanIdInner(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner());
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiCtagAssingmentsMapped_to_aai.json")));
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.CtagAssignments ctagAssignment = omapper.readValue(jsonToCompare,
+ org.onap.aai.domain.yang.CtagAssignments.class);
+ ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+ String jsonGenerated = ow.writeValueAsString(v12CtagAssingments);
+ String jsonExpected = ow.writeValueAsString(ctagAssignment);
+ assertEquals(jsonExpected, jsonGenerated);
+ }
+
+ @Test
+ public void mapToAAISegmentationAssignmentListTest() throws Exception {
+ List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
+ SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment();
+ segmentationAssignment1.setSegmentationId("segmentationId1");
+ SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment();
+ segmentationAssignment2.setSegmentationId("segmentationId2");
+ segmentationAssignments.add(segmentationAssignment1);
+ segmentationAssignments.add(segmentationAssignment2);
+
+ AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
+ org.onap.aai.domain.yang.SegmentationAssignments v12SegmentationAssignments = aaiObjectMapper.mapToAAISegmentationAssignmentList(segmentationAssignments);
+
+ assertEquals(segmentationAssignments.get(0).getSegmentationId(), v12SegmentationAssignments.getSegmentationAssignment().get(0).getSegmentationId());
+ assertEquals(segmentationAssignments.get(1).getSegmentationId(), v12SegmentationAssignments.getSegmentationAssignment().get(1).getSegmentationId());
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSegmentationAssignmentsMapped_to_aai.json")));
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.SegmentationAssignments segmentationAssignment = omapper.readValue(jsonToCompare,
+ org.onap.aai.domain.yang.SegmentationAssignments.class);
+ ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+ String jsonGenerated = ow.writeValueAsString(v12SegmentationAssignments);
+ String jsonExpected = ow.writeValueAsString(segmentationAssignment);
+ assertEquals(jsonExpected, jsonGenerated);
+
+ }
+
+ @Test
+ public void mapVpnBindingTest() {
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setVpnId("testVpnId");
+ vpnBinding.setVpnName("testVpn");
+ vpnBinding.setVpnPlatform("AVPN");
+ vpnBinding.setCustomerVpnId("testCustomerVpnId");
+ vpnBinding.setVpnType("testVpnType");
+ vpnBinding.setVpnRegion("testVpnRegion");
+ vpnBinding.setRouteDistinguisher("testRD");
+ RouteTarget routeTarget = new RouteTarget();
+ routeTarget.setRouteTargetRole("testRtRole");
+ routeTarget.setGlobalRouteTarget("testGrt");
+ vpnBinding.getRouteTargets().add(routeTarget);
+
+
+ org.onap.aai.domain.yang.VpnBinding expectedVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
+ expectedVpnBinding.setVpnId("testVpnId");
+ expectedVpnBinding.setVpnName("testVpn");
+ expectedVpnBinding.setVpnPlatform("AVPN");
+ expectedVpnBinding.setCustomerVpnId("testCustomerVpnId");
+ expectedVpnBinding.setVpnType("testVpnType");
+ expectedVpnBinding.setVpnRegion("testVpnRegion");
+ expectedVpnBinding.setRouteDistinguisher("testRD");
+
+ org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget();
+ expectedRouteTarget.setRouteTargetRole("testRtRole");
+ expectedRouteTarget.setGlobalRouteTarget("testGrt");
+
+ RouteTargets expectedRouteTargets = new RouteTargets();
+ expectedRouteTargets.getRouteTarget().add(expectedRouteTarget);
+
+ expectedVpnBinding.setRouteTargets(expectedRouteTargets);
+
+ org.onap.aai.domain.yang.VpnBinding actualVpnBinding = aaiObjectMapper.mapVpnBinding(vpnBinding);
+
+ assertThat(actualVpnBinding, sameBeanAs(expectedVpnBinding));
+ }
+
+ @Test
+ public void mapRouteTargetTest() {
+ RouteTarget routeTarget = new RouteTarget();
+ routeTarget.setRouteTargetRole("testRtRole");
+ routeTarget.setGlobalRouteTarget("testGrt");
+
+ org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget();
+ expectedRouteTarget.setRouteTargetRole("testRtRole");
+ expectedRouteTarget.setGlobalRouteTarget("testGrt");
+
+ org.onap.aai.domain.yang.RouteTarget actualRouteTarget = aaiObjectMapper.mapRouteTarget(routeTarget);
+
+ assertThat(actualRouteTarget, sameBeanAs(expectedRouteTarget));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
new file mode 100644
index 0000000000..207b9f3f98
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.network;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.adapters.nwrest.CreateNetworkError;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkError;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.QueryNetworkError;
+import org.onap.so.adapters.nwrest.QueryNetworkResponse;
+import org.onap.so.adapters.nwrest.RollbackNetworkError;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkError;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.openstack.beans.NetworkRollback;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
+public class NetworkAdapterClientIT extends BaseTest{
+
+ private static final String TESTING_ID = "___TESTING___";
+ private static final String AAI_NETWORK_ID = "test";
+ private static final String REST_ENDPOINT = "/networks/rest/v1/networks";
+
+ private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl();
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void createNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
+ CreateNetworkRequest request = new CreateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateNetworkResponse mockResponse = new CreateNetworkResponse();
+ mockResponse.setNetworkCreated(true);
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ CreateNetworkResponse response = client.createNetwork(request);
+ assertEquals("Testing CreateVfModule response", true, response.getNetworkCreated());
+ }
+
+ @Test(expected = NetworkAdapterClientException.class)
+ public void createNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException {
+ CreateNetworkRequest request = new CreateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateNetworkError mockResponse = new CreateNetworkError();
+ mockResponse.setMessage("Error in create network");
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.createNetwork(request);
+ }
+
+ @Test
+ public void deleteNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
+ DeleteNetworkRequest request = new DeleteNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteNetworkResponse mockResponse = new DeleteNetworkResponse();
+ mockResponse.setNetworkDeleted(true);
+
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ DeleteNetworkResponse response = client.deleteNetwork(AAI_NETWORK_ID, request);
+ assertEquals("Testing DeleteVfModule response", true, response.getNetworkDeleted());
+ }
+
+ @Test(expected = NetworkAdapterClientException.class)
+ public void deleteNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException {
+ DeleteNetworkRequest request = new DeleteNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteNetworkError mockResponse = new DeleteNetworkError();
+ mockResponse.setMessage("Error in delete network");
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.deleteNetwork(AAI_NETWORK_ID, request);
+ }
+
+ @Test
+ public void rollbackNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
+ RollbackNetworkRequest request = new RollbackNetworkRequest();
+ NetworkRollback rollback = new NetworkRollback();
+ rollback.setCloudId(TESTING_ID);
+ request.setNetworkRollback(rollback);
+
+ RollbackNetworkResponse mockResponse = new RollbackNetworkResponse();
+ mockResponse.setNetworkRolledBack(true);
+
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request);
+ assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack());
+ }
+
+ @Test(expected = NetworkAdapterClientException.class)
+ public void rollbackNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException {
+ RollbackNetworkRequest request = new RollbackNetworkRequest();
+ NetworkRollback rollback = new NetworkRollback();
+ rollback.setCloudId(TESTING_ID);
+ request.setNetworkRollback(rollback);
+
+ RollbackNetworkError mockResponse = new RollbackNetworkError();
+ mockResponse.setMessage("Error in rollback network");
+
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.rollbackNetwork(AAI_NETWORK_ID, request);
+ }
+
+ @Test
+ public void queryNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
+ QueryNetworkResponse mockResponse = new QueryNetworkResponse();
+ mockResponse.setNetworkExists(true);
+
+ stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID))
+ .withQueryParam("tenantId", equalTo(TESTING_ID))
+ .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true"))
+ .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
+ .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId",
+ true, "testRequestId", "serviceInstanceId");
+ assertEquals("Testing QueryVfModule response", true, response.getNetworkExists());
+ }
+
+ @Test(expected = NetworkAdapterClientException.class)
+ public void queryNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException {
+ QueryNetworkError mockResponse = new QueryNetworkError();
+ mockResponse.setMessage("Error in query network");
+
+ stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID))
+ .withQueryParam("tenantId", equalTo(TESTING_ID))
+ .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true"))
+ .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
+ .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId",
+ true, "testRequestId", "serviceInstanceId");
+ }
+
+ @Test
+ public void updateNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
+ UpdateNetworkRequest request = new UpdateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setNetworkId("test1");
+
+ UpdateNetworkResponse mockResponse = new UpdateNetworkResponse();
+ mockResponse.setNetworkId("test1");
+ stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ UpdateNetworkResponse response = client.updateNetwork(AAI_NETWORK_ID, request);
+ assertEquals("Testing UpdateVfModule response", "test1", response.getNetworkId());
+ }
+
+ @Test(expected = NetworkAdapterClientException.class)
+ public void updateNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException {
+ UpdateNetworkRequest request = new UpdateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setNetworkId("test1");
+
+ UpdateNetworkError mockResponse = new UpdateNetworkError();
+ mockResponse.setMessage("Error in update network");
+ stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.updateNetwork(AAI_NETWORK_ID, request);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
new file mode 100644
index 0000000000..96fbe7ffb7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -0,0 +1,301 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.network.mapper;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.Mockito.doReturn;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.so.adapters.nwrest.ContrailNetwork;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.NetworkRollback;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class NetworkAdapterObjectMapperTest extends TestDataSetup{
+
+ private NetworkAdapterObjectMapper SPY_networkAdapterObjectMapper = Mockito.spy(NetworkAdapterObjectMapper.class);
+
+ private L3Network l3Network;
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private Customer customer;
+ Map<String, String> userInput;
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/NetworkMapper/";
+
+ @Before
+ public void before() {
+ requestContext = setRequestContext();
+
+ customer = buildCustomer();
+
+ serviceInstance = setServiceInstance();
+
+ cloudRegion = setCloudRegion();
+
+ orchestrationContext = setOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ userInput = setUserInput();
+
+ l3Network = setL3Network();
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ }
+
+ @Test
+ public void buildCreateNetworkRequestFromBbobjectTest() throws Exception {
+
+ String cloudRegionPo = "cloudRegionPo";
+ CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest();
+
+ expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo);
+ expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId());
+ expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId());
+ expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName());
+ expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType());
+ expectedCreateNetworkRequest.setBackout(false);
+ expectedCreateNetworkRequest.setFailIfExists(true);
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedCreateNetworkRequest.setMsoRequest(msoRequest);
+ expectedCreateNetworkRequest.setSkipAAI(true);
+
+ Subnet openstackSubnet = new Subnet();
+ HostRoute hostRoute = new HostRoute();
+ hostRoute.setHostRouteId("hostRouteId");
+ hostRoute.setNextHop("nextHop");
+ hostRoute.setRoutePrefix("routePrefix");
+ openstackSubnet.getHostRoutes().add(hostRoute);
+ List<Subnet> subnetList = new ArrayList<Subnet>();
+ subnetList.add(openstackSubnet);
+ l3Network.getSubnets().add(openstackSubnet);
+
+ CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
+
+ assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId"));
+ }
+
+ @Test
+ public void createNetworkRollbackRequestMapperTest() throws Exception {
+
+ String cloudRegionPo = "cloudRegionPo";
+ RollbackNetworkRequest expectedRollbackNetworkRequest = new RollbackNetworkRequest();
+
+ expectedRollbackNetworkRequest.setMessageId(requestContext.getMsoRequestId());
+ NetworkRollback networkRollback = new NetworkRollback();
+ networkRollback.setCloudId(cloudRegionPo);
+ networkRollback.setNetworkCreated(true);
+ networkRollback.setNetworkId(l3Network.getNetworkId());
+ networkRollback.setNetworkType(l3Network.getNetworkType());
+ networkRollback.setTenantId(cloudRegion.getTenantId());
+ expectedRollbackNetworkRequest.setNetworkRollback(networkRollback);
+ expectedRollbackNetworkRequest.setSkipAAI(true);
+
+ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
+ createNetworkResponse.setNetworkCreated(true);
+
+ RollbackNetworkRequest rollbackNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
+
+ assertThat(rollbackNetworkRequest, sameBeanAs(expectedRollbackNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId"));
+ }
+
+ @Test
+ public void updateNetworkRequestMapperTest() throws UnsupportedEncodingException {
+ org.onap.so.openstack.beans.Subnet subnet = new org.onap.so.openstack.beans.Subnet();
+ subnet.setSubnetId("subnetId");
+ subnet.setHostRoutes(new ArrayList<org.onap.so.openstack.beans.HostRoute>());
+
+ List<org.onap.so.openstack.beans.Subnet> subnets = new ArrayList<>();
+ subnets.add(subnet);
+
+ ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("physicalNetworkName", new ArrayList<Integer>());
+
+ List<String> policyFqdns = Arrays.asList("networkPolicyFqdn");
+
+ org.onap.so.openstack.beans.RouteTarget expectedRouteTarget = new org.onap.so.openstack.beans.RouteTarget();
+ expectedRouteTarget.setRouteTarget("globalRouteTarget");
+
+ ContrailNetwork contrailNetwork = new ContrailNetwork();
+ contrailNetwork.setPolicyFqdns(policyFqdns);
+ contrailNetwork.setRouteTableFqdns(new ArrayList<String>());
+ contrailNetwork.setRouteTargets(new ArrayList<org.onap.so.openstack.beans.RouteTarget>());
+ contrailNetwork.getRouteTargets().add(expectedRouteTarget);
+ contrailNetwork.getRouteTableFqdns().add("routeTableReferenceFqdn");
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setServiceInstanceId("testServiceInstanceId1");
+
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ modelInfoNetwork.setNetworkType("networkType");
+ modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
+ modelInfoNetwork.setModelVersion("modelVersion");
+
+ Subnet actualSubnet = new Subnet();
+ actualSubnet.setSubnetId("subnetId");
+ actualSubnet.setIpVersion("4");
+
+ RouteTarget routeTarget = new RouteTarget();
+ routeTarget.setGlobalRouteTarget("globalRouteTarget");
+
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setVpnId("vpnId");
+ vpnBinding.getRouteTargets().add(routeTarget);
+
+ Customer customer = new Customer();
+ customer.getVpnBindings().add(vpnBinding);
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ customer.setServiceSubscription(serviceSubscription);
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId("networkPolicyId");
+ networkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn");
+
+ RouteTableReference routeTableReference = new RouteTableReference();
+ routeTableReference.setRouteTableReferenceFqdn("routeTableReferenceFqdn");
+
+ l3Network.setModelInfoNetwork(modelInfoNetwork);
+ l3Network.setPhysicalNetworkName("physicalNetworkName");
+ l3Network.getSubnets().add(actualSubnet);
+ l3Network.getNetworkPolicies().add(networkPolicy);
+ l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference);
+
+ UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest();
+ expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ expectedUpdateNetworkRequest.setTenantId(cloudRegion.getTenantId());
+ expectedUpdateNetworkRequest.setNetworkId(l3Network.getNetworkId());
+ expectedUpdateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ expectedUpdateNetworkRequest.setNetworkName(l3Network.getNetworkName());
+ expectedUpdateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType());
+ expectedUpdateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion());
+ expectedUpdateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID());
+ expectedUpdateNetworkRequest.setSubnets(subnets);
+ expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
+ expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork);
+ expectedUpdateNetworkRequest.setNetworkParams(userInput);
+ expectedUpdateNetworkRequest.setMsoRequest(msoRequest);
+ expectedUpdateNetworkRequest.setSkipAAI(true);
+ expectedUpdateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled()));
+ expectedUpdateNetworkRequest.setMessageId("messageId");
+ expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId");
+
+ doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
+ doReturn("http://localhost:28080/mso/WorkflowMesssage").when(SPY_networkAdapterObjectMapper).getEndpoint();
+ UpdateNetworkRequest actualUpdateNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
+
+ assertThat(actualUpdateNetworkRequest, sameBeanAs(expectedUpdateNetworkRequest).ignoring("msoRequest.requestId"));
+ }
+
+ @Test
+ public void deleteNetworkRequestMapperTest() throws Exception {
+ DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest();
+
+ String messageId = "messageId";
+ expectedDeleteNetworkRequest.setMessageId(messageId);
+ doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid();
+
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ l3Network.setModelInfoNetwork(modelInfoNetwork);
+ modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
+ expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedDeleteNetworkRequest.setMsoRequest(msoRequest);
+
+ expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId());
+
+ l3Network.setHeatStackId("heatStackId");
+ expectedDeleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+
+ expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
+
+ expectedDeleteNetworkRequest.setSkipAAI(true);
+
+ expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+
+ expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+
+ assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest));
+ }
+
+ @Test
+ public void buildOpenstackSubnetListTest() throws Exception {
+
+ ObjectMapper omapper = new ObjectMapper();
+ String bbJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "generalBB.json")));
+ org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock gbb = omapper.readValue(
+ bbJson,
+ org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock.class);
+ L3Network myNetwork = gbb.getServiceInstance().getNetworks().get(0);
+
+ String expectedCreateNetworkRequestJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "createNetworkRequest.json")));
+ org.onap.so.adapters.nwrest.CreateNetworkRequest expectedCreateNetworkRequest = omapper.readValue(
+ expectedCreateNetworkRequestJson,
+ org.onap.so.adapters.nwrest.CreateNetworkRequest.class);
+
+ String cloudRegionPo = "cloudRegionPo";
+ CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, myNetwork, userInput, cloudRegionPo, customer);
+ //ignoring dynamic fields and networkParams that throws parsing exception on json file load
+ assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId").ignoring("msoRequest.requestId").ignoring("networkParams"));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
new file mode 100644
index 0000000000..85f787faa7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
@@ -0,0 +1,224 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
+import org.onap.so.adapters.vnfrest.VfModuleRollback;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class VnfAdapterClientIT extends BaseTest{
+
+ private static final String TESTING_ID = "___TESTING___";
+ private static final String AAI_VNF_ID = "test";
+ private static final String AAI_VF_MODULE_ID = "test";
+ private static final String REST_ENDPOINT = "/services/rest/v1/vnfs";
+
+ private VnfAdapterClientImpl client = new VnfAdapterClientImpl();
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void createVfModuleTest() throws JsonProcessingException, VnfAdapterClientException {
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateVfModuleResponse mockResponse = new CreateVfModuleResponse();
+ mockResponse.setVfModuleCreated(true);
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ CreateVfModuleResponse response = client.createVfModule(AAI_VNF_ID, request);
+ assertEquals("Testing CreateVfModule response", true, response.getVfModuleCreated());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void createVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
+ mockResponse.setMessage("Error in create Vf module");
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.createVfModule(AAI_VNF_ID, request);
+ }
+
+ @Test
+ public void rollbackVfModuleTest() throws JsonProcessingException, VnfAdapterClientException {
+ RollbackVfModuleRequest request = new RollbackVfModuleRequest();
+ VfModuleRollback rollback = new VfModuleRollback();
+ rollback.setCloudSiteId(TESTING_ID);
+ request.setVfModuleRollback(rollback);
+
+ RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse();
+ mockResponse.setVfModuleRolledback(true);
+ stubFor(
+ post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ RollbackVfModuleResponse response = client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ assertEquals("Testing RollbackVfModule response", true, response.getVfModuleRolledback());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void rollbackVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
+ RollbackVfModuleRequest request = new RollbackVfModuleRequest();
+ VfModuleRollback rollback = new VfModuleRollback();
+ rollback.setCloudSiteId(TESTING_ID);
+ request.setVfModuleRollback(rollback);
+
+ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
+ mockResponse.setMessage("Error in rollback Vf module");
+ stubFor(
+ post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ }
+
+ @Test
+ public void deleteVfModuleTest() throws JsonProcessingException, VnfAdapterClientException {
+ DeleteVfModuleRequest request = new DeleteVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse();
+ mockResponse.setVfModuleDeleted(true);
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ DeleteVfModuleResponse response = client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ assertEquals("Testing DeleteVfModule response", true, response.getVfModuleDeleted());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void deleteVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
+ DeleteVfModuleRequest request = new DeleteVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
+ mockResponse.setMessage("Error in delete Vf module");
+ stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ }
+
+ @Test
+ public void updateVfModuleTest() throws JsonProcessingException, VnfAdapterClientException {
+ UpdateVfModuleRequest request = new UpdateVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setVfModuleId("test1");
+
+ UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse();
+ mockResponse.setVfModuleId("test1");
+ stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+
+ UpdateVfModuleResponse response = client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ assertEquals("Testing UpdateVfModule response", "test1", response.getVfModuleId());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void updateVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
+ UpdateVfModuleRequest request = new UpdateVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setVfModuleId("test1");
+
+ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
+ mockResponse.setMessage("Error in update Vf module");
+ stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+
+ client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ }
+
+ @Test
+ public void queryVfModuleTest() throws JsonProcessingException, VnfAdapterClientException {
+ QueryVfModuleResponse mockResponse = new QueryVfModuleResponse();
+ mockResponse.setVnfId(AAI_VNF_ID);
+ mockResponse.setVfModuleId(AAI_VF_MODULE_ID);
+ stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .withQueryParam("cloudSiteId", equalTo(TESTING_ID))
+ .withQueryParam("tenantId", equalTo(TESTING_ID))
+ .withQueryParam("vfModuleName", equalTo("someName"))
+ .withQueryParam("skipAAI", equalTo("true"))
+ .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
+ .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
+ QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID,
+ "someName", true, "testRequestId", "serviceInstanceId");
+ assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void queryVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
+ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
+ mockResponse.setMessage("Error in update Vf module");
+ stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .withQueryParam("cloudSiteId", equalTo(TESTING_ID))
+ .withQueryParam("tenantId", equalTo(TESTING_ID))
+ .withQueryParam("vfModuleName", equalTo("someName"))
+ .withQueryParam("skipAAI", equalTo("true"))
+ .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
+ .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
+ client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID,
+ "someName", true, "testRequestId", "serviceInstanceId");
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java
new file mode 100644
index 0000000000..b356b21de4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java
@@ -0,0 +1,214 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.core.UriBuilder;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.BaseTest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
+import org.onap.so.client.adapter.rest.AdapterRestClient;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfVolumeAdapterClientIT extends BaseTest{
+
+ private static final String TESTING_ID = "___TESTING___";
+ private static final String AAI_VOLUME_GROUP_ID = "test";
+ private static final String CLOUD_SITE_ID = "test";
+ private static final String TENANT_ID = "test";
+ private static final String VOLUME_GROUP_STACK_ID = "test";
+ private static final boolean SKIP_AAI = true;
+ private static final String REQUEST_ID = "test";
+ private static final String SERVICE_INSTANCE_ID = "test";
+
+ @Test
+ public void createVolumeGroupTest() throws VnfAdapterClientException {
+ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateVolumeGroupResponse mockResponse = new CreateVolumeGroupResponse();
+ mockResponse.setVolumeGroupCreated(true);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+
+ doReturn(mockClient).when(client).getAdapterRestClient("");
+ when(mockClient.post(request, CreateVolumeGroupResponse.class)).thenReturn(mockResponse);
+
+ CreateVolumeGroupResponse response = client.createVNFVolumes(request);
+ assertEquals("Testing CreateVolumeGroup response", mockResponse.getVolumeGroupCreated(),
+ response.getVolumeGroupCreated());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void createVolumeGroupTestThrowException() throws VnfAdapterClientException {
+ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateVolumeGroupResponse mockResponse = new CreateVolumeGroupResponse();
+ mockResponse.setVolumeGroupCreated(true);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+
+ doReturn(mockClient).when(client).getAdapterRestClient("");
+ when(mockClient.post(request, CreateVolumeGroupResponse.class)).thenThrow(new InternalServerErrorException("Error in create volume group"));
+
+ client.createVNFVolumes(request);
+ }
+
+ @Test
+ public void deleteVolumeGroupTest() throws VnfAdapterClientException {
+ DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteVolumeGroupResponse mockResponse = new DeleteVolumeGroupResponse();
+ mockResponse.setVolumeGroupDeleted(true);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+ doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID);
+ when(mockClient.delete(request, DeleteVolumeGroupResponse.class)).thenReturn(mockResponse);
+ MockitoAnnotations.initMocks(this);
+
+ DeleteVolumeGroupResponse response = client.deleteVNFVolumes(AAI_VOLUME_GROUP_ID, request);
+ assertEquals("Testing DeleteVolumeGroup response", mockResponse.getVolumeGroupDeleted(),
+ response.getVolumeGroupDeleted());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void deleteVolumeGroupTestThrowException() throws VnfAdapterClientException {
+ DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteVolumeGroupResponse mockResponse = new DeleteVolumeGroupResponse();
+ mockResponse.setVolumeGroupDeleted(true);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+ doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID);
+ when(mockClient.delete(request, DeleteVolumeGroupResponse.class))
+ .thenThrow(new InternalServerErrorException("Error in delete volume group"));
+ MockitoAnnotations.initMocks(this);
+
+ client.deleteVNFVolumes(AAI_VOLUME_GROUP_ID, request);
+ }
+
+ @Test
+ public void rollbackVolumeGroupTest() throws VnfAdapterClientException {
+ RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest();
+
+ RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse();
+ mockResponse.setVolumeGroupRolledBack(true);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+ doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback");
+ when(mockClient.delete(request, RollbackVolumeGroupResponse.class)).thenReturn(mockResponse);
+ MockitoAnnotations.initMocks(this);
+
+ RollbackVolumeGroupResponse response = client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request);
+ assertEquals("Testing RollbackVolumeGroup response", mockResponse.getVolumeGroupRolledBack(),
+ response.getVolumeGroupRolledBack());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void rollbackVolumeGroupTestThrowException() throws VnfAdapterClientException {
+ RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest();
+
+ RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse();
+ mockResponse.setVolumeGroupRolledBack(true);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+ doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback");
+ when(mockClient.delete(request, RollbackVolumeGroupResponse.class))
+ .thenThrow(new InternalServerErrorException("Error in rollback volume group"));
+ MockitoAnnotations.initMocks(this);
+
+ client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request);
+ }
+
+ @Test
+ public void updateVolumeGroupTest() throws VnfAdapterClientException {
+ UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest();
+
+ UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse();
+ mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+ doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID);
+ when(mockClient.put(request, UpdateVolumeGroupResponse.class)).thenReturn(mockResponse);
+ MockitoAnnotations.initMocks(this);
+
+ UpdateVolumeGroupResponse response = client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request);
+ assertEquals("Testing DeleteVfModule response", mockResponse.getVolumeGroupId(), response.getVolumeGroupId());
+ }
+
+ @Test(expected = VnfAdapterClientException.class)
+ public void updateVolumeGroupTestThrowException() throws VnfAdapterClientException {
+ UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest();
+
+ UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse();
+ mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID);
+
+ VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
+ AdapterRestClient mockClient = mock(AdapterRestClient.class);
+ doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID);
+ when(mockClient.put(request, UpdateVolumeGroupResponse.class))
+ .thenThrow(new InternalServerErrorException("Error in update volume group"));
+ MockitoAnnotations.initMocks(this);
+
+ client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request);
+ }
+
+ public void buildQueryPathTest() {
+ String expectedOutput = "/" + AAI_VOLUME_GROUP_ID + "?cloudSiteId=" + CLOUD_SITE_ID + "&tenantId=" + TENANT_ID
+ + "&volumeGroupStackId=" + VOLUME_GROUP_STACK_ID + "&skipAAI=" + SKIP_AAI + "&msoRequest.requestId="
+ + REQUEST_ID + "&msoRequest.serviceInstanceId=" + SERVICE_INSTANCE_ID;
+ VnfVolumeAdapterClientImpl client = new VnfVolumeAdapterClientImpl();
+ assertEquals("Test build query path", expectedOutput, client.buildQueryPath(AAI_VOLUME_GROUP_ID, CLOUD_SITE_ID,
+ TENANT_ID, VOLUME_GROUP_STACK_ID, SKIP_AAI, REQUEST_ID, SERVICE_INSTANCE_ID));
+ }
+
+ protected UriBuilder getUri(String path) {
+ return UriBuilder.fromPath(path);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java
new file mode 100644
index 0000000000..df48596893
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.MalformedURLException;
+
+import org.junit.Test;
+
+public class VnfVolumeAdapterRestPropertiesTest{
+ private VnfVolumeAdapterRestProperties props = new VnfVolumeAdapterRestProperties();
+
+ @Test
+ public void testGetAuth(){
+ assertEquals("mso.adapters.po.auth", VnfVolumeAdapterRestProperties.authProp);
+ }
+
+ @Test
+ public void testGetKey(){
+ assertEquals("mso.msoKey", VnfVolumeAdapterRestProperties.keyProp);
+ }
+
+ @Test
+ public void testGetUrl() throws MalformedURLException{
+ assertEquals("mso.adapters.volume-groups.rest.endpoint", VnfVolumeAdapterRestProperties.endpointProp);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
new file mode 100644
index 0000000000..25149aea13
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -0,0 +1,372 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf.mapper;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.reset;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.entity.MsoRequest;
+
+public class VnfAdapterObjectMapperTest {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+ @Spy
+ private VnfAdapterObjectMapper vnfAdapterObjectMapper = new VnfAdapterObjectMapper();
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+
+ }
+
+ @After
+ public void after() {
+ reset(vnfAdapterObjectMapper);
+ }
+
+ @Test
+ public void test_createVolumeGroupRequestMapper() throws Exception {
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("msoRequestId");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelVersion("modelVersion");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ genericVnf.setVnfName("vnfName");
+ genericVnf.setVnfType("vnfType");
+ serviceInstance.getVnfs().add(genericVnf);
+
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelName("modelName");
+ modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID");
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ volumeGroup.setModelInfoVfModule(modelInfoVfModule);
+
+ serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup);
+
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest();
+
+ expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
+ expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName());
+ expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType());
+ expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
+ expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
+
+ Map<String, String> volumeGroupParams = new HashMap<>();
+ volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
+ volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
+ volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
+ volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
+ volumeGroupParams.put("paramOne", "paramOneValue");
+ volumeGroupParams.put("paramTwo", "paramTwoValue");
+ volumeGroupParams.put("paramThree", "paramThreeValue");
+ expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams);
+
+ expectedCreateVolumeGroupRequest.setSkipAAI(true);
+ expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled());
+ expectedCreateVolumeGroupRequest.setFailIfExists(true);
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest);
+
+ expectedCreateVolumeGroupRequest.setMessageId("messageId");
+ expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId");
+
+ doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class));
+ doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid();
+
+ CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+
+ assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest));
+ }
+
+ @Test
+ public void test_createVolumeGroupRequestMapper_for_alaCarte_flow() throws Exception {
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("msoRequestId");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelVersion("modelVersion");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ genericVnf.setVnfName("vnfName");
+ genericVnf.setVnfType("vnfType");
+ serviceInstance.getVnfs().add(genericVnf);
+
+
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelName("modelName");
+ modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID");
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ volumeGroup.setModelInfoVfModule(modelInfoVfModule);
+ serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest();
+
+ expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
+ expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName());
+ expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType());
+ expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
+ expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
+
+ Map<String, String> volumeGroupParams = new HashMap<>();
+ volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
+ volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
+ volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
+ volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
+
+ expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams);
+
+ expectedCreateVolumeGroupRequest.setSkipAAI(true);
+ expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled());
+ expectedCreateVolumeGroupRequest.setFailIfExists(true);
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest);
+
+ expectedCreateVolumeGroupRequest.setMessageId("messageId");
+ expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId");
+
+ doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class));
+ doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid();
+
+ CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
+
+ assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest));
+ }
+
+ @Test
+ public void test_deleteVolumeGroupRequestMapper() throws Exception {
+ DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
+ expectedDeleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ cloudRegion.setTenantId("tenantId");
+ expectedDeleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+
+ volumeGroup.setHeatStackId("heatStackId");
+ expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+
+ expectedDeleteVolumeGroupRequest.setSkipAAI(true);
+
+ MsoRequest msoRequest = new MsoRequest();
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("msoRequestId");
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedDeleteVolumeGroupRequest.setMsoRequest(msoRequest);
+
+ String messageId = "messageId";
+ String endpoint = "endpoint";
+ doReturn(messageId).when(vnfAdapterObjectMapper).getRandomUuid();
+ doReturn(endpoint).when(vnfAdapterObjectMapper).getProperty(isA(String.class));
+ expectedDeleteVolumeGroupRequest.setMessageId(messageId);
+ expectedDeleteVolumeGroupRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId);
+
+ DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
+
+ assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest));
+ }
+
+ @Test
+ public void test_createVolumeGroupParams() throws Exception {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ genericVnf.setVnfName("vnfName");
+
+ RequestContext requestContext = new RequestContext();
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ Map<String, String> expectedVolumeGroupParams = new HashMap<>();
+ expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId());
+ expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName());
+ expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
+ expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
+ expectedVolumeGroupParams.put("paramOne", "paramOneValue");
+ expectedVolumeGroupParams.put("paramTwo", "paramTwoValue");
+ expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
+
+ Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+
+ assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
+ }
+
+ @Test
+ public void test_createVolumeGroupParams_without_sdncResponse() throws Exception {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ genericVnf.setVnfName("vnfName");
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+
+ Map<String, String> expectedVolumeGroupParams = new HashMap<>();
+ expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId());
+ expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName());
+ expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
+ expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
+ RequestContext requestContext = new RequestContext();
+ Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null);
+
+ assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
+ }
+
+ @Test
+ public void test_createVolumeGroupParams_with_user_params() throws Exception {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ genericVnf.setVnfName("vnfName");
+
+ RequestContext requestContext = new RequestContext();
+ Map<String, Object> userParamsMap = new HashMap<>();
+ userParamsMap.put("name", "userParamKey");
+ userParamsMap.put("value", "userParamValue");
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ userParams.add(userParamsMap);
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(userParams);
+ requestContext.setRequestParameters(requestParameters);
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ Map<String, String> expectedVolumeGroupParams = new HashMap<>();
+ expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId());
+ expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName());
+ expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
+ expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
+ expectedVolumeGroupParams.put("paramOne", "paramOneValue");
+ expectedVolumeGroupParams.put("paramTwo", "paramTwoValue");
+ expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
+ expectedVolumeGroupParams.put("userParamKey", "userParamValue");
+
+ Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+
+ assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
+ }
+
+ @Test
+ public void test_createMsoRequest() {
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("msoRequestId");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+
+ MsoRequest expectedMsoRequest = new MsoRequest();
+ expectedMsoRequest.setRequestId(requestContext.getMsoRequestId());
+ expectedMsoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+
+ MsoRequest actualMsoRequest = vnfAdapterObjectMapper.createMsoRequest(requestContext, serviceInstance);
+
+ assertThat(expectedMsoRequest, sameBeanAs(actualMsoRequest));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java
new file mode 100644
index 0000000000..bbc5e56141
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java
@@ -0,0 +1,449 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.adapter.vnf.mapper;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class VnfAdapterVfModuleObjectMapperIntegrationTest {
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+ @Test
+ public void createVfModuleRequestMapperTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ modelInfoServiceInstance.setEnvironmentContext("environmentContext");
+ modelInfoServiceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setMsoRequestId("requestId");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.setVnfName("vnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ Integer vfModuleIndex = 1;
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setModuleIndex(vfModuleIndex);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json")));
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+ mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleRequestMapperWithCloudResourcesTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ modelInfoServiceInstance.setEnvironmentContext("environmentContext");
+ modelInfoServiceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setMsoRequestId("requestId");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.setVnfName("vnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ Integer vfModuleIndex = 1;
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setModuleIndex(vfModuleIndex);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json")));
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json")));
+
+ VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+ mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleRequestMapperDhcpDisabledTest() throws Exception {
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ modelInfoServiceInstance.setEnvironmentContext("environmentContext");
+ modelInfoServiceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setMsoRequestId("requestId");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.setVnfName("vnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ Integer vfModuleIndex = 1;
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setModuleIndex(vfModuleIndex);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json")));
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+ mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void createVfModuleRequestMapperMultipleDhcpTest() throws Exception {
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ modelInfoServiceInstance.setEnvironmentContext("environmentContext");
+ modelInfoServiceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setMsoRequestId("requestId");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.setVnfName("vnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ Integer vfModuleIndex = 1;
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setModuleIndex(vfModuleIndex);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json")));
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+ mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
+ public void DeleteVfModuleRequestMapperTest() throws Exception {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ modelInfoServiceInstance.setEnvironmentContext("environmentContext");
+ modelInfoServiceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setMsoRequestId("requestId");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.setVnfName("vnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+ mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
+
+ DeleteVfModuleRequest vfModuleVNFAdapterRequest = mapper.deleteVfModuleRequestMapper(
+ requestContext, cloudRegion, serviceInstance,
+ vnf, vfModule);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ DeleteVfModuleRequest reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ DeleteVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
new file mode 100644
index 0000000000..c8f4a222f3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.adapter.vnf.mapper;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class VnfAdapterVfModuleObjectMapperTest{
+
+ private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+
+ @Test
+ public void createVnfcSubInterfaceKeyTest() {
+
+ assertEquals("type_0_subint_role_port_0", mapper.createVnfcSubInterfaceKey("type", 0, "role", 0));
+ }
+
+ @Test
+ public void createGlobalVnfcSubInterfaceKeyTest() {
+
+ assertEquals("type_subint_role_port_0", mapper.createGlobalVnfcSubInterfaceKey("type", "role", 0));
+ }
+
+ @Test
+ public void addPairToMapTest() {
+ Map<String, String> map = new HashMap<>();
+
+ mapper.addPairToMap(map, "test", "_key", Arrays.asList("a", "b"));
+
+ assertEquals("a,b", map.get("test_key"));
+
+ mapper.addPairToMap(map, "test", "_key2", Arrays.asList());
+
+ assertThat(map.containsKey("test_key2"), equalTo(false));
+
+ mapper.addPairToMap(map, "test", "_key3", "myVal");
+
+ assertEquals("myVal", map.get("test_key3"));
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
new file mode 100644
index 0000000000..fff4fc72fb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+@RunWith(MockitoJUnitRunner.class)
+public class AAICollectionResourcesTest extends TestDataSetup{
+
+ @InjectMocks
+ private AAICollectionResources aaiCollectionResources = new AAICollectionResources();
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ private Collection networkCollection;
+
+ @Before
+ public void before() {
+ networkCollection = buildCollection();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void createCollectionTest() throws Exception {
+ networkCollection.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection);
+
+ aaiCollectionResources.createCollection(networkCollection);
+
+ assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus());
+ verify(MOCK_aaiResourcesClient, times(1)).create(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), isA(org.onap.aai.domain.yang.Collection.class));
+ }
+
+ @Test
+ public void updateCollectionTest() throws Exception {
+ doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection);
+ aaiCollectionResources.updateCollection(networkCollection);
+ verify(MOCK_aaiResourcesClient, times(1)).update(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), isA(org.onap.aai.domain.yang.Collection.class));
+ }
+
+ @Test
+ public void deleteCollectionTest() throws Exception {
+ aaiCollectionResources.deleteCollection(networkCollection);
+ verify(MOCK_aaiResourcesClient, times(1)).delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())));
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
new file mode 100644
index 0000000000..cc48c46508
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -0,0 +1,180 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIConfigurationResourcesTest extends TestDataSetup{
+
+
+
+ private Configuration configuration;
+ private ServiceProxy serviceProxy;
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VpnBinding vpnBinding;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @InjectMocks
+ private AAIConfigurationResources aaiConfigurationResources = new AAIConfigurationResources();
+
+ @Before
+ public void before() {
+ configuration = buildConfiguration();
+ serviceProxy = buildServiceProxy();
+ serviceInstance = buildServiceInstance();
+ genericVnf = buildGenericVnf();
+ vpnBinding = buildVpnBinding();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void createConfigurationTest() {
+ doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper).mapConfiguration(configuration);
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
+
+ aaiConfigurationResources.createConfiguration(configuration);
+
+ assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
+ }
+
+ @Test
+ public void updateConfigurationTest() {
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
+ configuration.setConfigurationType("VNR");
+ configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ aaiConfigurationResources.updateConfiguration(configuration);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Configuration.class));
+ }
+
+ @Test
+ public void connectConfigurationToServiceInstanceTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void disconnectConfigurationToServiceInstanceTest(){
+ doNothing().when(MOCK_aaiResourcesClient).disconnect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.disconnectConfigurationToServiceInstance("TEST_CONFIGURATION_ID", "TEST_SERVICE_INSTANCE_ID");
+ verify(MOCK_aaiResourcesClient, times(1)).disconnect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectConfigurationToGenericVnfTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(), genericVnf.getVnfId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectConfigurationToVpnBindingTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToVpnBinding(configuration.getConfigurationId(), vpnBinding.getVpnId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void getConfigurationFromRelatedLinkTest () {
+ Optional<org.onap.aai.domain.yang.Configuration> configuration = Optional.of(new org.onap.aai.domain.yang.Configuration());
+ configuration.get().setConfigurationId("config1");
+ doReturn(configuration).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.Configuration.class),isA(AAIResourceUri.class));
+ aaiConfigurationResources.getConfigurationFromRelatedLink("http://localhost:8090/aai/v12/network/configurations/configuration/config1");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.Configuration.class),isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectVrfConfigurationToVnrConfigurationTest() throws Exception {
+ Configuration vrfConfiguration = buildConfiguration();
+ Configuration vnrConfiguration = buildConfiguration();
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectVrfConfigurationToVnrConfiguration(vrfConfiguration.getConfigurationId(),vnrConfiguration.getConfigurationId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectConfigurationToPnfObjectTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ Pnf primaryPnf = serviceProxy.getServiceInstance().getPnfs().stream().filter(o -> o.getRole().equals("Primary")).findFirst().get();
+
+ aaiConfigurationResources.connectConfigurationToPnfObject(primaryPnf.getPnfId(), configuration.getConfigurationId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void getConfigurationTest() {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
+ aaiConfigurationResources.getConfiguration("configurationId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
+ }
+
+ @Test
+ public void deleteConfigurationTest() {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri);
+ aaiConfigurationResources.deleteConfiguration("configurationId");
+ verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
new file mode 100644
index 0000000000..aef25e5ded
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+@RunWith(MockitoJUnitRunner.class)
+public class AAIInstanceGroupResourcesTest extends TestDataSetup{
+
+ @InjectMocks
+ private AAIInstanceGroupResources aaiInstanceGroupResources = new AAIInstanceGroupResources();
+
+ private InstanceGroup instanceGroup;
+ private GenericVnf vnf;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @Before
+ public void before() {
+ instanceGroup = buildInstanceGroup();
+ vnf = buildGenericVnf();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void createInstanceGroupTest() throws Exception {
+ doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup);
+ aaiInstanceGroupResources.createInstanceGroup(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), isA(Optional.class));
+ }
+
+ @Test
+ public void deleteInstanceGroupTest() throws Exception {
+ aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ }
+
+ @Test
+ public void connectInstanceGroupTest() throws Exception {
+ aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())));
+ }
+
+ @Test
+ public void existsTest() throws Exception {
+ aaiInstanceGroupResources.exists(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
new file mode 100644
index 0000000000..fa3324840c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -0,0 +1,317 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAINetworkResourcesTest extends TestDataSetup{
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+ private L3Network network;
+ private Collection collection;
+ private InstanceGroup instanceGroup;
+ private ServiceInstance serviceInstance;
+ private CloudRegion cloudRegion;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @InjectMocks
+ private AAINetworkResources aaiNetworkResources = new AAINetworkResources();
+
+ @Before
+ public void before() {
+ network = buildL3Network();
+
+ collection = buildCollection();
+
+ List<L3Network> l3NetworkList = new ArrayList<L3Network>();
+ l3NetworkList.add(network);
+
+ instanceGroup = buildInstanceGroup();
+
+ serviceInstance = buildServiceInstance();
+
+ cloudRegion = buildCloudRegion();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+
+ @Test
+ public void updateNetworkTest() throws Exception {
+
+ network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doReturn(new org.onap.aai.domain.yang.L3Network()).when(MOCK_aaiObjectMapper).mapNetwork(network);
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.L3Network.class));
+
+ aaiNetworkResources.updateNetwork(network);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.L3Network.class));
+ assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus());
+ }
+
+ @Test
+ public void createNetworkConnectToServiceInstanceTest() throws Exception {
+
+ network.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ doReturn(new org.onap.aai.domain.yang.L3Network()).when(MOCK_aaiObjectMapper).mapNetwork(network);
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), any(AAIResourceUri.class));
+
+ aaiNetworkResources.createNetworkConnectToServiceInstance(network, serviceInstance);
+
+ assertEquals(OrchestrationStatus.INVENTORIED, network.getOrchestrationStatus());
+
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void deleteNetworkTest() throws Exception {
+
+ network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+
+ aaiNetworkResources.deleteNetwork(network);
+
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void getVpnBindingTest() throws Exception {
+ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<VpnBinding> oVpnBinding = Optional.empty();
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID", "serviceModelVersionId");
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri);
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+
+ if (oVpnBinding.isPresent()) {
+ VpnBinding vpnBinding = oVpnBinding.get();
+ assertThat(aaiResultWrapper.asBean(VpnBinding.class).get(), sameBeanAs(vpnBinding));
+ }
+ }
+
+ @Test
+ public void getNetworkPolicyTest() throws Exception {
+ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicy.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<NetworkPolicy> oNetPolicy = Optional.empty();
+ AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID", "serviceModelVersionId");
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+
+ if (oNetPolicy.isPresent()) {
+ NetworkPolicy networkPolicy = oNetPolicy.get();
+ assertThat(aaiResultWrapper.asBean(NetworkPolicy.class).get(), sameBeanAs(networkPolicy));
+ }
+ }
+
+ @Test
+ public void getRouteTableTest() throws Exception {
+ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<RouteTableReference> oRtref = Optional.empty();
+ AAIResourceUri rTRefUri = AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID", "serviceModelVersionId");
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oRtref = aaiNetworkResources.getRouteTable(rTRefUri);
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+
+ if (oRtref.isPresent()) {
+ RouteTableReference rTref = oRtref.get();
+ assertThat(aaiResultWrapper.asBean(RouteTableReference.class).get(), sameBeanAs(rTref));
+ }
+ }
+
+ @Test
+ public void queryNetworkByIdTest() throws Exception {
+ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiQueryAAIResponse-Wrapper.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ L3Network network = new L3Network();
+ network.setNetworkId("0384d743-f69b-4cc8-9aa8-c3ae66662c44");
+ network.setNetworkName("Dev_Bindings_1802_020118");
+ network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ Optional<org.onap.aai.domain.yang.L3Network> l3NetworkOpt = aaiNetworkResources.queryNetworkById(network);
+ org.onap.aai.domain.yang.L3Network l3Network = l3NetworkOpt.isPresent() ? l3NetworkOpt.get() : null;
+
+ verify(MOCK_aaiResourcesClient, times(1)).get(isA(AAIResourceUri.class));
+ assertNotNull(l3Network);
+ assertEquals("0384d743-f69b-4cc8-9aa8-c3ae66662c44", l3Network.getNetworkId());
+ assertEquals("Dev_Bindings_1802_020118", l3Network.getNetworkName());
+ }
+
+ @Test
+ public void queryNetworkWrapperByIdTest() throws Exception {
+ final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiQueryAAIResponse-Wrapper.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ L3Network network = new L3Network();
+ network.setNetworkId("0384d743-f69b-4cc8-9aa8-c3ae66662c44");
+ network.setNetworkName("Dev_Bindings_1802_020118");
+ network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ AAIResultWrapper result = aaiNetworkResources.queryNetworkWrapperById(network);
+
+ verify(MOCK_aaiResourcesClient, times(1)).get(isA(AAIResourceUri.class));
+ assertEquals(aaiResultWrapper.getJson(), result.getJson());
+ assertNotNull(result);
+ Optional<Relationships> resultNetworkRelationships = result.getRelationships();
+ assertTrue(resultNetworkRelationships.isPresent());
+ Optional<org.onap.aai.domain.yang.L3Network> aaiL3Network = result.asBean(org.onap.aai.domain.yang.L3Network.class);
+ assertEquals(network.getNetworkId(),aaiL3Network.get().getNetworkId());
+ assertEquals(network.getNetworkName(),aaiL3Network.get().getNetworkName());
+
+
+ }
+
+ @Test
+ public void createNetworkCollectionTest() throws Exception {
+
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Collection.class));
+ doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(collection);
+ collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ aaiNetworkResources.createNetworkCollection(collection);
+ assertEquals(OrchestrationStatus.INVENTORIED, collection.getOrchestrationStatus());
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Collection.class));
+ }
+
+ @Test
+ public void createNetworkInstanceGroupTest() throws Exception {
+ doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup);
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.InstanceGroup.class));
+ aaiNetworkResources.createNetworkInstanceGroup(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.InstanceGroup.class));
+ }
+
+ @Test
+ public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception {
+ aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ }
+
+ @Test
+ public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception {
+ aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ }
+
+ @Test
+ public void connectNetworkToCloudRegionTest() throws Exception {
+ aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ }
+
+ @Test
+ public void connectNetworkToTenantTest() throws Exception {
+ aaiNetworkResources.connectNetworkToTenant(network, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ }
+
+ @Test
+ public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception {
+ aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ }
+
+ @Test
+ public void connectNetworkCollectionToServiceInstanceTest() throws Exception {
+ aaiNetworkResources.connectNetworkCollectionToServiceInstance(collection, serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void deleteCollectionTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ aaiNetworkResources.deleteCollection(collection);
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void deleteInstanceGroupTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ aaiNetworkResources.deleteNetworkInstanceGroup(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
new file mode 100644
index 0000000000..46d4135b6d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIServiceInstanceResourcesTest extends TestDataSetup{
+
+ @InjectMocks
+ private AAIServiceInstanceResources aaiServiceInstanceResources = new AAIServiceInstanceResources();
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ private ServiceInstance serviceInstance;
+ private ServiceSubscription serviceSubscription;
+ private Customer customer;
+ private Project project;
+ private OwningEntity owningEntity;
+
+ @Before
+ public void before() {
+ serviceInstance = buildServiceInstance();
+ serviceSubscription = buildServiceSubscription();
+ customer = buildCustomer();
+ project = buildProject();
+ owningEntity = buildOwningEntity();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void deleteServiceInstanceSuccessTest() throws Exception {
+ aaiServiceInstanceResources.deleteServiceInstance(serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void deleteServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doThrow(Exception.class).when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ aaiServiceInstanceResources.deleteServiceInstance(serviceInstance);
+ }
+
+ @Test
+ public void existsServiceInstanceTest() {
+ aaiServiceInstanceResources.existsServiceInstance(serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).exists(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createServiceSubscriptionTest() {
+ serviceSubscription.setServiceType("IP-FLEX");
+ customer.setServiceSubscription(serviceSubscription);
+ doReturn(new org.onap.aai.domain.yang.ServiceSubscription()).when(MOCK_aaiObjectMapper).mapServiceSubscription(customer.getServiceSubscription());
+ aaiServiceInstanceResources.createServiceSubscription(customer);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ }
+
+ @Test
+ public void createServiceInstanceTest() {
+ serviceSubscription.setServiceType("testSubscriberType");
+ customer.setServiceSubscription(serviceSubscription);
+ doReturn(new org.onap.aai.domain.yang.ServiceInstance()).when(MOCK_aaiObjectMapper).mapServiceInstance(serviceInstance);
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ aaiServiceInstanceResources.createServiceInstance(serviceInstance, customer);
+
+ assertEquals(OrchestrationStatus.INVENTORIED, serviceInstance.getOrchestrationStatus());
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ }
+
+ @Test
+ public void createProjectTest() {
+ doReturn(new org.onap.aai.domain.yang.Project()).when(MOCK_aaiObjectMapper).mapProject(project);
+ aaiServiceInstanceResources.createProject(project);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ }
+
+ @Test
+ public void createProjectandConnectServiceInstanceTest() {
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ doReturn(new org.onap.aai.domain.yang.Project()).when(MOCK_aaiObjectMapper).mapProject(project);
+ aaiServiceInstanceResources.createProjectandConnectServiceInstance(project, serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createOwningEntityTest() {
+ doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity);
+ aaiServiceInstanceResources.createOwningEntity(owningEntity);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ }
+
+ @Test
+ public void existsOwningEntityTest() {
+ aaiServiceInstanceResources.existsOwningEntity(owningEntity);
+ verify(MOCK_aaiResourcesClient, times(1)).exists(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectOwningEntityandServiceInstanceTest() {
+ aaiServiceInstanceResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createOwningEntityandConnectServiceInstanceTest() {
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity);
+ aaiServiceInstanceResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void updateOrchestrationStatusServiceInstanceTest() {
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class));
+ }
+
+ @Test
+ public void test_updateServiceInstance() {
+ aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
new file mode 100644
index 0000000000..0c4c8fc443
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIVfModuleResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private AAIVfModuleResources aaiVfModuleResources = new AAIVfModuleResources();
+
+ private VfModule vfModule;
+ private GenericVnf vnf;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @Before
+ public void before() {
+ vfModule = buildVfModule();
+ vnf = buildGenericVnf();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void updateOrchestrationStatusVfModuleTest() throws Exception {
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class));
+
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class));
+
+ assertEquals(OrchestrationStatus.ACTIVE, vfModule.getOrchestrationStatus());
+ }
+
+ @Test
+ public void createVfModuleTest() throws Exception {
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ doReturn(new org.onap.aai.domain.yang.VfModule()).when(MOCK_aaiObjectMapper).mapVfModule(vfModule);
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
+ aaiVfModuleResources.createVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ assertEquals(OrchestrationStatus.INVENTORIED, vfModule.getOrchestrationStatus());
+ }
+
+ @Test
+ public void deleteVfModuleTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+
+ aaiVfModuleResources.deleteVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void changeAssignVfModuleTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class));
+
+ aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class));
+ }
+
+ @Test
+ public void connectVfModuleToVolumeGroupTest() throws Exception {
+ VolumeGroup volumeGroup = buildVolumeGroup();
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ CloudRegion cloudRegion = buildCloudRegion();
+
+ aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
new file mode 100644
index 0000000000..db719d3151
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -0,0 +1,161 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIVnfResourcesTest extends TestDataSetup {
+
+ private GenericVnf genericVnf;
+
+ private ServiceInstance serviceInstance;
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @InjectMocks
+ AAIVnfResources aaiVnfResources = new AAIVnfResources();
+
+ @Before
+ public void before() {
+ serviceInstance = buildServiceInstance();
+ genericVnf = buildGenericVnf();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void createVnfandConnectServiceInstanceTest() {
+ doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(MOCK_aaiObjectMapper).mapVnf(genericVnf);
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ aaiVnfResources.createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+
+ assertEquals(OrchestrationStatus.INVENTORIED, genericVnf.getOrchestrationStatus());
+ verify(MOCK_aaiObjectMapper, times(1)).mapVnf(genericVnf);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createPlatformandConnectVnfTest() {
+ Platform platform = new Platform();
+ platform.setPlatformName("a123");
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class));
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
+ aaiVnfResources.createPlatformandConnectVnf(platform, genericVnf);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createLineOfBusinessandConnectVnfTest() {
+ LineOfBusiness lob = new LineOfBusiness();
+ lob.setLineOfBusinessName("a123");
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class));
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
+ aaiVnfResources.createLineOfBusinessandConnectVnf(lob, genericVnf);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+
+ aaiVnfResources.deleteVnf(genericVnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void updateOrchestrationStatusVnfTest() {
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Vnf.class));
+
+ aaiVnfResources.updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Vnf.class));
+
+ assertEquals(OrchestrationStatus.ACTIVE, genericVnf.getOrchestrationStatus());
+ }
+
+ @Test
+ public void updateObjectVnfTest() {
+ doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(MOCK_aaiObjectMapper).mapVnf(genericVnf);
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.GenericVnf.class));
+
+ aaiVnfResources.updateObjectVnf(genericVnf);
+
+ verify(MOCK_aaiObjectMapper, times(1)).mapVnf(genericVnf);
+ verify(MOCK_aaiResourcesClient, times(1)).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.GenericVnf.class));
+ }
+
+ @Test
+ public void getGenericVnfTest () {
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ aaiVnfResources.getGenericVnf("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void checkInMaintFlagTest () {
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ vnf.get().setInMaint(true);
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ boolean inMaintFlag = aaiVnfResources.checkInMaintFlag("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ assertEquals(inMaintFlag, true);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
new file mode 100644
index 0000000000..de15e0a550
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIVolumeGroupResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private AAIVolumeGroupResources aaiVolumeGroupResources = new AAIVolumeGroupResources();
+
+ private CloudRegion cloudRegion;
+ private VolumeGroup volumeGroup;
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @Before
+ public void before() {
+ cloudRegion = buildCloudRegion();
+ volumeGroup = buildVolumeGroup();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+
+
+ @Test
+ public void updateOrchestrationStatusVolumeGroupTest() throws Exception {
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class));
+
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class));
+
+ assertEquals(OrchestrationStatus.ACTIVE, volumeGroup.getOrchestrationStatus());
+ }
+
+ @Test
+ public void createVolumeGroupTest() throws Exception {
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class));
+
+ aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion);
+
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class));
+
+ assertEquals(OrchestrationStatus.ASSIGNED, volumeGroup.getOrchestrationStatus());
+ }
+
+ @Test
+ public void connectVolumeGroupToVnfTest() throws Exception {
+
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion);
+
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectVolumeGroupToTenantTest() throws Exception {
+ GenericVnf genericVnf = buildGenericVnf();
+
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
+
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void deleteVolumeGroupTest() {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+
+ aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
new file mode 100644
index 0000000000..7c31040f1d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.VpnBindings;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIVpnBindingResourcesTest extends TestDataSetup{
+
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+
+ @Mock
+ protected AAIObjectMapper MOCK_aaiObjectMapper;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @InjectMocks
+ private AAIVpnBindingResources aaiVpnBindingResources = new AAIVpnBindingResources();
+
+ private Customer customer;
+
+ @Before
+ public void before() {
+ customer = buildCustomer();
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
+ }
+
+ @Test
+ public void createCustomerTest() {
+ org.onap.aai.domain.yang.Customer mappedCustomer = new org.onap.aai.domain.yang.Customer();
+ mappedCustomer.setGlobalCustomerId(customer.getGlobalCustomerId());
+
+ doReturn(mappedCustomer).when(MOCK_aaiObjectMapper).mapCustomer(customer);
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Customer.class));
+
+ aaiVpnBindingResources.createCustomer(customer);
+
+ verify(MOCK_aaiResourcesClient, times(1)).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Customer.class));
+ verify(MOCK_aaiObjectMapper, times(1)).mapCustomer(customer);
+ }
+
+ @Test
+ public void getVpnBindingTest () {
+ org.onap.aai.domain.yang.VpnBinding vpnBinding = new org.onap.aai.domain.yang.VpnBinding();
+ vpnBinding.setVpnId("vnfId");
+ when(MOCK_aaiResourcesClient.get(eq(org.onap.aai.domain.yang.VpnBinding.class),isA(AAIResourceUri.class))).thenReturn(Optional.of(vpnBinding));
+ aaiVpnBindingResources.getVpnBinding("vpnId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBinding.class),isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void existsCustomerTest() {
+ when(MOCK_aaiResourcesClient.exists(isA(AAIResourceUri.class))).thenReturn(true);
+ boolean isCustomerExist = aaiVpnBindingResources.existsCustomer(customer);
+ verify(MOCK_aaiResourcesClient, times(1)).exists(isA(AAIResourceUri.class));
+ assertEquals(true,isCustomerExist);
+ }
+
+ @Test
+ public void getVpnBindingByCustomerVpnIdTest() {
+ when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class),isA(AAIResourceUri.class))).thenReturn(Optional.of(new VpnBindings()));
+ Optional<VpnBindings> vpnBindings = aaiVpnBindingResources.getVpnBindingByCustomerVpnId("testCustomerVpnId");
+ assertNotNull(vpnBindings.get());
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBindings.class),isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createVpnBindingTest() {
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VpnBinding.class));
+ org.onap.aai.domain.yang.VpnBinding mappedVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
+ mappedVpnBinding.setVpnName("test");
+
+ doReturn(mappedVpnBinding).when(MOCK_aaiObjectMapper).mapVpnBinding(isA(VpnBinding.class));
+ VpnBinding vpnBinding = buildVpnBinding();
+ aaiVpnBindingResources.createVpnBinding(vpnBinding);
+
+ verify(MOCK_aaiResourcesClient, times(1)).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VpnBinding.class));
+ verify(MOCK_aaiObjectMapper, times(1)).mapVpnBinding(isA(VpnBinding.class));
+ }
+
+ @Test
+ public void connectCustomerToVpnBinding() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiVpnBindingResources.connectCustomerToVpnBinding("testCustId","testVpnId");
+ verify(MOCK_aaiResourcesClient,times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java
new file mode 100644
index 0000000000..0669b84fd6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java
@@ -0,0 +1,219 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.network.NetworkAdapterClientException;
+import org.onap.so.client.adapter.network.NetworkAdapterClientImpl;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.entity.MsoRequest;
+
+import com.shazam.shazamcrest.matcher.Matchers;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class NetworkAdapterResourcesTest extends TestDataSetup{
+
+ @InjectMocks
+ private NetworkAdapterResources networkAdapterResources = new NetworkAdapterResources();
+
+ @Mock
+ protected NetworkAdapterClientImpl MOCK_networkAdapterClient;
+
+ @Mock
+ protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper;
+
+ private L3Network l3Network;
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private Customer customer;
+ Map<String, String> userInput;
+
+ @Before
+ public void before() {
+ requestContext = buildRequestContext();
+
+ customer = buildCustomer();
+
+ serviceInstance = buildServiceInstance();
+
+ cloudRegion = buildCloudRegion();
+
+ orchestrationContext = buildOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ userInput = buildUserInput();
+
+ l3Network = buildL3Network();
+ }
+
+ @Test
+ public void createNetworTest() throws Exception {
+ String cloudRegionPo = "cloudRegionPo";
+ CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest();
+
+ expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo);
+ expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId());
+ expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId());
+ expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName());
+ expectedCreateNetworkRequest.setBackout(false);
+ expectedCreateNetworkRequest.setFailIfExists(true);
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedCreateNetworkRequest.setMsoRequest(msoRequest);
+ expectedCreateNetworkRequest.setSkipAAI(true);
+
+ Subnet openstackSubnet = new Subnet();
+ HostRoute hostRoute = new HostRoute();
+ hostRoute.setHostRouteId("hostRouteId");
+ hostRoute.setNextHop("nextHop");
+ hostRoute.setRoutePrefix("routePrefix");
+ openstackSubnet.getHostRoutes().add(hostRoute);
+ List<Subnet> subnetList = new ArrayList<Subnet>();
+ subnetList.add(openstackSubnet);
+ l3Network.getSubnets().add(openstackSubnet);
+
+ l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
+ createNetworkRequest.setCloudSiteId("cloudSiteId");
+
+ CreateNetworkResponse expectedCreateNetworkResponse = new CreateNetworkResponse();
+ expectedCreateNetworkResponse.setNetworkStackId("networkStackId");
+ expectedCreateNetworkResponse.setNetworkCreated(true);
+
+
+ doReturn(expectedCreateNetworkResponse).when(MOCK_networkAdapterClient).createNetwork(isA(CreateNetworkRequest.class));
+
+ doReturn(createNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(Customer.class));
+
+ CreateNetworkResponse actualCreateNetwrokResponse = (networkAdapterResources.createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer)).get();
+
+ verify(MOCK_networkAdapterClient, times(1)).createNetwork(createNetworkRequest);
+
+ verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
+
+ assertThat(expectedCreateNetworkResponse, Matchers.sameBeanAs(actualCreateNetwrokResponse));
+ }
+
+ @Test
+ public void rollbackCreateNetworkTest() throws Exception {
+ String cloudRegionPo = "cloudRegionPo";
+ RollbackNetworkResponse expectedRollbackNetworkResponse = new RollbackNetworkResponse();
+ expectedRollbackNetworkResponse.setMessageId("messageId");
+ expectedRollbackNetworkResponse.setNetworkRolledBack(true);
+
+ RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
+ rollbackNetworkRequest.setMessageId("messageId");
+
+ RollbackNetworkResponse rollbackNetworkResponse = new RollbackNetworkResponse();
+ rollbackNetworkResponse.setMessageId("messageId");
+ rollbackNetworkResponse.setNetworkRolledBack(true);
+
+ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
+ createNetworkResponse.setMessageId("messageId");
+
+ doReturn(rollbackNetworkResponse).when(MOCK_networkAdapterClient).rollbackNetwork(isA(String.class), isA(RollbackNetworkRequest.class));
+
+ doReturn(rollbackNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRollbackRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(CreateNetworkResponse.class));
+
+ RollbackNetworkResponse actualRollbackCreateNetwrokResponse = (networkAdapterResources.rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse)).get();
+
+ verify(MOCK_networkAdapterClient, times(1)).rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest);
+
+ verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
+
+ assertThat(expectedRollbackNetworkResponse, Matchers.sameBeanAs(actualRollbackCreateNetwrokResponse));
+ }
+
+ @Test
+ public void updateNetworkTest() throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ doReturn(new UpdateNetworkRequest()).when(MOCK_networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
+
+ doReturn(new UpdateNetworkResponse()).when(MOCK_networkAdapterClient).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class));
+
+ Optional<UpdateNetworkResponse> actualUpdateNetworkResponse = networkAdapterResources.updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
+
+
+ verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
+ verify(MOCK_networkAdapterClient, times(1)).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class));
+ assertNotNull(actualUpdateNetworkResponse);
+ }
+
+ @Test
+ public void deleteNetwork_DeleteAction_Test() throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
+ doReturn(deleteNetworkRequest).when(MOCK_networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+
+ DeleteNetworkResponse expectedDeleteNetworkResponse = new DeleteNetworkResponse();
+
+ doReturn(expectedDeleteNetworkResponse).when(MOCK_networkAdapterClient).deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest);
+
+ Optional<DeleteNetworkResponse> actualODeleteNetworkResponse = networkAdapterResources.deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network);
+ DeleteNetworkResponse actualDeleteNetworkResponse = actualODeleteNetworkResponse.get();
+
+ verify(MOCK_networkAdapterObjectMapper, times(1)).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+ verify(MOCK_networkAdapterClient, times(1)).deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest);
+ assertThat(expectedDeleteNetworkResponse, Matchers.sameBeanAs(actualDeleteNetworkResponse));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
new file mode 100644
index 0000000000..7de5faac0c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCConfigurationResourcesTest extends TestDataSetup{
+
+ @InjectMocks
+ private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources();
+
+ @Spy
+ GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ;
+
+ @Mock
+ protected SDNCClient MOCK_sdncClient;
+
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private VpnBondingLink vpnBondingLink;
+ private GenericVnf vnf;
+ private Customer customer;
+
+ @Before
+ public void setUp(){
+
+ customer = buildCustomer();
+
+ requestContext = buildRequestContext();
+
+ serviceInstance = buildServiceInstance();
+
+ vpnBondingLink = buildVpnBondingLink();
+
+ vnf = vpnBondingLink.getInfrastructureServiceProxy().getServiceInstance().getVnfs().get(0);
+ }
+
+ @Test
+ public void activateVnrConfigurationTest() throws BadResponseException, MapperException {
+
+ doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
+ String response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ assertNotNull(response);
+ }
+
+ @Test
+ public void assignVnrConfigurationTest() throws BadResponseException, MapperException {
+
+ doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
+ String response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ assertNotNull(response);
+ }
+
+ @Test
+ public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException {
+ doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
+ String response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration());
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ assertNotNull(response);
+ }
+
+ @Test
+ public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException {
+ doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
+ String response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration());
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ assertNotNull(response);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
new file mode 100644
index 0000000000..b91d935c8e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
@@ -0,0 +1,204 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCNetworkResourcesTest extends TestDataSetup{
+
+ @InjectMocks
+ private SDNCNetworkResources sdncNetworkResources;
+
+ @Mock
+ protected SDNCClient MOCK_sdncClient;
+
+ @Mock
+ protected NetworkTopologyOperationRequestMapper MOCK_networkTopologyOperationRequestMapper;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private Customer customer;
+ private RequestContext requestContext;
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void before() {
+ network = buildL3Network();
+
+ customer = buildCustomer();
+
+ serviceInstance = buildServiceInstance();
+
+ requestContext = buildRequestContext();
+
+ cloudRegion = new CloudRegion();
+ }
+
+ @Test
+ public void assignNetworkTest() throws Exception {
+ network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ sdncNetworkResources.assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus());
+ }
+
+ @Test
+ public void rollbackAssignNetworkTest() throws Exception {
+ network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ sdncNetworkResources.rollbackAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus());
+ }
+
+ @Test
+ public void activateNetworkTest() throws Exception {
+ network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ sdncNetworkResources.activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus());
+ }
+
+ @Test
+ public void deleteNetworkTest() throws Exception {
+ network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ sdncNetworkResources.deleteNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus());
+ }
+
+ @Test
+ public void test_deactivateNetwork() throws MapperException, BadResponseException {
+ serviceInstance.getNetworks().add(network);
+
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("gcustId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+ GenericResourceApiNetworkOperationInformation expectedGenericResourceApiNetworkOperationInformation = new GenericResourceApiNetworkOperationInformation();
+
+ String expectedResponse = "response";
+
+ doReturn(expectedResponse).when(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK);
+
+ doReturn(expectedGenericResourceApiNetworkOperationInformation).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+
+ String actualResponse = sdncNetworkResources.deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK);
+
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void changeAssignNetworkTest() throws MapperException, BadResponseException {
+ String expectedSdncResponse = "SDNCChangeAssignNetworkResponse";
+
+ serviceInstance.getNetworks().add(network);
+
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+ GenericResourceApiNetworkOperationInformation sdncReq = new GenericResourceApiNetworkOperationInformation();
+
+ doReturn(sdncReq).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class));
+
+ doReturn(expectedSdncResponse).when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), isA(SDNCTopology.class));
+
+ String actualSdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+
+ verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
+ verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.NETWORK);
+ assertEquals(actualSdncResponse, expectedSdncResponse);
+ }
+
+ @Test
+ public void unassignNetwork_Test() throws Exception {
+ network.setOrchestrationStatus(OrchestrationStatus.CREATED);
+
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ sdncNetworkResources.unassignNetwork(network, serviceInstance, customer,
+ requestContext, cloudRegion);
+
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK));
+
+ assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus());
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
new file mode 100644
index 0000000000..79419c342e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCServiceInstanceResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private SDNCServiceInstanceResources sdncServiceInstanceResources;
+
+
+ @Mock
+ protected ServiceTopologyOperationMapper MOCK_serviceTopologyOperationMapper;
+
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private Customer customer;
+
+ @Mock
+ protected SDNCClient MOCK_sdncClient;
+
+ @Before
+ public void before() {
+ requestContext = buildRequestContext();
+
+ serviceInstance = buildServiceInstance();
+
+ customer = buildCustomer();
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ }
+
+ @Test
+ public void assignServiceInstanceSuccessTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ }
+
+ @Test
+ public void assignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ }
+
+ @Test
+ public void deleteServiceInstanceSuccessTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ }
+
+ @Test
+ public void deleteServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext);
+ }
+
+ @Test
+ public void unassignServiceInstanceSuccessTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ }
+
+ @Test
+ public void unassignServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.unassignServiceInstance(serviceInstance,customer, requestContext);
+ }
+
+ @Test
+ public void deactivateServiceInstanceSuccessTest() throws Exception {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ }
+
+ @Test
+ public void deactivateServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ }
+
+ @Test
+ public void test_changeModelServiceInstance() throws MapperException, BadResponseException {
+ doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, customer, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
new file mode 100644
index 0000000000..c7ab47ba5a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
@@ -0,0 +1,126 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation;;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCVfModuleResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private SDNCVfModuleResources sdncVfModuleResources = new SDNCVfModuleResources();
+
+ private VfModule vfModule;
+ private GenericVnf vnf;
+ private ServiceInstance serviceInstance;
+ private VolumeGroup volumeGroup;
+ private Customer customer;
+ private CloudRegion cloudRegion;
+ private RequestContext requestContext;
+
+ @Mock
+ protected SDNCClient MOCK_sdncClient;
+
+ @Spy
+ protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper;
+
+ @Before
+ public void before() {
+ vfModule = buildVfModule();
+ vnf = buildGenericVnf();
+ serviceInstance = buildServiceInstance();
+ volumeGroup = buildVolumeGroup();
+ customer = buildCustomer();
+ cloudRegion = buildCloudRegion();
+ requestContext = buildRequestContext();
+ }
+
+ @Test
+ public void assignVfModuleTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class));
+
+ sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE));
+ }
+
+ @Test
+ public void unassignVfModuleTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE));
+
+ sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE));
+ }
+
+ @Test
+ public void activateVfModuleTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class));
+
+ sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE));
+ }
+
+ @Test
+ public void deactivateVfModuleTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class));
+
+ sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE));
+ }
+
+ @Test
+ public void changeAssignVfModuleTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class));
+
+ sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
new file mode 100644
index 0000000000..46764c221c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
@@ -0,0 +1,185 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCVnfResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private SDNCVnfResources sdncVnfResources;
+
+ @Mock
+ protected VnfTopologyOperationRequestMapper MOCK_vnfTopologyOperationRequestMapper;
+
+ @Mock
+ protected SDNCClient MOCK_sdncClient;
+
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private Customer customer;
+ private CloudRegion cloudRegion;
+ private RequestContext requestContext;
+ private GenericResourceApiVnfOperationInformation sdncReq;
+
+ @Before
+ public void before() {
+ serviceInstance = buildServiceInstance();
+
+ genericVnf = buildGenericVnf();
+
+ customer = buildCustomer();
+
+ cloudRegion = buildCloudRegion();
+
+ requestContext = buildRequestContext();
+
+ sdncReq = new GenericResourceApiVnfOperationInformation();
+ }
+
+ @Test
+ public void assignVnfTest() throws MapperException, BadResponseException {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean());
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+
+ sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ }
+
+ @Test
+ public void activateVnfTest() throws MapperException, BadResponseException {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean());
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+
+ sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ }
+
+ @Test
+ public void deleteVnfTest() throws MapperException, BadResponseException {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean());
+ doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+
+ sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ }
+
+ @Test
+ public void queryVnfTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).get(isA(String.class));
+
+ genericVnf.setSelflink("testSelflink");
+
+ sdncVnfResources.queryVnf(genericVnf);
+
+ verify(MOCK_sdncClient, times(1)).get(isA(String.class));
+ }
+
+ @Test
+ public void queryVnfWithResourcePrefixTest() throws MapperException, BadResponseException {
+ doReturn("test").when(MOCK_sdncClient).get(isA(String.class));
+
+ genericVnf.setSelflink("restconf/test:testSelflink");
+
+ sdncVnfResources.queryVnf(genericVnf);
+
+ verify(MOCK_sdncClient, times(1)).get(isA(String.class));
+ }
+
+ @Test
+ public void changeModelVnfTest() throws MapperException, BadResponseException {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean());
+ doReturn("SDNCChangeModelVnfResponse").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), isA(SDNCTopology.class));
+
+ String actualResponse = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.VNF);
+ assertEquals("SDNCChangeModelVnfResponse", actualResponse);
+ }
+
+ @Test
+ public void deactivateVnfSuccessTest() throws Exception {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean());
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+
+ }
+
+ @Test(expected = Exception.class)
+ public void deactivateVnfExceptionTest() throws Exception {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean());
+ doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ }
+
+ @Test
+ public void unassignVnfSuccessTest() throws Exception {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean());
+ doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ }
+
+ @Test(expected = Exception.class)
+ public void unassignVnfExceptionTest() throws Exception {
+ doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean());
+ doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF));
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ //verify(client, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.VNF));
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java
new file mode 100644
index 0000000000..38113b8078
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.sdno.SDNOValidator;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNOHealthCheckResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private SDNOHealthCheckResources sdnoHealthCheckResources = new SDNOHealthCheckResources();
+
+ private GenericVnf genericVnf;
+ private RequestContext requestContext;
+
+ @Mock
+ protected SDNOValidator MOCK_sdnoValidator;
+
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+
+ @Before
+ public void before() {
+ genericVnf = buildGenericVnf();
+ requestContext = buildRequestContext();
+ doReturn(MOCK_sdnoValidator).when(MOCK_injectionHelper).getSdnoValidator();
+ }
+
+ @Test
+ public void healthCheckTest() throws Exception {
+ doReturn(true).when(MOCK_sdnoValidator).healthDiagnostic(isA(String.class), isA(UUID.class), isA(String.class));
+ assertTrue(sdnoHealthCheckResources.healthCheck(genericVnf, requestContext));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java
new file mode 100644
index 0000000000..dfed3c8929
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{
+ @InjectMocks
+ private VnfAdapterVfModuleResources vnfAdapterVfModuleResources = new VnfAdapterVfModuleResources();
+
+ @Mock
+ protected VnfAdapterVfModuleObjectMapper MOCK_vnfAdapterVfModuleObjectMapper;
+
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private ModelInfoServiceInstance modelInfoServiceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private ModelInfoVfModule modelInfoVfModule;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+ private CreateVfModuleRequest createVfModuleRequest;
+ private String sdncVnfQueryResponse;
+ private String sdncVfModuleQueryResponse;
+ private DeleteVfModuleRequest deleteVfModuleRequest;
+
+ @Before
+ public void before() {
+ requestContext = buildRequestContext();
+
+ serviceInstance = buildServiceInstance();
+
+ genericVnf = buildGenericVnf();
+
+ vfModule = buildVfModule();
+
+ cloudRegion = buildCloudRegion();
+
+ orchestrationContext = buildOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+
+ sdncVnfQueryResponse = new String();
+ sdncVfModuleQueryResponse = new String();
+
+ createVfModuleRequest = new CreateVfModuleRequest();
+ createVfModuleRequest.setCloudSiteId("cloudSiteId");
+
+ deleteVfModuleRequest = new DeleteVfModuleRequest();
+ deleteVfModuleRequest.setCloudSiteId("cloudSiteId");
+ }
+
+ @Test
+ public void test_createVfModule() throws Exception {
+ doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+ assertNotNull(createVfModuleRequest);
+ assertNotNull(actualCreateVfModuleRequest);
+ assertEquals(createVfModuleRequest, actualCreateVfModuleRequest);
+ }
+
+ @Test
+ public void test_deleteVfModule() throws Exception {
+ doReturn(deleteVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).deleteVfModuleRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(ServiceInstance.class),
+ isA(GenericVnf.class), isA(VfModule.class));
+
+ DeleteVfModuleRequest actualDeleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance,
+ genericVnf, vfModule);
+
+ verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule);
+ assertEquals(deleteVfModuleRequest, actualDeleteVfModuleRequest);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
new file mode 100644
index 0000000000..ee0e60c38a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.orchestration;
+
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+
+import com.shazam.shazamcrest.matcher.Matchers;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfAdapterVolumeGroupResourcesTest extends TestDataSetup {
+ @InjectMocks
+ private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
+
+ @Mock
+ protected VnfAdapterObjectMapper MOCK_vnfAdapterObjectMapper;
+
+ @Mock
+ protected VnfVolumeAdapterClientImpl MOCK_vnfVolumeAdapterClient;
+
+ private RequestContext requestContext;
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private OrchestrationContext orchestrationContext;
+
+ @Before
+ public void before() {
+ requestContext = buildRequestContext();
+ serviceInstance = buildServiceInstance();
+ genericVnf = buildGenericVnf();
+ serviceInstance.getVnfs().add(genericVnf);
+ vfModule = buildVfModule();
+ genericVnf.getVfModules().add(vfModule);
+ volumeGroup = buildVolumeGroup();
+ serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup);
+ cloudRegion = buildCloudRegion();
+ orchestrationContext = buildOrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(true);
+ }
+
+ @Test
+ public void test_createVolumeGroup() throws Exception {
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+
+ CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest();
+ createVolumeGroupRequest.setCloudSiteId("cloudSiteId");
+
+ CreateVolumeGroupResponse expectedCreateVolumeGroupResponse = new CreateVolumeGroupResponse();
+ expectedCreateVolumeGroupResponse.setVolumeGroupStackId("volumeGroupStackId");
+ expectedCreateVolumeGroupResponse.setVolumeGroupCreated(true);
+
+ String sdncVfModuleQueryResponse = "sdncVfModuleQueryResponse";
+
+ doReturn(createVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+
+ CreateVolumeGroupRequest actualCreateVolumeGroupResponse = vnfAdapterVolumeGroupResources.createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+
+ verify(MOCK_vnfAdapterObjectMapper, times(1)).createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+
+ assertThat(createVolumeGroupRequest, Matchers.sameBeanAs(actualCreateVolumeGroupResponse));
+ }
+
+ @Test
+ public void test_deleteVolumeGroup() throws Exception {
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ doReturn(deleteVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
+
+ DeleteVolumeGroupResponse expectedDeleteVolumeGroupResponse = new DeleteVolumeGroupResponse();
+ doReturn(expectedDeleteVolumeGroupResponse).when(MOCK_vnfVolumeAdapterClient).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+
+ DeleteVolumeGroupResponse actualDeleteVolumeGroupResponse = vnfAdapterVolumeGroupResources.deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+
+ verify(MOCK_vnfVolumeAdapterClient, times(1)).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+ verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ assertThat(expectedDeleteVolumeGroupResponse, Matchers.sameBeanAs(actualDeleteVolumeGroupResponse));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java
new file mode 100644
index 0000000000..e3f6a1829e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.policy;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class CommonObjectMapperProviderTest {
+
+ @Test
+ public void shouldSetCorrectMapperProperties() throws Exception {
+ // given
+ CommonObjectMapperProvider provider = new CommonObjectMapperProvider();
+ // when
+ ObjectMapper context = provider.getMapper();
+ // then
+ assertTrue(context.isEnabled(MapperFeature.USE_ANNOTATIONS));
+ assertFalse(context.isEnabled(SerializationFeature.WRAP_ROOT_VALUE));
+ assertFalse(context.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE));
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
new file mode 100644
index 0000000000..eb17ad0ff9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sdn.common;
+
+import java.util.LinkedHashMap;
+
+import org.junit.Assert;
+import org.junit.Rule;
+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;
+
+
+public class SdnCommonTasksTest{
+
+
+ SdnCommonTasks sdnCommonTasks = new SdnCommonTasks();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void buildJsonRequestTest() throws MapperException {
+ String jsonStr = sdnCommonTasks.buildJsonRequest("");
+ Assert.assertNotNull(jsonStr);
+ }
+
+ @Test
+ public void buildJsonRequestTestException() throws MapperException {
+ expectedException.expect(MapperException.class);
+ sdnCommonTasks.buildJsonRequest(new Object());
+ }
+
+ @Test
+ public void getHttpHeadersTest() {
+ Assert.assertNotNull(sdnCommonTasks.getHttpHeaders(""));
+ }
+
+ @Test
+ public void validateSDNResponseTest() throws BadResponseException {
+ LinkedHashMap responseMap = new LinkedHashMap();
+ responseMap.put("response-code", "0");
+ responseMap.put("response-message", "success");
+ Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap));
+ }
+
+ @Test
+ public void validateSDNResponseTestException() throws BadResponseException {
+ expectedException.expect(BadResponseException.class);
+ LinkedHashMap responseMap = new LinkedHashMap();
+ Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap));
+ }
+
+ @Test
+ public void validateSDNResponseTestRespCodeNot200() throws BadResponseException {
+ expectedException.expect(BadResponseException.class);
+ LinkedHashMap responseMap = new LinkedHashMap();
+ responseMap.put("response-code", "300");
+ responseMap.put("response-message", "Failed");
+ Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap));
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java
new file mode 100644
index 0000000000..2492638520
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sdnc;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class SDNCClientTest extends BaseTaskTest {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8446));
+
+ @Test
+ public void getTest() throws BadResponseException, MapperException, IOException {
+ String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
+ String queryLink = "/topologyQuery";
+
+ wireMockRule.stubFor(get(urlEqualTo(queryLink))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json").withBody(responseJson)));
+ String response = SPY_sdncClient.get(queryLink);
+ JSONAssert.assertEquals(responseJson, response, false);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
new file mode 100644
index 0000000000..d0d2510b73
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sdnc.mapper;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation;
+
+
+public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
+
+ private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper();
+
+ @Test
+ public void deactivateOrUnassignVnrReqMapperTest() {
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("MsoRequestId");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("ServiceInstanceId");
+ Configuration Configuration = new Configuration();
+ Configuration.setConfigurationId("ConfigurationId");
+ GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper
+ (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration);
+
+ Assert.assertNotNull(genericInfo);
+ Assert.assertNotNull(genericInfo.getSdncRequestHeader().getSvcRequestId());
+ }
+
+
+
+ private VpnBondingLink getVpnBondingLink() {
+ VpnBondingLink vpnBondingLink = new VpnBondingLink();
+ Configuration vrfConfiguration = getVRFConfiguration();
+ vpnBondingLink.setVrfConfiguration(vrfConfiguration);
+ Configuration vnrConfiguration = getVNRConfiguration();
+ vpnBondingLink.setVnrConfiguration(vnrConfiguration);
+ vpnBondingLink.setTransportServiceProxy(buildServiceProxy(buildServiceInstance(buildGenericVnf())));
+ return vpnBondingLink;
+ }
+
+ private RequestContext getRequestContext() {
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("MsoRequestId");
+ HashMap<String, String> userParams = getUserParams();
+ requestContext.setUserParams(userParams);
+ return requestContext;
+ }
+
+ private HashMap<String, String> getUserParams() {
+ HashMap<String,String> userParams = new HashMap<>();
+ userParams.put("lppCustomerId","lppCustomerId");
+ return userParams;
+ }
+
+ private ServiceProxy buildServiceProxy(ServiceInstance serviceInstance) {
+ ServiceProxy serviceProxy = new ServiceProxy();
+ serviceProxy.setServiceInstance(serviceInstance);
+ return serviceProxy;
+ }
+
+ private Configuration getVRFConfiguration() {
+ Configuration vrfConfiguration = new Configuration();
+ vrfConfiguration.setConfigurationId("ConfigurationId");
+ vrfConfiguration.setConfigurationName("ConfigurationName");
+ vrfConfiguration.setConfigurationSubType("ConfigurationSubType");
+ vrfConfiguration.setConfigurationType("VRF-ENTRY");
+ return vrfConfiguration;
+ }
+
+ public Configuration getVNRConfiguration() {
+ Configuration vnrConfiguration = new Configuration();
+ vnrConfiguration.setConfigurationId("ConfigurationId");
+ vnrConfiguration.setConfigurationName("ConfigurationName");
+ vnrConfiguration.setConfigurationSubType("ConfigurationSubType");
+ vnrConfiguration.setConfigurationType("VNRConfiguration");
+ L3Network l3Network = getL3Network();
+ vnrConfiguration.setNetwork(l3Network);
+ return vnrConfiguration;
+ }
+
+ public L3Network getL3Network() {
+ L3Network l3Network = new L3Network();
+ l3Network.setNetworkId("l3NetworkId");
+ Subnet ipv4subnet = getSubnet("ipv4CidrMask", "ipv4NetworkStartAddress", "IPV4");
+ Subnet ipv6subnet = getSubnet("ipv6CidrMask", "ipv6NetworkStartAddress", "IPV6");
+ l3Network.getSubnets().add(ipv4subnet);
+ l3Network.getSubnets().add(ipv6subnet);
+ return l3Network;
+ }
+
+ private Subnet getSubnet(String ipv4CidrMask, String ipv4NetworkStartAddress, String ipv4) {
+ Subnet ipv4subnet = new Subnet();
+ ipv4subnet.setCidrMask(ipv4CidrMask);
+ ipv4subnet.setNetworkStartAddress(ipv4NetworkStartAddress);
+ ipv4subnet.setIpVersion(ipv4);
+ return ipv4subnet;
+ }
+
+ private ServiceInstance buildServiceInstance(GenericVnf vnf) {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("ServiceInstanceId");
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+ vnfs.add(vnf);
+ return serviceInstance;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
new file mode 100644
index 0000000000..6f3d137541
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
@@ -0,0 +1,225 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.HashMap;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiConfigurationinformationConfigurationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiGcrequestinputGcRequestInput;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation;
+
+
+public class GeneralTopologyObjectMapperTest extends TestDataSetup{
+ @InjectMocks
+ private GeneralTopologyObjectMapper genObjMapper = new GeneralTopologyObjectMapper();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Before
+ public void before() {
+
+ }
+
+ @After
+ public void after() {
+
+ }
+
+ @Test
+ public void testBuildServiceInformation() {
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType("productFamilyId");
+ customer.setServiceSubscription(serviceSubscription);
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericResourceApiServiceinformationServiceInformation serviceInfo = genObjMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+
+ assertEquals("serviceModelInvariantUuid", serviceInfo.getOnapModelInformation().getModelInvariantUuid());
+ assertEquals("serviceModelName", serviceInfo.getOnapModelInformation().getModelName());
+ assertEquals("serviceModelUuid", serviceInfo.getOnapModelInformation().getModelUuid());
+ assertEquals("serviceModelVersion", serviceInfo.getOnapModelInformation().getModelVersion());
+ assertNull(serviceInfo.getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals("serviceInstanceId", serviceInfo.getServiceInstanceId());
+ assertEquals("serviceInstanceId", serviceInfo.getServiceId());
+ assertEquals("globalCustomerId", serviceInfo.getGlobalCustomerId());
+ assertEquals("productFamilyId", serviceInfo.getSubscriptionServiceType());
+ }
+
+ @Test
+ public void buildSdncRequestHeaderActivateTest() {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ACTIVATE, "sdncReqId");
+
+ assertEquals(GenericResourceApiSvcActionEnumeration.ACTIVATE, requestHeader.getSvcAction());
+ assertEquals("sdncReqId", requestHeader.getSvcRequestId());
+ }
+
+ @Test
+ public void buildSdncRequestHeaderAssignTest() {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ASSIGN, "sdncReqId");
+
+ assertEquals(GenericResourceApiSvcActionEnumeration.ASSIGN, requestHeader.getSvcAction());
+ assertEquals("sdncReqId", requestHeader.getSvcRequestId());
+ }
+
+ @Test
+ public void buildSdncRequestHeaderDeactivateTest() {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DEACTIVATE, "sdncReqId");
+
+ assertEquals(GenericResourceApiSvcActionEnumeration.DEACTIVATE, requestHeader.getSvcAction());
+ assertEquals("sdncReqId", requestHeader.getSvcRequestId());
+ }
+
+ @Test
+ public void buildSdncRequestHeaderDeleteTest() {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DELETE, "sdncReqId");
+
+ assertEquals(GenericResourceApiSvcActionEnumeration.DELETE, requestHeader.getSvcAction());
+ assertEquals("sdncReqId", requestHeader.getSvcRequestId());
+ }
+
+ @Test
+ public void buildSdncRequestHeaderChangeAssignTest() {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.CHANGE_ASSIGN, "sdncReqId");
+
+ assertEquals(GenericResourceApiSvcActionEnumeration.CHANGEASSIGN, requestHeader.getSvcAction());
+ assertEquals("sdncReqId", requestHeader.getSvcRequestId());
+ }
+
+ @Test
+ public void buildConfigurationInformationTest_excludesOnapModelInfo() {
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("testConfigurationId");
+ configuration.setConfigurationType("VNR");
+ configuration.setConfigurationName("VNRCONF");
+ GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =genObjMapper.buildConfigurationInformation(configuration,false);
+ assertEquals(configuration.getConfigurationId(),configurationInformation.getConfigurationId());
+ assertEquals(configuration.getConfigurationType(),configurationInformation.getConfigurationType());
+ assertEquals(configuration.getConfigurationName(),configurationInformation.getConfigurationName());
+ assertNull(configurationInformation.getOnapModelInformation());
+ }
+
+ @Test
+ public void buildConfigurationInformationTest_includesOnapModelInfo() {
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("testConfigurationId");
+ configuration.setConfigurationType("VNR");
+ configuration.setConfigurationName("VNRCONF");
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelVersionId("modelVersionId");
+ modelInfoConfiguration.setModelInvariantId("modelInvariantId");
+ modelInfoConfiguration.setModelCustomizationId("modelCustomizationId");
+ configuration.setModelInfoConfiguration(modelInfoConfiguration);
+
+ GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = genObjMapper.buildConfigurationInformation(configuration,true);
+
+ assertEquals(configuration.getConfigurationId(),configurationInformation.getConfigurationId());
+ assertEquals(configuration.getConfigurationType(),configurationInformation.getConfigurationType());
+ assertEquals(configuration.getConfigurationName(),configurationInformation.getConfigurationName());
+ assertNotNull(configurationInformation.getOnapModelInformation());
+ assertEquals(configuration.getModelInfoConfiguration().getModelVersionId(),configurationInformation.getOnapModelInformation().getModelUuid());
+ assertEquals(configuration.getModelInfoConfiguration().getModelInvariantId(),configurationInformation.getOnapModelInformation().getModelInvariantUuid());
+ assertEquals(configuration.getModelInfoConfiguration().getModelCustomizationId(),configurationInformation.getOnapModelInformation().getModelCustomizationUuid());
+
+ }
+
+ @Test
+ public void buildGcRequestInformationTest() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("TestVnfId");
+ GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf,null);
+ assertNotNull(gcRequestInput);
+ assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId());
+ assertNull(gcRequestInput.getInputParameters());
+ }
+
+ @Test
+ public void buildGcRequestInformationTest_withInputParams() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("TestVnfId");
+ GenericResourceApiParam genericResourceApiParam =new GenericResourceApiParam();
+ genericResourceApiParam.addParamItem(new GenericResourceApiParamParam());
+ GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf,genericResourceApiParam);
+ assertNotNull(gcRequestInput);
+ assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId());
+ assertNotNull(gcRequestInput.getInputParameters());
+ }
+
+ @Test
+ public void buildVnfInformationTest_withNullData() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("TestVnfId");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ GenericResourceApiVnfinformationVnfInformation gcRequestInput = genObjMapper.buildVnfInformation(vnf,serviceInstance,true);
+ assertNotNull(gcRequestInput);
+ assertNull(vnf.getModelInfoGenericVnf());
+ assertNull(gcRequestInput.getOnapModelInformation());
+ assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId());
+ assertNotNull(gcRequestInput.getVnfId());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
new file mode 100644
index 0000000000..615f8a5710
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
@@ -0,0 +1,198 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class NetworkTopologyOperationRequestMapperTest {
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+ private ServiceInstance serviceInstance;
+ private ServiceInstance serviceInstanceNoCollection;
+ private Customer customer;
+ private RequestContext requestContext;
+ private L3Network network;
+ private CloudRegion cloudRegion;
+
+ @Before
+ public void before() {
+ // prepare and set service instance
+ serviceInstance = new ServiceInstance();
+ serviceInstanceNoCollection = new ServiceInstance();
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
+ modelInfoServiceInstance.setModelName("modelName");
+ modelInfoServiceInstance.setModelUuid("modelUuid");
+ modelInfoServiceInstance.setModelVersion("modelVersion");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ //serviceInstance.setCustomer(customer);
+ // set Customer on service instance
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType("productFamilyId");
+ customer.setServiceSubscription(serviceSubscription);
+
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection);
+ //
+ InstanceGroup networkInstanceGroup = new InstanceGroup();
+ networkInstanceGroup.setId("networkInstanceGroupId");
+ networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction");
+ Collection networkCollection = new Collection();
+ networkCollection.setInstanceGroup(networkInstanceGroup);
+ serviceInstance.setCollection(networkCollection);
+ //
+ requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ network = new L3Network();
+ network.setNetworkId("TEST_NETWORK_ID");
+ network.setNetworkName("TEST_NETWORK_NAME");
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid");
+ modelInfoNetwork.setModelName("modelName");
+ modelInfoNetwork.setModelVersion("modelVersion");
+ modelInfoNetwork.setModelUUID("modelUuid");
+ modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
+ network.setModelInfoNetwork(modelInfoNetwork);
+
+ cloudRegion = new CloudRegion();
+ }
+
+ @Test
+ public void createGenericResourceApiNetworkOperationInformationTest() throws Exception {
+
+ NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
+ GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+
+ ObjectMapper omapper = new ObjectMapper();
+ GenericResourceApiNetworkOperationInformation reqMapper1 = omapper.readValue(
+ getJson("genericResourceApiNetworkOperationInformation.json"),
+ GenericResourceApiNetworkOperationInformation.class);
+
+ assertThat(networkSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId")
+ .ignoring("requestInformation.requestId"));
+ }
+
+ @Test
+ public void reqMapperTest() throws Exception {
+
+ NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
+ GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+
+ assertNull(networkSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals("modelCustomizationUUID", networkSDNCrequest.getNetworkInformation().getOnapModelInformation().getModelCustomizationUuid());
+ }
+
+ @Test
+ public void reqMapperNoCollectionTest() throws Exception {
+ NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
+ GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstanceNoCollection, customer,
+ requestContext, cloudRegion);
+
+ assertNull(networkSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals("modelCustomizationUUID", networkSDNCrequest.getNetworkInformation().getOnapModelInformation().getModelCustomizationUuid());
+ }
+ @Test
+ public void createGenericResourceApiNetworkOperationInformation_UnassignTest() throws Exception {
+
+ NetworkTopologyOperationRequestMapper mapperUnassign = new NetworkTopologyOperationRequestMapper();
+ GenericResourceApiNetworkOperationInformation networkSDNCrequestUnassign = mapperUnassign.reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+
+ ObjectMapper omapperUnassign = new ObjectMapper();
+ GenericResourceApiNetworkOperationInformation reqMapperUnassign = omapperUnassign.readValue(
+ getJson("genericResourceApiNetworkOperationInformationUnAssign.json"),
+ GenericResourceApiNetworkOperationInformation.class);
+
+ assertThat(reqMapperUnassign, sameBeanAs(networkSDNCrequestUnassign).ignoring("sdncRequestHeader.svcRequestId")
+ .ignoring("requestInformation.requestId"));
+
+ }
+
+ @Test
+ public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception {
+
+ NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
+ //set network name NULL
+ network.setNetworkName(null);
+ GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+
+ ObjectMapper omapper = new ObjectMapper();
+ GenericResourceApiNetworkOperationInformation reqMapper1 = omapper.readValue(
+ getJson("genericResourceApiNetworkOperationInformationNoNetworkName.json"),
+ GenericResourceApiNetworkOperationInformation.class);
+
+ assertThat(reqMapper1, sameBeanAs(networkSDNCrequest).ignoring("sdncRequestHeader.svcRequestId")
+ .ignoring("requestInformation.requestId"));
+ }
+
+ /*
+ * Helper method to load JSON data
+ */
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename)));
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
new file mode 100644
index 0000000000..727a088d80
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+
+import org.junit.Test;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation;
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceTopologyOperationMapperTest {
+
+ @Test
+ public void reqMapperTest() throws Exception {
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
+ modelInfoServiceInstance.setModelName("modelName");
+ modelInfoServiceInstance.setModelUuid("modelUuid");
+ modelInfoServiceInstance.setModelVersion("modelVersion");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+ //prepare RequestContext
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper();
+ GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper(
+ SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ GenericResourceApiOnapmodelinformationOnapModelInformation reqMapper1 = omapper.readValue(jsonToCompare,
+ GenericResourceApiOnapmodelinformationOnapModelInformation.class);
+
+ assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation()));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
new file mode 100644
index 0000000000..2ebe6d4f0f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -0,0 +1,221 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+
+import org.junit.Test;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class VfModuleTopologyOperationRequestMapperTest {
+
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
+ @Test
+ public void assignGenericResourceApiVfModuleInformationTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType("productFamilyId");
+ customer.setServiceSubscription(serviceSubscription);
+
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("testVnfId");
+ vnf.setVnfType("testVnfType");
+ vnf.setVnfName("testVnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId");
+ vfModule.setVfModuleName("testVfModuleName");
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, null);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationAssign.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ GenericResourceApiVfModuleOperationInformation.class);
+
+ assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId")
+ .ignoring("requestInformation.requestId"));
+ }
+
+ @Test
+ public void unassignGenericResourceApiVfModuleInformationTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+
+ // prepare and set vnf instance
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("testVnfId");
+ vnf.setVnfType("testVnfType");
+
+ // prepare and set vf module instance
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId");
+ vfModule.setVfModuleName("testVfModuleName");
+
+ VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null,
+ null, null, null);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationUnassign.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ GenericResourceApiVfModuleOperationInformation.class);
+
+ assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId")
+ .ignoring("requestInformation.requestId"));
+ }
+
+ @Test
+ public void reqMapperTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("testVnfId");
+ vnf.setVnfType("testVnfType");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId");
+ vfModule.setVfModuleName("testVfModuleName");
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, null);
+
+ assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
new file mode 100644
index 0000000000..ed61486ff3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T 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.client.sdnc.mapper;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.junit.Test;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+
+import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation;
+
+public class VnfTopologyOperationRequestMapperTest {
+
+ @Test
+ public void reqMapperTest() throws Exception {
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
+ modelInfoServiceInstance.setModelName("modelName");
+ modelInfoServiceInstance.setModelUuid("modelUuid");
+ modelInfoServiceInstance.setModelVersion("modelVersion");
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ //prepare VNF
+ ModelInfoGenericVnf genericVnf = new ModelInfoGenericVnf();
+ genericVnf.setModelInvariantUuid("vnfModelInvariantUUID");
+ genericVnf.setModelVersion("vnfModelVersion");
+ genericVnf.setModelName("vnfModelName");
+ genericVnf.setModelUuid("vnfModelUUID");
+ genericVnf.setModelCustomizationUuid("vnfModelCustomizationUUID");
+
+ ModelInfoInstanceGroup modelL3Network = new ModelInfoInstanceGroup();
+ modelL3Network.setType("networkInstanceGroup");
+
+ InstanceGroup instanceGroup1 = new InstanceGroup();
+ instanceGroup1.setId("l3-network-ig-111");
+ instanceGroup1.setModelInfoInstanceGroup(modelL3Network);
+
+ InstanceGroup instanceGroup2 = new InstanceGroup();
+ instanceGroup2.setId("l3-network-ig-222");
+ instanceGroup2.setModelInfoInstanceGroup(modelL3Network);
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setModelInfoGenericVnf(genericVnf);
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.getInstanceGroups().add(instanceGroup1);
+ vnf.getInstanceGroups().add(instanceGroup2);
+ License license = new License();
+ List<String> entitlementPoolUuids = new ArrayList<>();
+ entitlementPoolUuids.add("entitlementPoolUuid");
+ List<String> licenseKeyGroupUuids = new ArrayList<>();
+ licenseKeyGroupUuids.add("licenseKeyGroupUuid");
+ license.setEntitlementPoolUuids(entitlementPoolUuids);
+ license.setLicenseKeyGroupUuids(licenseKeyGroupUuids);
+ vnf.setLicense(license);
+
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType("productFamilyId");
+ customer.setServiceSubscription(serviceSubscription);
+
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+
+
+ //prepare RequestContext
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper();
+ GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper(
+ SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext,true);
+
+ assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals("vnfModelCustomizationUUID", vnfOpInformation.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
+ assertEquals(2, vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().size());
+ assertEquals("l3-network-ig-111", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(0).getVnfNetworkInstanceGroupId());
+ assertEquals("l3-network-ig-222", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(1).getVnfNetworkInstanceGroupId());
+ assertEquals("entitlementPoolUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(1).getValue());
+ assertEquals("licenseKeyGroupUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(2).getValue());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
new file mode 100644
index 0000000000..e5eb6bce54
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T 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.client.sniro;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import org.junit.Test;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.sniro.beans.SniroConductorRequest;
+import org.onap.so.client.sniro.beans.SniroManagerRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
+
+public class SniroClientTestIT{
+
+ @Autowired
+ private SniroClient client;
+
+
+ @Test(expected = Test.None.class)
+ public void testPostDemands_success() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}";
+
+ stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postDemands(new SniroManagerRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
+
+ stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new SniroManagerRequest());
+
+ //TODO assertEquals("missing data", );
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}";
+
+ stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new SniroManagerRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
+
+ stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new SniroManagerRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{ }";
+
+ stubFor(post(urlEqualTo("/sniro/api/placement/v2"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new SniroManagerRequest());
+ }
+
+ @Test(expected = Test.None.class)
+ public void testPostRelease_success() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}";
+
+ stubFor(post(urlEqualTo("/v1/release-orders"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postRelease(new SniroConductorRequest());
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}";
+
+ stubFor(post(urlEqualTo("/v1/release-orders"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postRelease(new SniroConductorRequest());
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}";
+
+ stubFor(post(urlEqualTo("/v1/release-orders"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postRelease(new SniroConductorRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"status\": \"failure\", \"message\": null}";
+
+ stubFor(post(urlEqualTo("/v1/release-orders"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postRelease(new SniroConductorRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{ }";
+
+ stubFor(post(urlEqualTo("/v1/release-orders"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postRelease(new SniroConductorRequest());
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml
new file mode 100644
index 0000000000..34079bd23f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml
@@ -0,0 +1,75 @@
+<createNetworkRequest>
+ <cloudSiteId>mtn6</cloudSiteId>
+ <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId>
+ <networkId>8d35a433-c1db-4d54-a611-6de10aeb76f9</networkId>
+ <networkName>Dev_Bindings_1802_1311</networkName>
+ <networkType>CONTRAIL30_BASIC</networkType>
+ <modelCustomizationUuid>f1fc12e8-afe4-4716-954d-ed4d21a480ad</modelCustomizationUuid>
+ <networkTechnology>CONTRAIL</networkTechnology>
+ <providerVlanNetwork>
+ <physicalNetworkName>tbd</physicalNetworkName>
+ <vlans/>
+ </providerVlanNetwork>
+ <contrailNetwork>
+ <shared>true</shared>
+ <external>false</external>
+ <routeTargets>
+ <routeTarget>2001:051111</routeTarget>
+ <routeTargetRole>EXPORT</routeTargetRole>
+ </routeTargets>
+ <routeTargets>
+ <routeTarget>1000:051113</routeTarget>
+ <routeTargetRole>IMPORT</routeTargetRole>
+ </routeTargets>
+ <routeTargets>
+ <routeTarget>1000:051112</routeTarget>
+ <routeTargetRole>BOTH</routeTargetRole>
+ </routeTargets>
+ <routeTargets>
+ <routeTarget>1000:051115</routeTarget>
+ <routeTargetRole>EXPORT</routeTargetRole>
+ </routeTargets>
+ <routeTargets>
+ <routeTarget>1000:051114</routeTarget>
+ <routeTargetRole>IMPORT</routeTargetRole>
+ </routeTargets>
+ <policyFqdns>default-domain:ECOMP_MSO_DND:MSOPolicyD</policyFqdns>
+ <policyFqdns>default-domain:ECOMP_MSO_DND:MSOPolicyC</policyFqdns>
+ <routeTableFqdns/>
+ </contrailNetwork>
+ <subnets>
+ <allocationPools>
+ <start>107.118.41.3</start>
+ <end>107.118.41.45</end>
+ </allocationPools>
+ <cidr>107.118.41.0/24</cidr>
+ <enableDHCP>true</enableDHCP>
+ <gatewayIp>107.118.41.1</gatewayIp>
+ <ipVersion>4</ipVersion>
+ <subnetId>9dbb9e7e-fe18-421f-bad6-2305bd282471</subnetId>
+ <subnetName/>
+ <addrFromStart>true</addrFromStart>
+ </subnets>
+ <subnets>
+ <allocationPools>
+ <start>107.118.42.3</start>
+ <end>107.118.42.45</end>
+ </allocationPools>
+ <cidr>107.118.42.0/24</cidr>
+ <enableDHCP>true</enableDHCP>
+ <gatewayIp>107.118.42.1</gatewayIp>
+ <ipVersion>4</ipVersion>
+ <subnetId>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</subnetId>
+ <subnetName/>
+ <addrFromStart>true</addrFromStart>
+ </subnets>
+ <skipAAI>true</skipAAI>
+ <backout>true</backout>
+ <failIfExists>false</failIfExists>
+ <msoRequest>
+ <requestId>3d35ca0c-2da5-4f60-84d9-3e005de335c0</requestId>
+ <serviceInstanceId>f1d1c7da-fc42-4c31-866e-cfe963e55723</serviceInstanceId>
+ </msoRequest>
+ <messageId>d4515ea9-2852-4d3a-b424-9d7b6cf69d8e</messageId>
+ <notificationUrl/>
+</createNetworkRequest> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml
new file mode 100644
index 0000000000..607dd5af92
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml
@@ -0,0 +1,31 @@
+<createNetworkResponse>
+ <messageId>d4515ea9-2852-4d3a-b424-9d7b6cf69d8e</messageId>
+ <networkCreated>true</networkCreated>
+ <networkFqdn>default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311</networkFqdn>
+ <networkId>8d35a433-c1db-4d54-a611-6de10aeb76f9</networkId>
+ <networkStackId>Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7</networkStackId>
+ <neutronNetworkId>b6a7820c-4734-4ef2-8a73-a22c824423fa</neutronNetworkId>
+ <rollback>
+ <cloudId>mtn6</cloudId>
+ <modelCustomizationUuid>f1fc12e8-afe4-4716-954d-ed4d21a480ad</modelCustomizationUuid>
+ <msoRequest>
+ <requestId>3d35ca0c-2da5-4f60-84d9-3e005de335c0</requestId>
+ <serviceInstanceId>f1d1c7da-fc42-4c31-866e-cfe963e55723</serviceInstanceId>
+ </msoRequest>
+ <networkCreated>true</networkCreated>
+ <networkStackId>Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7</networkStackId>
+ <networkType>CONTRAIL30_BASIC</networkType>
+ <neutronNetworkId>b6a7820c-4734-4ef2-8a73-a22c824423fa</neutronNetworkId>
+ <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId>
+ </rollback>
+ <subnetMap>
+ <entry>
+ <key>9dbb9e7e-fe18-421f-bad6-2305bd282471</key>
+ <value>27d414c7-1076-4595-aa45-4717ee992cef</value>
+ </entry>
+ <entry>
+ <key>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</key>
+ <value>db64710c-fbbc-4dc9-8109-3925b87268fa</value>
+ </entry>
+ </subnetMap>
+</createNetworkResponse> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json
new file mode 100644
index 0000000000..dda149a560
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json
@@ -0,0 +1,10 @@
+{
+ "networkTechnology": "NEUTRON",
+ "failIfExists": false,
+ "backout": true,
+ "networkParams": [],
+ "msoRequest": {},
+ "contrailRequest": false,
+ "skipAAI": false,
+ "synchronous": true
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json
new file mode 100644
index 0000000000..d5d234cbf6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json
@@ -0,0 +1,226 @@
+{
+ "sharedNetwork": false,
+ "boundToVpn": false,
+ "externalNetwork": false,
+ "providerNetwork": false,
+ "network-id": "TEST_NETWORK_ID",
+ "cascaded": false,
+ "cloud-params": null,
+ "network-name": "TEST_NETWORK_NAME",
+ "is-bound-to-vpn": false,
+ "service-id": null,
+ "network-role-instance": null,
+ "orchestration-status": "Active",
+ "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "widget-model-id": null,
+ "widget-model-version": null,
+ "physical-network-name": null,
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "self-link": null,
+ "operational-status": null,
+ "subnets": {
+ "subnet": [
+ {
+ "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108",
+ "subnet-name": "",
+ "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c",
+ "gateway-address": "192.168.41.1",
+ "network-start-address": "192.168.41.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.41.3",
+ "dhcp-end": "192.168.41.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965497",
+ "host-routes": {
+ "host-route": [
+ {
+ "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32",
+ "route-prefix": "172.20.1.0/24",
+ "next-hop": "10.102.200.1",
+ "next-hop-type": "ip-address",
+ "resource-version": "1505857300987"
+ },
+ {
+ "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee",
+ "route-prefix": "10.102.0.0/16",
+ "next-hop": "10.102.200.1",
+ "next-hop-type": "ip-address",
+ "resource-version": "1505857301151"
+ },
+ {
+ "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28",
+ "route-prefix": "192.168.2.0/25",
+ "next-hop": "10.102.200.1",
+ "resource-version": "1505857301954"
+ }
+ ]
+ }
+ },
+ {
+ "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01",
+ "subnet-name": "",
+ "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f",
+ "gateway-address": "192.168.42.1",
+ "network-start-address": "192.168.42.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.42.3",
+ "dhcp-end": "192.168.42.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965508"
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "MSO_1610_dev"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "MSO-dev-service-type"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "LCP"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "ECOMP_MSO_DND"
+ }
+ ]
+ },
+ {
+ "related-to": "route-table-reference",
+ "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00",
+ "relationship-data": [
+ {
+ "relationship-key": "route-table-reference.route-table-reference-id",
+ "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "route-table-reference.route-table-reference-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:RTA"
+ }
+ ]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc",
+ "relationship-data": [
+ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD"
+ }
+ ]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64",
+ "relationship-data": [
+ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC"
+ }
+ ]
+ },
+ {
+ "related-to": "vpn-binding",
+ "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001",
+ "relationship-data": [
+ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "9a7b327d9-287aa00-82c4b0-100001"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "MSO_VPN_TEST"
+ },
+ {
+ "property-key": "vpn-binding.vpn-type"
+ }
+ ]
+ }
+ ]
+ },
+ "ctag-assignments": [
+ ],
+ "segmentation-assignments": [
+ ],
+ "model-info-network": null
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json
new file mode 100644
index 0000000000..aa6320801e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json
@@ -0,0 +1,216 @@
+{
+ "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "network-name": "Dev_Bindings_1802_020118",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "GN_EVPN_direct",
+ "network-technology": "contrail",
+ "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee",
+ "is-bound-to-vpn": true,
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance": 0,
+ "resource-version": "1517496965485",
+ "orchestration-status": "Active",
+ "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "physical-network-name": "tbd",
+ "is-provider-network": false,
+ "is-shared-network": true,
+ "is-external-network": false,
+ "subnets": {
+ "subnet": [
+ {
+ "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108",
+ "subnet-name": "",
+ "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c",
+ "gateway-address": "192.168.41.1",
+ "network-start-address": "192.168.41.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.41.3",
+ "dhcp-end": "192.168.41.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965497",
+ "host-routes": {
+ "host-route": [
+ {
+ "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32",
+ "route-prefix": "172.20.1.0/24",
+ "next-hop": "10.102.200.1",
+ "next-hop-type": "ip-address",
+ "resource-version": "1505857300987"
+ },
+ {
+ "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee",
+ "route-prefix": "10.102.0.0/16",
+ "next-hop": "10.102.200.1",
+ "next-hop-type": "ip-address",
+ "resource-version": "1505857301151"
+ },
+ {
+ "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28",
+ "route-prefix": "192.168.2.0/25",
+ "next-hop": "10.102.200.1",
+ "resource-version": "1505857301954"
+ }
+ ]
+ }
+ },
+ {
+ "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01",
+ "subnet-name": "",
+ "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f",
+ "gateway-address": "192.168.42.1",
+ "network-start-address": "192.168.42.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.42.3",
+ "dhcp-end": "192.168.42.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965508"
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "MSO_1610_dev"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "MSO-dev-service-type"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "LCP"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "ECOMP_MSO_DND"
+ }
+ ]
+ },
+ {
+ "related-to": "route-table-reference",
+ "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00",
+ "relationship-data": [
+ {
+ "relationship-key": "route-table-reference.route-table-reference-id",
+ "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "route-table-reference.route-table-reference-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:RTA"
+ }
+ ]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc",
+ "relationship-data": [
+ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD"
+ }
+ ]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64",
+ "relationship-data": [
+ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC"
+ }
+ ]
+ },
+ {
+ "related-to": "vpn-binding",
+ "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001",
+ "relationship-data": [
+ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "9a7b327d9-287aa00-82c4b0-100001"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "MSO_VPN_TEST"
+ },
+ {
+ "property-key": "vpn-binding.vpn-type"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json
new file mode 100644
index 0000000000..5addff2d70
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json
@@ -0,0 +1,596 @@
+{
+ "cloud-owner": "att-aic",
+ "cloud-region-id": "mtn6",
+ "cloud-type": "openstack",
+ "owner-defined-type": "LCP",
+ "cloud-region-version": "3.0",
+ "cloud-zone": "AUS1",
+ "complex-name": "mtn6",
+ "resource-version": "1485202577",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-125"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2002"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-126"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0509A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0511C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_1Bindings_324_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-155"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "ST-MTN6-NoBinding-1707-18-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1710-4001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-119"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_1311"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "aaaa-bbbb-cccc-dddd-eeee"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "direct_dhcp_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512B"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-1Binding-1710-0814-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-MTN6-NoBinding-1707-20-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1111-2222-3333-4444-5555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "dev_Bindings_full_1710_0907A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "wwww-xxxx-yyyy-zzzz"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-1002"
+ }]
+ },
+ {
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR",
+ "relationship-data": [ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "AUSTTXGR"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json
new file mode 100644
index 0000000000..fadbf9c244
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json
@@ -0,0 +1,596 @@
+{
+ "cloud-owner": "att-aic",
+ "cloud-region-id": "mtn6",
+ "cloud-type": "openstack",
+ "owner-defined-type": "LCP",
+ "cloud-region-version": "2.5",
+ "cloud-zone": "AUS1",
+ "complex-name": "mtn6",
+ "resource-version": "1485202577",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-125"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2002"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-126"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0509A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0511C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_1Bindings_324_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-155"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "ST-MTN6-NoBinding-1707-18-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1710-4001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-119"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_1311"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "aaaa-bbbb-cccc-dddd-eeee"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "direct_dhcp_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512B"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-1Binding-1710-0814-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-MTN6-NoBinding-1707-20-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1111-2222-3333-4444-5555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "dev_Bindings_full_1710_0907A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "wwww-xxxx-yyyy-zzzz"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-1002"
+ }]
+ },
+ {
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR",
+ "relationship-data": [ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "AUSTTXGR"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json
new file mode 100644
index 0000000000..97611c1d62
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json
@@ -0,0 +1,596 @@
+{
+ "cloud-owner": "att-aic",
+ "cloud-region-id": "ERROR",
+ "cloud-type": "openstack",
+ "owner-defined-type": "LCP",
+ "cloud-region-version": "3.0",
+ "cloud-zone": "AUS1",
+ "complex-name": "mtn6",
+ "resource-version": "1485202577",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-125"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2002"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-126"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0509A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0511C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_1Bindings_324_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-155"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "ST-MTN6-NoBinding-1707-18-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1710-4001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-119"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_1311"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "aaaa-bbbb-cccc-dddd-eeee"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "direct_dhcp_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512B"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-1Binding-1710-0814-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-MTN6-NoBinding-1707-20-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1111-2222-3333-4444-5555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "dev_Bindings_full_1710_0907A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "wwww-xxxx-yyyy-zzzz"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-1002"
+ }]
+ },
+ {
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR",
+ "relationship-data": [ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "AUSTTXGR"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json
new file mode 100644
index 0000000000..181494dff2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json
@@ -0,0 +1,141 @@
+{
+ "network-id": "467e3349-bec1-4922-bcb1-d0bb041bce30",
+ "network-name": "vprobes_pktinternal_net_4_1806",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "NetworkPktinternalInt2.pktinternal_int",
+ "network-technology": "",
+ "is-bound-to-vpn": false,
+ "service-id": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468",
+ "network-role-instance": 0,
+ "resource-version": "1527285069624",
+ "orchestration-status": "Assigned",
+ "physical-network-name": "tbd",
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/eb68dedb-840d-4bd4-a745-d9fcd8fc8468/service-data/networks/network/467e3349-bec1-4922-bcb1-d0bb041bce30/network-data/network-topology/",
+ "subnets": {
+ "subnet": [
+ {
+ "subnet-id": "46aee427-3aa0-4c1f-beb6-edf6caae2dc1",
+ "subnet-name": "vprobes_pktinternal_net_4_1806_subnet_1",
+ "gateway-address": "192.168.224.1",
+ "network-start-address": "192.168.224.0",
+ "cidr-mask": "21",
+ "ip-version": "4",
+ "orchestration-status": "PendingCreate",
+ "dhcp-enabled": false,
+ "dhcp-start": "192.168.224.3",
+ "dhcp-end": "192.168.224.5",
+ "subnet-role": "DHCP",
+ "ip-assignment-direction": "true",
+ "resource-version": "1527285068387",
+ "host-routes": {
+ "host-route": [
+ {
+ "host-route-id": "1de02743-580a-4f99-8285-3ba6eadb0892",
+ "route-prefix": "",
+ "next-hop": "",
+ "resource-version": "1527285059650"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/eb68dedb-840d-4bd4-a745-d9fcd8fc8468",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "Mobility"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "DYH1A"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "lcp"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "DYH1A"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "2871503957144f72b3cf481b379828ec"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "APP-C-24595-T-IST-04A"
+ }
+ ]
+ },
+ {
+ "related-to": "vpn-binding",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c",
+ "relationship-data": [
+ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "vMDNS"
+ },
+ {
+ "property-key": "vpn-binding.vpn-type"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json
new file mode 100644
index 0000000000..b22f389c40
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json
@@ -0,0 +1,166 @@
+{
+ "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "network-name": "Dev_Bindings_1802_020118",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "GN_EVPN_direct",
+ "network-technology": "contrail",
+ "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee",
+ "is-bound-to-vpn": true,
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance": 0,
+ "resource-version": "1517496965485",
+ "orchestration-status": "Active",
+ "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "physical-network-name": "tbd",
+ "is-provider-network": false,
+ "is-shared-network": true,
+ "is-external-network": false,
+ "subnets": {"subnet": [
+ {
+ "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108",
+ "subnet-name": "",
+ "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c",
+ "gateway-address": "192.168.41.1",
+ "network-start-address": "192.168.41.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.41.3",
+ "dhcp-end": "192.168.41.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965497"
+ },
+ {
+ "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01",
+ "subnet-name": "",
+ "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f",
+ "gateway-address": "192.168.42.1",
+ "network-start-address": "192.168.42.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.42.3",
+ "dhcp-end": "192.168.42.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965508"
+ }
+ ]},
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "MSO_1610_dev"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "MSO-dev-service-type"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1"
+ }]
+ },
+ {
+ "related-to": "cloud-region",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "LCP"
+ }]
+ },
+ {
+ "related-to": "tenant",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "ECOMP_MSO_DND"
+ }]
+ },
+ {
+ "related-to": "route-table-reference",
+ "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00",
+ "relationship-data": [ {
+ "relationship-key": "route-table-reference.route-table-reference-id",
+ "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00"
+ }],
+ "related-to-property": [ {
+ "property-key": "route-table-reference.route-table-reference-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:RTA"
+ }]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc",
+ "relationship-data": [ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc"
+ }],
+ "related-to-property": [ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD"
+ }]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64",
+ "relationship-data": [ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64"
+ }],
+ "related-to-property": [ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC"
+ }]
+ },
+ {
+ "related-to": "vpn-binding",
+ "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001",
+ "relationship-data": [ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "9a7b327d9-287aa00-82c4b0-100001"
+ }],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "MSO_VPN_TEST"
+ },
+ {"property-key": "vpn-binding.vpn-type"}
+ ]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json
new file mode 100644
index 0000000000..c581e54ef0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json
@@ -0,0 +1,53 @@
+{
+ "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "network-name": "Dev_Bindings_1802_020118",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "GN_EVPN_direct",
+ "network-technology": "contrail",
+ "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee",
+ "is-bound-to-vpn": true,
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance": 0,
+ "resource-version": "1517496965485",
+ "orchestration-status": "Active",
+ "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "physical-network-name": "tbd",
+ "is-provider-network": false,
+ "is-shared-network": true,
+ "is-external-network": false,
+ "subnets": {"subnet": [
+ {
+ "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108",
+ "subnet-name": "",
+ "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c",
+ "gateway-address": "192.168.41.1",
+ "network-start-address": "192.168.41.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.41.3",
+ "dhcp-end": "192.168.41.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965497"
+ },
+ {
+ "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01",
+ "subnet-name": "",
+ "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f",
+ "gateway-address": "192.168.42.1",
+ "network-start-address": "192.168.42.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.42.3",
+ "dhcp-end": "192.168.42.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965508"
+ }
+ ]},
+ "relationship-list": {"relationship": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json
new file mode 100644
index 0000000000..5d9231d4c6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json
@@ -0,0 +1,891 @@
+{
+ "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c",
+ "vpn-name": "vMDNS",
+ "resource-version": "1510956324462",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/b3376949-5487-4a74-9029-332c07720c07",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b3376949-5487-4a74-9029-332c07720c07"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vEPDG-FN-26642-T-01_hsl_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/d0b8ecd3-aee4-48ba-8bc5-222d3fb08162",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d0b8ecd3-aee4-48ba-8bc5-222d3fb08162"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/34305bd0-ad54-4349-8567-6f65ea09e750",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "34305bd0-ad54-4349-8567-6f65ea09e750"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_vEPDG-FN_swu_direct_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/dfa4972a-ed82-43cd-98be-ed73bb3406a9",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "dfa4972a-ed82-43cd-98be-ed73bb3406a9"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_Shared_EXN_INTERNET_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/93556256-aa23-449d-a2fd-3a9c034f232a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "93556256-aa23-449d-a2fd-3a9c034f232a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_CORE-NSD-TOAM0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/7ce01c3a-5998-4908-85f6-ab29bc507a92",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7ce01c3a-5998-4908-85f6-ab29bc507a92"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/016d3722-999b-4133-b4e6-8a1088bab664",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "016d3722-999b-4133-b4e6-8a1088bab664"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND-vepdg-FN-Shared_oam_protected_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/80038196-9eae-452c-ad06-1f3fef1bef9f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "80038196-9eae-452c-ad06-1f3fef1bef9f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net420"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/f5f38447-dc62-4969-90a3-c60474f9c0ac",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f5f38447-dc62-4969-90a3-c60474f9c0ac"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_3"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/58b374aa-01ca-4a39-99b9-889c2f7ae908",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "58b374aa-01ca-4a39-99b9-889c2f7ae908"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_OAM_MGMT_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/efe0dfca-18e7-4992-a63a-041b9f8271e0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "efe0dfca-18e7-4992-a63a-041b9f8271e0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_APN-dns_int_apn_dns_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/dab7e704-6a6e-4c53-9a80-fb5857a43b6f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "dab7e704-6a6e-4c53-9a80-fb5857a43b6f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/634653b3-9084-41d9-ad6a-40863a3d666f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "634653b3-9084-41d9-ad6a-40863a3d666f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-01A_int_fw_dns_trusted_net_5"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/6117b35e-c029-4308-85e6-007c24014484",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6117b35e-c029-4308-85e6-007c24014484"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-24595-D-T001_vprobes_int_mgmt_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/eb1ce51b-d10f-4b08-9166-345335b9f73b",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "eb1ce51b-d10f-4b08-9166-345335b9f73b"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_OAMP_NSD_ISBC0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/468f83be-4abb-4901-950b-e399b77a09a0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "468f83be-4abb-4901-950b-e399b77a09a0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_IRPR-TOAM0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/103d17dc-6575-427c-a2c1-301493e08ec0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "103d17dc-6575-427c-a2c1-301493e08ec0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/305214f8-64be-4209-8a0d-10b6dfb77dd1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "305214f8-64be-4209-8a0d-10b6dfb77dd1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_vMDS_FN_int_fw_dns_trusted_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/7989a6d2-ba10-4a5d-8f15-4520bc833090",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7989a6d2-ba10-4a5d-8f15-4520bc833090"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02AShared_cor_direct_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/f040ebf4-76ad-4b05-a766-1deec26549ae",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f040ebf4-76ad-4b05-a766-1deec26549ae"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vEPDG-FN-26642-T-01_gn_untrusted_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/26d6038b-4b9e-4fe5-bcff-9af7586651cc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "26d6038b-4b9e-4fe5-bcff-9af7586651cc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-24595-D-T001_vprobes_pktinternal_net_10"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/9e78d3f4-85b5-40b8-803e-c3a0ab6d6165",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "9e78d3f4-85b5-40b8-803e-c3a0ab6d6165"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_MNS_Shared_oam_protected_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/a2de22f9-eb91-452e-aff5-e81a1a679ef6",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "a2de22f9-eb91-452e-aff5-e81a1a679ef6"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_Shared_GN_DIRECT_NET_01"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/6d6b7254-72d2-4731-80d6-8e8375d959e9",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6d6b7254-72d2-4731-80d6-8e8375d959e9"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_VDBE-PED-DMZ0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/21819ac4-95c4-490f-ba7c-0ad92920f805",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "21819ac4-95c4-490f-ba7c-0ad92920f805"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_FN_int_pktinternal_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/98ff6827-320a-4b71-bd2b-df2bd20b6855",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "98ff6827-320a-4b71-bd2b-df2bd20b6855"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/e229ab86-279c-4505-a08a-91e373293e20",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e229ab86-279c-4505-a08a-91e373293e20"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_Shared_OAM_DIRECT_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/bb722f93-2d1a-42a5-bd11-57ad30ff1085",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "bb722f93-2d1a-42a5-bd11-57ad30ff1085"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/0399443d-1fc6-42a6-934c-77030d751916",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0399443d-1fc6-42a6-934c-77030d751916"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_VDBE-PED-DMZ0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/d259ec74-304d-4bd2-bbd6-93c201acba42",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d259ec74-304d-4bd2-bbd6-93c201acba42"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A__vprobes_int_mgmt_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/f69fb458-e2bd-4d0f-9a47-430d18cbebfd",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f69fb458-e2bd-4d0f-9a47-430d18cbebfd"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net4"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/0f18b91f-ee79-403b-a081-8c0a89650641",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0f18b91f-ee79-403b-a081-8c0a89650641"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_VPMS-FN_int_pktinternal_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/90fdbbbb-42bb-41ff-9356-db245466a4fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "90fdbbbb-42bb-41ff-9356-db245466a4fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_Shared_oam_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/0e66adce-d5dd-4968-bcb2-83f0281424db",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0e66adce-d5dd-4968-bcb2-83f0281424db"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B-VSHAKEN_VDBF-MIS-UDAT0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/db572383-dbd7-4d5e-93cb-8c7c1d209a90",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "db572383-dbd7-4d5e-93cb-8c7c1d209a90"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/478b7f86-8544-48e5-95f1-568dfd18730d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "478b7f86-8544-48e5-95f1-568dfd18730d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_Shared_GN_DIRECT_NET_01"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/0f725895-5224-4016-b49a-d9d016eaafff",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0f725895-5224-4016-b49a-d9d016eaafff"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/9cd47b0c-ee58-46f0-9ec5-b4db504dd59b",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "9cd47b0c-ee58-46f0-9ec5-b4db504dd59b"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-FN-25180-T-01Shared_oam_protected_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/f95259c9-f5c6-4861-a9f4-b6eec199b33f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f95259c9-f5c6-4861-a9f4-b6eec199b33f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/caf98ee4-2496-4c92-a41c-b6a50efcc29f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "caf98ee4-2496-4c92-a41c-b6a50efcc29f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_MGM-CORE-NSD-TOAM0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/754739cb-5371-4d5b-a02a-489587d17443",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "754739cb-5371-4d5b-a02a-489587d17443"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_4"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_VDBE-MIS-UDAT0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/7093921f-bed8-4866-bb3c-a2b8c376ca69",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7093921f-bed8-4866-bb3c-a2b8c376ca69"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_VIRPR-TDAT0_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/691da8b2-805e-4dd1-aaf5-b0e37414c662",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "691da8b2-805e-4dd1-aaf5-b0e37414c662"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_int_pktmirror_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/00eaa0b3-90df-4b43-a850-9d30abb7fded",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "00eaa0b3-90df-4b43-a850-9d30abb7fded"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-01AShared_oam_protected_net_5"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/6ba57200-c61a-46be-821b-88b3fa169b66",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6ba57200-c61a-46be-821b-88b3fa169b66"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_3"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/8e32ec2c-47a1-4514-b21a-2806e23f0437",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8e32ec2c-47a1-4514-b21a-2806e23f0437"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/a755ddd0-512a-444d-9f38-97b3eff70f85",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "a755ddd0-512a-444d-9f38-97b3eff70f85"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_UNTR_VSE_ISBC0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/c7bde85d-1c12-467c-ae6f-57bdf5c1d380",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c7bde85d-1c12-467c-ae6f-57bdf5c1d380"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/0933fcec-9e78-4045-a21a-8258e18cb78e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0933fcec-9e78-4045-a21a-8258e18cb78e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_vdbe_oam_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/6a26a729-d9ce-4619-a20e-38597205ba7d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6a26a729-d9ce-4619-a20e-38597205ba7d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/c1a06665-518b-408b-bfe0-8f393204baf6",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c1a06665-518b-408b-bfe0-8f393204baf6"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/fb51398b-7622-4570-9bd6-e29c82621d44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb51398b-7622-4570-9bd6-e29c82621d44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_4"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/92072731-1c40-45c2-a218-5e75b713b312",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "92072731-1c40-45c2-a218-5e75b713b312"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/c6d94632-fd6b-4bfe-993e-377b0368476b",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c6d94632-fd6b-4bfe-993e-377b0368476b"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-01AShared_int_ha_net_5"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/84516ef3-e371-4039-908e-83cd2b55a4a1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "84516ef3-e371-4039-908e-83cd2b55a4a1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "VPMS-FN-26071-T-BE-01_vprobes_int_mgmt_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/2c4f3adc-1a45-4484-8fb6-9eeac99eb922",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "2c4f3adc-1a45-4484-8fb6-9eeac99eb922"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_VDBE-MIS-UDAT0_net_0"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/8ab98982-05b7-45b2-828d-648da3d6cc0f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8ab98982-05b7-45b2-828d-648da3d6cc0f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/c8934d59-24a8-41cc-af9d-2026ef261843",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c8934d59-24a8-41cc-af9d-2026ef261843"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_vrar_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/c741fe5b-bf27-4ad9-b30d-20518e115495",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c741fe5b-bf27-4ad9-b30d-20518e115495"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_int_apn_dns_fn_net_PB_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/8285fbae-ec25-44f7-ac52-89a968d45a2b",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8285fbae-ec25-44f7-ac52-89a968d45a2b"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-T2B_vEPDG-FN_swu_direct_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/65e6d4b0-0c96-4bfa-bdd6-2baa16df322a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "65e6d4b0-0c96-4bfa-bdd6-2baa16df322a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-DND_vEPDG-FN_gn_untrusted_fn_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/38e51c7b-adc2-491a-a036-3189645b007c",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "38e51c7b-adc2-491a-a036-3189645b007c"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vprobes_pktinternal_net_2_1806"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/4d210b09-b6ce-41b3-95a6-5e4dffea9ca2",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4d210b09-b6ce-41b3-95a6-5e4dffea9ca2"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vprobes_pktinternal_net_3_1806"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/c5df1c57-3c85-4abc-973f-a1ffb13e391a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c5df1c57-3c85-4abc-973f-a1ffb13e391a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/467e3349-bec1-4922-bcb1-d0bb041bce30",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "467e3349-bec1-4922-bcb1-d0bb041bce30"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vprobes_pktinternal_net_4_1806"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v12/network/l3-networks/l3-network/1596f4d2-66b5-4627-96f2-c26794154530",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1596f4d2-66b5-4627-96f2-c26794154530"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_2"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml
new file mode 100644
index 0000000000..6dd91c64c9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml
@@ -0,0 +1,145 @@
+<l3-network xmlns="http://org.onap.aai.inventory/v11">
+ <network-id>8d35a433-c1db-4d54-a611-6de10aeb76f9</network-id>
+ <network-name>Dev_Bindings_1802_1311</network-name>
+ <network-type>CONTRAIL30_BASIC</network-type>
+ <network-role>GN_EVPN_direct</network-role>
+ <network-technology>contrail</network-technology>
+ <is-bound-to-vpn>true</is-bound-to-vpn>
+ <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
+ <network-role-instance>0</network-role-instance>
+ <resource-version>1517430804756</resource-version>
+ <orchestration-status>pending-create</orchestration-status>
+ <physical-network-name>tbd</physical-network-name>
+ <is-provider-network>true</is-provider-network>
+ <is-shared-network>true</is-shared-network>
+ <is-external-network>false</is-external-network>
+ <subnets>
+ <subnet>
+ <subnet-id>9dbb9e7e-fe18-421f-bad6-2305bd282471</subnet-id>
+ <subnet-name />
+ <gateway-address>107.118.41.1</gateway-address>
+ <network-start-address>107.118.41.0</network-start-address>
+ <cidr-mask>24</cidr-mask>
+ <ip-version>4</ip-version>
+ <orchestration-status>pending-create</orchestration-status>
+ <dhcp-enabled>true</dhcp-enabled>
+ <dhcp-start>107.118.41.3</dhcp-start>
+ <dhcp-end>107.118.41.45</dhcp-end>
+ <subnet-role />
+ <ip-assignment-direction>true</ip-assignment-direction>
+ <resource-version>1517430804770</resource-version>
+ </subnet>
+ <subnet>
+ <subnet-id>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</subnet-id>
+ <subnet-name />
+ <gateway-address>107.118.42.1</gateway-address>
+ <network-start-address>107.118.42.0</network-start-address>
+ <cidr-mask>24</cidr-mask>
+ <ip-version>4</ip-version>
+ <orchestration-status>pending-create</orchestration-status>
+ <dhcp-enabled>true</dhcp-enabled>
+ <dhcp-start>107.118.42.3</dhcp-start>
+ <dhcp-end>107.118.42.45</dhcp-end>
+ <subnet-role />
+ <ip-assignment-direction>true</ip-assignment-direction>
+ <resource-version>1517430804782</resource-version>
+ </subnet>
+ </subnets>
+ <relationship-list>
+ <relationship>
+ <related-to>service-instance</related-to>
+ <related-link>/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723</related-link>
+ <relationship-data>
+ <relationship-key>customer.global-customer-id</relationship-key>
+ <relationship-value>MSO_1610_dev</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>service-subscription.service-type</relationship-key>
+ <relationship-value>MSO-dev-service-type</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>service-instance.service-instance-id</relationship-key>
+ <relationship-value>f1d1c7da-fc42-4c31-866e-cfe963e55723</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>service-instance.service-instance-name</property-key>
+ <property-value>MSO-DEV-SI-1802-v6-1-31-nwk1</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>cloud-region</related-to>
+ <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>mtn6</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>cloud-region.owner-defined-type</property-key>
+ <property-value>LCP</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>tenant</related-to>
+ <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>mtn6</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>tenant.tenant-id</relationship-key>
+ <relationship-value>0422ffb57ba042c0800a29dc85ca70f8</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>tenant.tenant-name</property-key>
+ <property-value>ECOMP_MSO_DND</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>network-policy</related-to>
+ <related-link>/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc</related-link>
+ <relationship-data>
+ <relationship-key>network-policy.network-policy-id</relationship-key>
+ <relationship-value>0219d83f-7c4a-48e2-b8fc-9b20459356bc</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>network-policy.network-policy-fqdn</property-key>
+ <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyD</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>network-policy</related-to>
+ <related-link>/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64</related-link>
+ <relationship-data>
+ <relationship-key>network-policy.network-policy-id</relationship-key>
+ <relationship-value>e7a3560c-8b29-4611-a404-83af0b31ce64</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>network-policy.network-policy-fqdn</property-key>
+ <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyC</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>vpn-binding</related-to>
+ <related-link>/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001</related-link>
+ <relationship-data>
+ <relationship-key>vpn-binding.vpn-id</relationship-key>
+ <relationship-value>9a7b327d9-287aa00-82c4b0-100001</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>vpn-binding.vpn-name</property-key>
+ <property-value>MSO_VPN_TEST</property-value>
+ </related-to-property>
+ <related-to-property>
+ <property-key>vpn-binding.vpn-type</property-key>
+ </related-to-property>
+ </relationship>
+ </relationship-list>
+</l3-network> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json
new file mode 100644
index 0000000000..f076c9044c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json
@@ -0,0 +1,162 @@
+{
+ "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "network-name": "Dev_Bindings_1802_020118",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "GN_EVPN_direct",
+ "network-technology": "contrail",
+ "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee",
+ "is-bound-to-vpn": true,
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance": 0,
+ "resource-version": "1517496965485",
+ "orchestration-status": "Active",
+ "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "physical-network-name": "tbd",
+ "is-provider-network": false,
+ "is-shared-network": true,
+ "is-external-network": false,
+ "subnets": {"subnet": [
+ {
+ "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108",
+ "subnet-name": "",
+ "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c",
+ "gateway-address": "192.168.41.1",
+ "network-start-address": "192.168.41.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.41.3",
+ "dhcp-end": "192.168.41.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965497"
+ },
+ {
+ "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01",
+ "subnet-name": "",
+ "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f",
+ "gateway-address": "192.168.42.1",
+ "network-start-address": "192.168.42.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.42.3",
+ "dhcp-end": "192.168.42.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965508"
+ }
+ ]},
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "MSO_1610_dev"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "MSO-dev-service-type"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1"
+ }]
+ },
+ {
+ "related-to": "cloud-region",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "LCP"
+ }]
+ },
+ {
+ "related-to": "vf-module",
+ "related-link": "aai/v11/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "105df7e5-0b3b-49f7-a837-4864b62827c4"
+ },
+ {
+ "relationship-key": "vf-module.vf-module-id",
+ "relationship-value": "d9217058-95a0-49ee-b9a9-949259e89349"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "ECOMP_MSO_DND"
+ }]
+ },
+ {
+ "related-to": "route-table-reference",
+ "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00",
+ "relationship-data": [ {
+ "relationship-key": "route-table-reference.route-table-reference-id",
+ "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00"
+ }],
+ "related-to-property": [ {
+ "property-key": "route-table-reference.route-table-reference-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:RTA"
+ }]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc",
+ "relationship-data": [ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc"
+ }],
+ "related-to-property": [ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD"
+ }]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64",
+ "relationship-data": [ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64"
+ }],
+ "related-to-property": [ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC"
+ }]
+ },
+ {
+ "related-to": "vpn-binding",
+ "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001",
+ "relationship-data": [ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "9a7b327d9-287aa00-82c4b0-100001"
+ }],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "MSO_VPN_TEST"
+ },
+ {"property-key": "vpn-binding.vpn-type"}
+ ]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml
new file mode 100644
index 0000000000..92fec2dc64
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml
@@ -0,0 +1,149 @@
+<l3-network xmlns="http://org.onap.aai.inventory/v11">
+ <network-id>8d35a433-c1db-4d54-a611-6de10aeb76f9</network-id>
+ <network-name>Dev_Bindings_1802_1311</network-name>
+ <network-type>CONTRAIL30_BASIC</network-type>
+ <network-role>GN_EVPN_direct</network-role>
+ <network-technology>contrail</network-technology>
+ <neutron-network-id>b6a7820c-4734-4ef2-8a73-a22c824423fa</neutron-network-id>
+ <is-bound-to-vpn>true</is-bound-to-vpn>
+ <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
+ <network-role-instance>0</network-role-instance>
+ <resource-version>1517430804756</resource-version>
+ <orchestration-status>Created</orchestration-status>
+ <heat-stack-id>Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7</heat-stack-id>
+ <contrail-network-fqdn>default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311</contrail-network-fqdn>
+ <physical-network-name>tbd</physical-network-name>
+ <is-provider-network>true</is-provider-network>
+ <is-shared-network>true</is-shared-network>
+ <is-external-network>false</is-external-network>
+ <subnets>
+ <subnet>
+ <subnet-id>9dbb9e7e-fe18-421f-bad6-2305bd282471</subnet-id>
+ <neutron-subnet-id>27d414c7-1076-4595-aa45-4717ee992cef</neutron-subnet-id>
+ <gateway-address>107.118.41.1</gateway-address>
+ <network-start-address>107.118.41.0</network-start-address>
+ <cidr-mask>24</cidr-mask>
+ <ip-version>4</ip-version>
+ <orchestration-status>Created</orchestration-status>
+ <dhcp-enabled>true</dhcp-enabled>
+ <dhcp-start>107.118.41.3</dhcp-start>
+ <dhcp-end>107.118.41.45</dhcp-end>
+ <resource-version>1517430804770</resource-version>
+ <subnet-name/>
+ <ip-assignment-direction>true</ip-assignment-direction>
+ </subnet>
+ <subnet>
+ <subnet-id>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</subnet-id>
+ <neutron-subnet-id>db64710c-fbbc-4dc9-8109-3925b87268fa</neutron-subnet-id>
+ <gateway-address>107.118.42.1</gateway-address>
+ <network-start-address>107.118.42.0</network-start-address>
+ <cidr-mask>24</cidr-mask>
+ <ip-version>4</ip-version>
+ <orchestration-status>Created</orchestration-status>
+ <dhcp-enabled>true</dhcp-enabled>
+ <dhcp-start>107.118.42.3</dhcp-start>
+ <dhcp-end>107.118.42.45</dhcp-end>
+ <resource-version>1517430804782</resource-version>
+ <subnet-name/>
+ <ip-assignment-direction>true</ip-assignment-direction>
+ </subnet>
+ </subnets>
+ <relationship-list>
+ <relationship>
+ <related-to>service-instance</related-to>
+ <related-link>/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723</related-link>
+ <relationship-data>
+ <relationship-key>customer.global-customer-id</relationship-key>
+ <relationship-value>MSO_1610_dev</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>service-subscription.service-type</relationship-key>
+ <relationship-value>MSO-dev-service-type</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>service-instance.service-instance-id</relationship-key>
+ <relationship-value>f1d1c7da-fc42-4c31-866e-cfe963e55723</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>service-instance.service-instance-name</property-key>
+ <property-value>MSO-DEV-SI-1802-v6-1-31-nwk1</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>cloud-region</related-to>
+ <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>mtn6</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>cloud-region.owner-defined-type</property-key>
+ <property-value>LCP</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>tenant</related-to>
+ <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>mtn6</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>tenant.tenant-id</relationship-key>
+ <relationship-value>0422ffb57ba042c0800a29dc85ca70f8</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>tenant.tenant-name</property-key>
+ <property-value>ECOMP_MSO_DND</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>network-policy</related-to>
+ <related-link>/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc</related-link>
+ <relationship-data>
+ <relationship-key>network-policy.network-policy-id</relationship-key>
+ <relationship-value>0219d83f-7c4a-48e2-b8fc-9b20459356bc</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>network-policy.network-policy-fqdn</property-key>
+ <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyD</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>network-policy</related-to>
+ <related-link>/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64</related-link>
+ <relationship-data>
+ <relationship-key>network-policy.network-policy-id</relationship-key>
+ <relationship-value>e7a3560c-8b29-4611-a404-83af0b31ce64</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>network-policy.network-policy-fqdn</property-key>
+ <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyC</property-value>
+ </related-to-property>
+ </relationship>
+ <relationship>
+ <related-to>vpn-binding</related-to>
+ <related-link>/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001</related-link>
+ <relationship-data>
+ <relationship-key>vpn-binding.vpn-id</relationship-key>
+ <relationship-value>9a7b327d9-287aa00-82c4b0-100001</relationship-value>
+ </relationship-data>
+ <related-to-property>
+ <property-key>vpn-binding.vpn-name</property-key>
+ <property-value>MSO_VPN_TEST</property-value>
+ </related-to-property>
+ <related-to-property>
+ <property-key>vpn-binding.vpn-type</property-key>
+ <property-value/>
+ </related-to-property>
+ </relationship>
+ </relationship-list>
+</l3-network> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json
new file mode 100644
index 0000000000..75ecffb85f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json
@@ -0,0 +1,87 @@
+{
+ "externalNetwork": false,
+ "sharedNetwork": false,
+ "providerNetwork": false,
+ "boundToVpn": false,
+ "network-id": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb",
+ "cascaded": false,
+ "cloud-params": {
+
+ },
+ "network-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1",
+ "neutron-network-id": null,
+ "network-type": "CONTRAIL30_BASIC",
+ "network-technology": "contrail",
+ "network-role": "DataEvaletNetwork.data",
+ "is-bound-to-vpn": false,
+ "service-id": "94508dbd-fe6e-496b-95ef-dd5612b56767",
+ "network-role-instance": 0,
+ "orchestration-status": "ASSIGNED",
+ "heat-stack-id": null,
+ "contrail-network-fqdn": null,
+ "network-policies": [],
+ "contrail-network-route-table-references": [],
+ "widget-model-id": null,
+ "widget-model-version": null,
+ "physical-network-name": "FALSE",
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "self-link": "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/",
+ "operational-status": null,
+ "subnets": [
+ {
+ "subnet-id": "95069612-23af-4181-bf99-8b2bd6096712",
+ "subnet-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1",
+ "neutron-subnet-id": null,
+ "gateway-address": "107.244.64.1",
+ "network-start-address": "107.244.64.2",
+ "cidr-mask": "20",
+ "ip-version": "4",
+ "orchestration-status": null,
+ "dhcp-enabled": false,
+ "dhcp-start": "",
+ "dhcp-end": "",
+ "subnet-role": "",
+ "ip-assignment-direction": "true",
+ "subnet-sequence": null,
+ "host-routes": []
+ }
+ ],
+ "ctag-assignments": [],
+ "segmentation-assignments": [],
+ "model-info-network": {
+ "created": 1509357220000,
+ "modelInstanceName": "CONTRAIL30_BASIC",
+ "networkType": "BASIC",
+ "modelCustomizationUUID": "8edf06ef-fd40-42cf-a054-0fc09108d3f0",
+ "modelUUID": "2920cd06-f585-436b-a002-c3081f6a91b3",
+ "modelName": "CONTRAIL30_BASIC",
+ "modelVersion": "3.0",
+ "modelInvariantUUID": "56f4e746-c58e-4b76-93d4-6717b8f59205",
+ "networkRole": "DataEvaletNetwork.data",
+ "neutronNetworkType": "BASIC",
+ "toscaNodeType": "org.openecomp.resource.vl.CONTRAIL30_BASIC1",
+ "description": "Basic contrail 3.0.x L3 network for AIC 3.x sites. Keeping for existing mobility networks. ",
+ "orchestrationMode": "HEAT",
+ "aicVersionMin": "3.0",
+ "aicVersionMax": null,
+ "networkScope": "Service",
+ "networkTechnology": "contrail",
+ "model-customization-uuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0",
+ "model-instance-name": "CONTRAIL30_BASIC",
+ "network-technology": "contrail",
+ "network-type": "BASIC",
+ "network-scope": "Service",
+ "network-role": "DataEvaletNetwork.data",
+ "model-version": "3.0",
+ "model-invariant-uuid": "56f4e746-c58e-4b76-93d4-6717b8f59205",
+ "model-name": "CONTRAIL30_BASIC",
+ "model-uuid": "2920cd06-f585-436b-a002-c3081f6a91b3",
+ "neutron-network-type": "BASIC",
+ "aic-version-min": "3.0",
+ "aic-version-max": null,
+ "orchestration-mode": "HEAT",
+ "tosca-node-type": "org.openecomp.resource.vl.CONTRAIL30_BASIC1"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
new file mode 100644
index 0000000000..087f8a3971
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
@@ -0,0 +1,42 @@
+{
+ "cloudSiteId": "cloudRegionPo",
+ "tenantId": "testTenantId",
+ "networkId": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb",
+ "networkName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1",
+ "networkType": "CONTRAIL30_BASIC",
+ "modelCustomizationUuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0",
+ "networkTechnology": "NEUTRON",
+ "subnets": [
+ {
+ "subnetName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1",
+ "subnetId": "95069612-23af-4181-bf99-8b2bd6096712",
+ "cidr": "107.244.64.2/20",
+ "gatewayIp": "107.244.64.1",
+ "ipVersion": "4",
+ "enableDHCP": false,
+ "addrFromStart": true,
+ "hostRoutes": []
+ }
+ ],
+ "providerVlanNetwork": {
+ "physicalNetworkName": "FALSE",
+ "vlans": []
+ },
+ "contrailNetwork": {
+ "shared": "false",
+ "external": "false",
+ "routeTargets": [],
+ "policyFqdns": [],
+ "routeTableFqdns": []
+ },
+ "failIfExists": true,
+ "backout": false,
+ "msoRequest": {
+ "requestId": "6cfde724-76c7-4747-bcb3-67a59a46ca95",
+ "serviceInstanceId": "testServiceInstanceId1"
+ },
+ "contrailRequest": false,
+ "skipAAI": true,
+ "messageId": "175264dc-fb6b-4aae-ba42-8c77a63fec12",
+ "synchronous": true
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json
new file mode 100644
index 0000000000..4817dfb74d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json
@@ -0,0 +1,153 @@
+{
+ "requestContext" : {
+ "product-family-id" : "e433710f-9217-458d-a79d-1c7aff376d89",
+ "source" : "VID",
+ "requestor-id" : "rk627c",
+ "subscription-service-type" : null,
+ "user-params" : null,
+ "action" : "createInstance",
+ "callback-url" : null,
+ "service-uri" : null,
+ "mso-request-id" : "91135621-cadd-4195-a11b-c9db9eb1629e",
+ "requestParameters" : { }
+ },
+ "orchContext" : {
+ "is-rollback-enabled" : false
+ },
+ "userInput" : null,
+ "serviceInstance" : {
+ "service-instance-id" : "94508dbd-fe6e-496b-95ef-dd5612b56767",
+ "service-instance-name" : "data_eValet_network_rk_01",
+ "orchestration-status" : "ACTIVE",
+ "owning-entity" : {
+ "owning-entity-id" : "e4257a94-21cc-40c5-adc9-e6f4ff868e31",
+ "owning-entity-name" : "MOBILITY-CORE"
+ },
+ "project" : {
+ "project-name" : "USP"
+ },
+ "collection" : null,
+ "vnfs" : [ ],
+ "pnfs" : [ ],
+ "allotted-resources" : [ ],
+ "networks" : [ {
+ "network-id" : "e87e6df5-6f9b-4aa1-a832-68a42c4277eb",
+ "cascaded" : false,
+ "cloud-params" : { },
+ "network-name" : "APP-C-24595-T-IST-04AShared_data_vDB_net_1",
+ "neutron-network-id" : null,
+ "network-type" : "CONTRAIL30_BASIC",
+ "network-technology" : "contrail",
+ "network-role" : "DataEvaletNetwork.data",
+ "is-bound-to-vpn" : false,
+ "service-id" : "94508dbd-fe6e-496b-95ef-dd5612b56767",
+ "network-role-instance" : 0,
+ "orchestration-status" : "ASSIGNED",
+ "heat-stack-id" : null,
+ "contrail-network-fqdn" : null,
+ "network-policies" : [ ],
+ "contrail-network-route-table-references" : [ ],
+ "widget-model-id" : null,
+ "widget-model-version" : null,
+ "physical-network-name" : "FALSE",
+ "is-provider-network" : false,
+ "is-shared-network" : false,
+ "is-external-network" : false,
+ "self-link" : "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/",
+ "operational-status" : null,
+ "subnets" : [ {
+ "subnet-id" : "95069612-23af-4181-bf99-8b2bd6096712",
+ "subnet-name" : "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1",
+ "neutron-subnet-id" : null,
+ "gateway-address" : "107.244.64.1",
+ "network-start-address" : "107.244.64.2",
+ "cidr-mask" : "20",
+ "ip-version" : "4",
+ "orchestration-status" : null,
+ "dhcp-enabled" : false,
+ "dhcp-start" : "",
+ "dhcp-end" : "",
+ "subnet-role" : "",
+ "ip-assignment-direction" : "true",
+ "subnet-sequence" : null,
+ "host-routes" : [ ]
+ } ],
+ "ctag-assignments" : [ ],
+ "segmentation-assignments" : [ ],
+ "model-info-network" : {
+ "created" : 1509357220000,
+ "modelInstanceName" : "CONTRAIL30_BASIC",
+ "networkType" : "BASIC",
+ "modelCustomizationUUID" : "8edf06ef-fd40-42cf-a054-0fc09108d3f0",
+ "modelUUID" : "2920cd06-f585-436b-a002-c3081f6a91b3",
+ "modelName" : "CONTRAIL30_BASIC",
+ "modelVersion" : "3.0",
+ "modelInvariantUUID" : "56f4e746-c58e-4b76-93d4-6717b8f59205",
+ "networkRole" : "DataEvaletNetwork.data",
+ "neutronNetworkType" : "BASIC",
+ "toscaNodeType" : "org.openecomp.resource.vl.CONTRAIL30_BASIC1",
+ "description" : "Basic contrail 3.0.x L3 network for AIC 3.x sites. Keeping for existing mobility networks. ",
+ "orchestrationMode" : "HEAT",
+ "aicVersionMin" : "3.0",
+ "aicVersionMax" : null,
+ "networkScope" : "Service",
+ "networkTechnology" : "contrail",
+ "model-customization-uuid" : "8edf06ef-fd40-42cf-a054-0fc09108d3f0",
+ "model-instance-name" : "CONTRAIL30_BASIC",
+ "network-technology" : "contrail",
+ "network-type" : "BASIC",
+ "network-scope" : "Service",
+ "network-role" : "DataEvaletNetwork.data",
+ "model-version" : "3.0",
+ "model-invariant-uuid" : "56f4e746-c58e-4b76-93d4-6717b8f59205",
+ "model-name" : "CONTRAIL30_BASIC",
+ "model-uuid" : "2920cd06-f585-436b-a002-c3081f6a91b3",
+ "neutron-network-type" : "BASIC",
+ "aic-version-min" : "3.0",
+ "aic-version-max" : null,
+ "orchestration-mode" : "HEAT",
+ "tosca-node-type" : "org.openecomp.resource.vl.CONTRAIL30_BASIC1"
+ }
+ } ],
+ "vpn-bonding-links" : [ ],
+ "vhn-portal-url" : null,
+ "service-instance-location-id" : null,
+ "selflink" : "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/service-topology/",
+ "metadata" : null,
+ "configurations" : null,
+ "solution-info" : null,
+ "model-info-service-instance" : {
+ "model-customization-uuid" : null,
+ "model-invariant-uuid" : "97386301-3685-46b5-8a5a-bf113eb9a006",
+ "model-uuid" : "4d6f5876-7f3d-458e-9722-33af804ee717",
+ "model-version" : "1.0",
+ "model-instance-name" : null,
+ "model-name" : "data_eValet_network",
+ "description" : "data model",
+ "created" : "Thu Jul 05 19:48:51 GMT 2018",
+ "service-type" : "vUSP",
+ "service-role" : "data",
+ "environment-context" : "General_Revenue-Bearing",
+ "workload-context" : "Production"
+ }
+ },
+ "cloudRegion" : {
+ "lcp-cloud-region-id" : "DYH1A",
+ "cloud-owner" : "att-aic",
+ "tenant-id" : "7f3db563322146a688601ade1294a749",
+ "complex" : "c1",
+ "cloud-region-version" : "aic3.0"
+ },
+ "customer" : {
+ "global-customer-id" : "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriber-name" : "USP VOICE",
+ "subscriber-type" : "INFRA",
+ "subscriber-common-site-id" : null,
+ "service-subscription" : {
+ "service-type" : "VIRTUAL USP",
+ "temp-ub-sub-account-id" : null,
+ "service-instances" : [ ]
+ },
+ "vpn-bindings" : [ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json
new file mode 100644
index 0000000000..36bc04b6c6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json
@@ -0,0 +1,141 @@
+{
+ "network-id": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb",
+ "network-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "DataEvaletNetwork.data",
+ "network-technology": "contrail",
+ "is-bound-to-vpn": false,
+ "service-id": "94508dbd-fe6e-496b-95ef-dd5612b56767",
+ "network-role-instance": 0,
+ "resource-version": "1531421309278",
+ "orchestration-status": "Assigned",
+ "physical-network-name": "FALSE",
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/",
+ "subnets": {
+ "subnet": [
+ {
+ "subnet-id": "95069612-23af-4181-bf99-8b2bd6096712",
+ "subnet-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1",
+ "gateway-address": "107.244.64.1",
+ "network-start-address": "107.244.64.2",
+ "cidr-mask": "20",
+ "ip-version": "4",
+ "orchestration-status": "PendingCreate",
+ "dhcp-enabled": false,
+ "dhcp-start": "",
+ "dhcp-end": "",
+ "subnet-role": "",
+ "ip-assignment-direction": "true",
+ "resource-version": "1531421308312",
+ "host-routes": {
+ "host-route": [
+ {
+ "host-route-id": "1047bf36-ca6c-49de-8b7a-8aa7b766a96d",
+ "route-prefix": "",
+ "next-hop": "",
+ "resource-version": "1531421301537"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v13/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/94508dbd-fe6e-496b-95ef-dd5612b56767",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "VIRTUAL USP"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "94508dbd-fe6e-496b-95ef-dd5612b56767"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "data_eValet_network_rk_01"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "DYH1A"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "lcp"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/7f3db563322146a688601ade1294a749",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "DYH1A"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "7f3db563322146a688601ade1294a749"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "APP-C-24595-T-IST-04B"
+ }
+ ]
+ },
+ {
+ "related-to": "vpn-binding",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c",
+ "relationship-data": [
+ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "vMDNS"
+ },
+ {
+ "property-key": "vpn-binding.vpn-type"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
new file mode 100644
index 0000000000..ba7ab9e3b8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
@@ -0,0 +1,6 @@
+{
+ "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800},
+ "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"},
+ "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}},
+ "licenseInfo" : []
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
new file mode 100644
index 0000000000..c5d0ffe38d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
@@ -0,0 +1,6 @@
+{
+ "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800},
+ "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"},
+ "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}},
+ "licenseInfo" : []
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json
new file mode 100644
index 0000000000..7d26ab975b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json
@@ -0,0 +1,7 @@
+{
+ "ctagAssignment" : [ {
+ "vlanIdInner" : 1,
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json
new file mode 100644
index 0000000000..81362e3dca
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json
@@ -0,0 +1,20 @@
+{
+ "networkId": "networkId",
+ "networkName": "networkName",
+ "neutronNetworkId": "neutronNetworkId",
+ "isBoundToVpn": false,
+ "serviceId": "serviceId",
+ "networkRoleInstance": 0,
+ "orchestrationStatus": "Assigned",
+ "heatStackId": "heatStackId",
+ "contrailNetworkFqdn": "contrailNetworkFqdn",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersionId": "modelUUID",
+ "modelCustomizationId": "modelCustomizationUUID",
+ "physicalNetworkName": "physicalNetworkName",
+ "isProviderNetwork": false,
+ "isSharedNetwork": false,
+ "isExternalNetwork": false,
+ "selflink": "selflink",
+ "operationalStatus": "operationalStatus"
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json
new file mode 100644
index 0000000000..7a30ade095
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json
@@ -0,0 +1,118 @@
+{
+ "networkId" : "TESTING_ID",
+ "networkName" : "TESTING_NAME",
+ "networkType" : "CONTRAIL_EXTERNAL",
+ "networkRole" : "dmz_direct",
+ "networkTechnology" : "contrail",
+ "neutronNetworkId" : null,
+ "isBoundToVpn" : false,
+ "serviceId" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "networkRoleInstance" : 1,
+ "resourceVersion" : null,
+ "orchestrationStatus" : "Created",
+ "heatStackId" : "heatStack_id",
+ "msoCatalogKey" : null,
+ "contrailNetworkFqdn" : "contrailNetwork_fqdn",
+ "modelInvariantId" : "modelInvariant_id",
+ "modelVersionId" : "modelCustomization_id",
+ "personaModelVersion" : null,
+ "modelCustomizationId" : "modelCustomization_id",
+ "widgetModelId" : "widgetModel_id",
+ "widgetModelVersion" : "widgetModel_version",
+ "physicalNetworkName" : "physicalNetwork_name",
+ "isProviderNetwork" : false,
+ "isSharedNetwork" : false,
+ "isExternalNetwork" : false,
+ "selflink" : "self_link",
+ "operationalStatus" : "operationalStatus",
+ "subnets" : {
+ "subnet" : [ {
+ "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc",
+ "subnetName" : "subnetName",
+ "neutronSubnetId" : null,
+ "gatewayAddress" : "192.168.52.1",
+ "networkStartAddress" : null,
+ "cidrMask" : "24",
+ "ipVersion" : "4",
+ "orchestrationStatus" : "Created",
+ "dhcpEnabled" : true,
+ "dhcpStart" : "dhcpStart",
+ "dhcpEnd" : "dhcpEnd",
+ "subnetRole" : "subnetRole",
+ "ipAssignmentDirection" : "true",
+ "resourceVersion" : null,
+ "subnetSequence" : 3,
+ "hostRoutes" : {
+ "hostRoute" : [ {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.10.16.0/24",
+ "nextHop" : "192.10.16.100/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ }, {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.110.17.0/24",
+ "nextHop" : "192.110.17.110/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+ },
+ "relationshipList" : null
+ }, {
+ "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc",
+ "subnetName" : "subnetName",
+ "neutronSubnetId" : null,
+ "gatewayAddress" : "192.168.52.1",
+ "networkStartAddress" : null,
+ "cidrMask" : "24",
+ "ipVersion" : "4",
+ "orchestrationStatus" : "Created",
+ "dhcpEnabled" : true,
+ "dhcpStart" : "dhcpStart",
+ "dhcpEnd" : "dhcpEnd",
+ "subnetRole" : "subnetRole",
+ "ipAssignmentDirection" : "true",
+ "resourceVersion" : null,
+ "subnetSequence" : 3,
+ "hostRoutes" : {
+ "hostRoute" : [ {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.10.16.0/24",
+ "nextHop" : "192.10.16.100/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ }, {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.110.17.0/24",
+ "nextHop" : "192.110.17.110/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+ },
+ "relationshipList" : null
+ } ]
+ },
+ "ctagAssignments" : {
+ "ctagAssignment" : [ {
+ "vlanIdInner" : 1,
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+ },
+ "segmentationAssignments" : {
+ "segmentationAssignment" : [ {
+ "segmentationId" : "segmentationId1",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ }, {
+ "segmentationId" : "segmentationId2",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+ },
+ "relationshipList" : null
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json
new file mode 100644
index 0000000000..b22f389c40
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json
@@ -0,0 +1,166 @@
+{
+ "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "network-name": "Dev_Bindings_1802_020118",
+ "network-type": "CONTRAIL30_BASIC",
+ "network-role": "GN_EVPN_direct",
+ "network-technology": "contrail",
+ "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee",
+ "is-bound-to-vpn": true,
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance": 0,
+ "resource-version": "1517496965485",
+ "orchestration-status": "Active",
+ "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "physical-network-name": "tbd",
+ "is-provider-network": false,
+ "is-shared-network": true,
+ "is-external-network": false,
+ "subnets": {"subnet": [
+ {
+ "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108",
+ "subnet-name": "",
+ "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c",
+ "gateway-address": "192.168.41.1",
+ "network-start-address": "192.168.41.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.41.3",
+ "dhcp-end": "192.168.41.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965497"
+ },
+ {
+ "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01",
+ "subnet-name": "",
+ "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f",
+ "gateway-address": "192.168.42.1",
+ "network-start-address": "192.168.42.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "orchestration-status": "Active",
+ "dhcp-enabled": true,
+ "dhcp-start": "192.168.42.3",
+ "dhcp-end": "192.168.42.45",
+ "ip-assignment-direction": "",
+ "resource-version": "1517496965508"
+ }
+ ]},
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "MSO_1610_dev"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "MSO-dev-service-type"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1"
+ }]
+ },
+ {
+ "related-to": "cloud-region",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "LCP"
+ }]
+ },
+ {
+ "related-to": "tenant",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "ECOMP_MSO_DND"
+ }]
+ },
+ {
+ "related-to": "route-table-reference",
+ "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00",
+ "relationship-data": [ {
+ "relationship-key": "route-table-reference.route-table-reference-id",
+ "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00"
+ }],
+ "related-to-property": [ {
+ "property-key": "route-table-reference.route-table-reference-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:RTA"
+ }]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc",
+ "relationship-data": [ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc"
+ }],
+ "related-to-property": [ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD"
+ }]
+ },
+ {
+ "related-to": "network-policy",
+ "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64",
+ "relationship-data": [ {
+ "relationship-key": "network-policy.network-policy-id",
+ "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64"
+ }],
+ "related-to-property": [ {
+ "property-key": "network-policy.network-policy-fqdn",
+ "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC"
+ }]
+ },
+ {
+ "related-to": "vpn-binding",
+ "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001",
+ "relationship-data": [ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "9a7b327d9-287aa00-82c4b0-100001"
+ }],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "MSO_VPN_TEST"
+ },
+ {"property-key": "vpn-binding.vpn-type"}
+ ]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json
new file mode 100644
index 0000000000..9da44edd74
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json
@@ -0,0 +1,11 @@
+{
+ "segmentationAssignment" : [ {
+ "segmentationId" : "segmentationId1",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ }, {
+ "segmentationId" : "segmentationId2",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json
new file mode 100644
index 0000000000..4046348673
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json
@@ -0,0 +1,71 @@
+{
+ "subnet" : [ {
+ "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc",
+ "subnetName" : "subnetName",
+ "neutronSubnetId" : null,
+ "gatewayAddress" : "192.168.52.1",
+ "networkStartAddress" : null,
+ "cidrMask" : "24",
+ "ipVersion" : "4",
+ "orchestrationStatus" : "Created",
+ "dhcpEnabled" : true,
+ "dhcpStart" : "dhcpStart",
+ "dhcpEnd" : "dhcpEnd",
+ "subnetRole" : "subnetRole",
+ "ipAssignmentDirection" : "true",
+ "resourceVersion" : null,
+ "subnetSequence" : 3,
+ "hostRoutes" : {
+ "hostRoute" : [ {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.10.16.0/24",
+ "nextHop" : "192.10.16.100/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ }, {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.110.17.0/24",
+ "nextHop" : "192.110.17.110/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+ },
+ "relationshipList" : null
+ }, {
+ "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc",
+ "subnetName" : "subnetName",
+ "neutronSubnetId" : null,
+ "gatewayAddress" : "192.168.52.1",
+ "networkStartAddress" : null,
+ "cidrMask" : "24",
+ "ipVersion" : "4",
+ "orchestrationStatus" : "Created",
+ "dhcpEnabled" : true,
+ "dhcpStart" : "dhcpStart",
+ "dhcpEnd" : "dhcpEnd",
+ "subnetRole" : "subnetRole",
+ "ipAssignmentDirection" : "true",
+ "resourceVersion" : null,
+ "subnetSequence" : 3,
+ "hostRoutes" : {
+ "hostRoute" : [ {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.10.16.0/24",
+ "nextHop" : "192.10.16.100/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ }, {
+ "hostRouteId" : "string",
+ "routePrefix" : "192.110.17.0/24",
+ "nextHop" : "192.110.17.110/24",
+ "nextHopType" : "ip-address",
+ "resourceVersion" : null,
+ "relationshipList" : null
+ } ]
+ },
+ "relationshipList" : null
+ } ]
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json
new file mode 100644
index 0000000000..09ec71f0aa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json
@@ -0,0 +1,12 @@
+{
+
+ "modelCustomizationId" : "f",
+ "vfModuleId" : "a",
+ "vfModuleName" : "b",
+ "modelInvariantId" : "g",
+ "modelVersionId" : "h",
+ "orchestrationStatus" : "Assigned",
+ "personaModelVersion" : "g",
+ "isBaseVfModule" : false
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json
new file mode 100644
index 0000000000..09026d1d8c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json
@@ -0,0 +1,47 @@
+{
+ "serviceResources": {
+ "serviceType": null,
+ "serviceAllottedResources": [],
+ "modelInfo": {
+ "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8",
+ "modelName": "ADIOD vRouter vCE 011017 Service",
+ "modelVersion": "5.0",
+ "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4"
+ },
+ "serviceRole": null,
+ "serviceVnfs": [
+ {
+ "toscaNodeType": "org.openecomp.resource.vf.AdiodVce",
+ "vfModules": [
+ {
+ "initialCount": null,
+ "vfModuleLabel": null,
+ "modelInfo": {
+ "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5",
+ "modelName": "AdiodVce..base_vCE..module-0",
+ "modelVersion": "2",
+ "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829",
+ "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276"
+ },
+ "hasVolumeGroup": true,
+ "isBase": true
+ }
+ ],
+ "modelInfo": {
+ "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelName": "ADIoD vCE",
+ "modelVersion": "2.0",
+ "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587",
+ "modelInstanceName": "ADIoD vCE 0",
+ "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1"
+ },
+ "nfRole": "",
+ "nfType": "",
+ "nfFunction": "",
+ "nfNamingCode": "",
+ "multiStageDesign": "N"
+ }
+ ],
+ "serviceNetworks": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json
new file mode 100644
index 0000000000..9c50c2f11b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json
@@ -0,0 +1,7 @@
+{
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
new file mode 100644
index 0000000000..cc32040f38
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
@@ -0,0 +1,53 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : null,
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : null
+ },
+ "network-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "network-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ } ]
+ },
+ "network-name" : "TEST_NETWORK_NAME",
+ "network-instance-group-id" : "networkInstanceGroupId"
+ },
+ "request-information" : {
+ "notification-url" : null,
+ "order-version" : null,
+ "request-action" : "CreateNetworkInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "assign"
+ },
+ "network-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : "modelCustomizationUUID",
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "network-id" : "TEST_NETWORK_ID",
+ "network-type" : null
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
new file mode 100644
index 0000000000..40946725d9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
@@ -0,0 +1,52 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : null,
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : null
+ },
+ "network-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "network-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ } ]
+ },
+ "network-instance-group-id" : "networkInstanceGroupId"
+ },
+ "request-information" : {
+ "notification-url" : null,
+ "order-version" : null,
+ "request-action" : "CreateNetworkInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "assign"
+ },
+ "network-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : "modelCustomizationUUID",
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "network-id" : "TEST_NETWORK_ID",
+ "network-type" : null
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
new file mode 100644
index 0000000000..7ca8153def
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
@@ -0,0 +1,53 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : null,
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : null
+ },
+ "network-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "network-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ } ]
+ },
+ "network-name" : "TEST_NETWORK_NAME",
+ "network-instance-group-id" : "networkInstanceGroupId"
+ },
+ "request-information" : {
+ "notification-url" : null,
+ "order-version" : null,
+ "request-action" : "DeleteNetworkInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "unassign"
+ },
+ "network-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : "modelCustomizationUUID",
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "network-id" : "TEST_NETWORK_ID",
+ "network-type" : null
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
new file mode 100644
index 0000000000..4231152d86
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
@@ -0,0 +1,69 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "serviceModelName",
+ "model-version" : "serviceModelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "serviceModelUuid",
+ "model-invariant-uuid" : "serviceModelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : "serviceInstanceId",
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : "serviceInstanceId"
+ },
+ "vf-module-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "vf-module-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ },
+ {
+ "name" : "volume-group-id",
+ "value" : "volumeGroupId"
+ } ]
+ },
+ "vf-module-name" : "testVfModuleName"
+ },
+ "request-information" : {
+ "request-action" : "CreateVfModuleInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null,
+ "order-version" : null,
+ "notification-url" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "assign"
+ },
+ "vf-module-information" : {
+ "onap-model-information" : {
+ "model-name" : "vfModuleModelName",
+ "model-version" : "vfModuleModelVersion",
+ "model-customization-uuid" : "vfModuleModelCustomizationUuid",
+ "model-uuid" : "vfModuleModelUuid",
+ "model-invariant-uuid" : "vfModuleModelInvariantUuid"
+ },
+ "vf-module-id" : "testVfModuleId",
+ "vf-module-type": "vfModuleModelName"
+
+ },
+ "vnf-information" : {
+ "onap-model-information" : {
+ "model-name" : "vnfModelName",
+ "model-version" : "vnfModelVersion",
+ "model-customization-uuid" : "vnfModelCustomizationUuid",
+ "model-uuid" : "vnfModelUuid",
+ "model-invariant-uuid" : "vnfModelInvariantUuid"
+ },
+ "vnf-id" : "testVnfId",
+ "vnf-type" : "testVnfType",
+ "vnf-name" : "testVnfName"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
new file mode 100644
index 0000000000..64192ff8d0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
@@ -0,0 +1,30 @@
+{
+ "service-information" : {
+ "service-instance-id" : "serviceInstanceId",
+ "service-id" : "serviceInstanceId"
+ },
+ "vf-module-request-input" : {
+ "vf-module-name" : "testVfModuleName",
+ "vf-module-input-parameters" : {}
+ },
+ "request-information" : {
+ "request-action" : "DeleteVfModuleInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null,
+ "order-version" : null,
+ "notification-url" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "unassign"
+ },
+ "vf-module-information" : {
+ "vf-module-id" : "testVfModuleId"
+ },
+ "vnf-information" : {
+ "vnf-id" : "testVnfId",
+ "vnf-type" : "testVnfType"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json
new file mode 100644
index 0000000000..1497286a1b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json
@@ -0,0 +1,241 @@
+{
+ "vf-module-assignments":
+ {
+ "vms":
+ {
+ "vm":
+ [
+ {
+ "vm-type": "vmType0",
+ "vm-names":
+ {
+ "vm-name":
+ [
+ "vmName0",
+ "vmName1"
+ ],
+
+ "vnfc-names":
+ [
+ {
+ "vnfc-name": "vnfcName0",
+ "vnfc-networks":
+ {
+ "vnfc-network-data":
+ [
+ {
+ "vnfc-network-role": "vnfcNetworkRole0",
+ "vnfc-type": "fw",
+ "vnfc-ports":
+ {
+ "vnfc-port":
+ [
+ {
+ "vnfc-port-id": "01",
+ "common-sub-interface-role": "ctrl",
+ "vnic-sub-interfaces":
+ {
+ "sub-interface-network-data":
+ [
+ {
+ "network-id": "networkId0",
+ "network-name": 1,
+ "vlan-tag-id": 1,
+ "network-information-items":
+ {
+ "network-information-item":
+ [
+ {
+ "ip-version": "ipv4",
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip0",
+ "ip1"
+ ]
+ }
+ },
+
+ {
+ "ip-version": "ipv6",
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip0",
+ "ip1"
+ ]
+ }
+ }
+ ]
+ },
+
+ "floating-ips":
+ {
+ "floating-ip-v4":
+ [
+ "floatingIpV40",
+ "floatingIpV41"
+ ],
+
+ "floating-ip-v6":
+ [
+ "floatingIpV60",
+ "floatingIpV61"
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+
+ "vm-networks":
+ {
+ "vm-network":
+ [
+ {
+ "network-role": "vmNetworkRole0",
+ "floating-ips":
+ {
+ "floating-ip-v4":
+ [
+ "floatingIpV40",
+ "floatingIpV41"
+ ],
+
+ "floating-ip-v6":
+ [
+ "floatingIpV60",
+ "floatingIpV61"
+ ]
+ },
+
+ "interface-route-prefixes":
+ {
+ "interface-route-prefix":
+ [
+ "interfaceRoutePrefix0",
+ "interfaceRoutePrefix1"
+ ]
+ },
+
+ "sriov-parameters":
+ {
+ "heat-vlan-filters":
+ {
+ "heat-vlan-filter":
+ [
+ "heatVlanFilter0",
+ "heatVlanFilter1"
+ ]
+ }
+ },
+
+ "network-information-items":
+ {
+ "network-information-item":
+ [
+ {
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip0",
+ "ip1"
+ ]
+ },
+
+ "ip-version": "ipv4"
+ },
+
+ {
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip2",
+ "ip3"
+ ]
+ },
+
+ "ip-version": "ipv6"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+
+ "vf-module-parameters":
+ {
+ "param":
+ [
+ {
+ "name": "paramOne",
+ "value": "paramOneValue",
+ "resource-resolution-data":
+ {
+ "resource-key":
+ [
+ {
+ "name": "resourceKeyName",
+ "value": "resourceKeyValue"
+ }
+ ],
+
+ "status": "status",
+ "capability-name": "capabilityName"
+ }
+ },
+
+ {
+ "name": "paramTwo",
+ "value": "paramTwoValue",
+ "resource-resolution-data":
+ {
+ "resource-key":
+ [
+ {
+ "name": "resourceKeyName",
+ "value": "resourceKeyValue"
+ }
+ ],
+
+ "status": "status",
+ "capability-name": "capabilityName"
+ }
+ },
+
+ {
+ "name": "paramThree",
+ "value": "paramThreeValue",
+ "resource-resolution-data":
+ {
+ "resource-key":
+ [
+ {
+ "name": "resourceKeyName",
+ "value": "resourceKeyValue"
+ }
+ ],
+
+ "status": "status",
+ "capability-name": "capabilityName"
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json
new file mode 100644
index 0000000000..2a8acb927e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json
@@ -0,0 +1,243 @@
+{
+ "vf-module-assignments":
+ {
+ "vms":
+ {
+ "vm":
+ [
+ {
+ "vm-type": "vmType0",
+ "vm-names":
+ {
+ "vm-name":
+ [
+ "vmName0",
+ "vmName1"
+ ],
+
+ "vnfc-names":
+ [
+ {
+ "vnfc-name": "vnfcName0",
+ "vnfc-networks":
+ {
+ "vnfc-network-data":
+ [
+ {
+ "vnfc-network-role": "vnfcNetworkRole0",
+ "vnfc-type": "fw",
+ "vnfc-ports":
+ {
+ "vnfc-port":
+ [
+ {
+ "vnfc-port-id": "01",
+ "common-sub-interface-role": "ctrl",
+ "vnic-sub-interfaces":
+ {
+ "sub-interface-network-data":
+ [
+ {
+ "network-id": "networkId0",
+ "network-name": 1,
+ "vlan-tag-id": 1,
+ "network-information-items":
+ {
+ "network-information-item":
+ [
+ {
+ "ip-version": "ipv4",
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip0",
+ "ip1"
+ ]
+ }
+ },
+
+ {
+ "ip-version": "ipv6",
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip0",
+ "ip1"
+ ]
+ }
+ }
+ ]
+ },
+
+ "floating-ips":
+ {
+ "floating-ip-v4":
+ [
+ "floatingIpV40",
+ "floatingIpV41"
+ ],
+
+ "floating-ip-v6":
+ [
+ "floatingIpV60",
+ "floatingIpV61"
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+
+ "vm-networks":
+ {
+ "vm-network":
+ [
+ {
+ "network-role": "vmNetworkRole0",
+ "floating-ips":
+ {
+ "floating-ip-v4":
+ [
+ "floatingIpV40",
+ "floatingIpV41"
+ ],
+
+ "floating-ip-v6":
+ [
+ "floatingIpV60",
+ "floatingIpV61"
+ ]
+ },
+
+ "interface-route-prefixes":
+ {
+ "interface-route-prefix":
+ [
+ "interfaceRoutePrefix0",
+ "interfaceRoutePrefix1"
+ ]
+ },
+
+ "sriov-parameters":
+ {
+ "heat-vlan-filters":
+ {
+ "heat-vlan-filter":
+ [
+ "heatVlanFilter0",
+ "heatVlanFilter1"
+ ]
+ }
+ },
+
+ "network-information-items":
+ {
+ "network-information-item":
+ [
+ {
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip0",
+ "ip1"
+ ]
+ },
+
+ "ip-version": "ipv4"
+ },
+
+ {
+ "network-ips":
+ {
+ "network-ip":
+ [
+ "ip2",
+ "ip3"
+ ]
+ },
+
+ "ip-version": "ipv6"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+
+ "vf-module-parameters":
+ {
+ "param":
+ [
+ {
+ "name": "paramOne",
+ "value": "paramOneValue",
+ "resource-resolution-data":
+ {
+ "resource-key":
+ [
+ {
+ "name": "resourceKeyName",
+ "value": "resourceKeyValue"
+ }
+ ],
+
+ "status": "status",
+ "capability-name": "capabilityName"
+ }
+ },
+
+ {
+ "name": "paramTwo",
+ "value": "paramTwoValue",
+ "resource-resolution-data":
+ {
+ "resource-key":
+ [
+ {
+ "name": "resourceKeyName",
+ "value": "resourceKeyValue"
+ }
+ ],
+
+ "status": "status",
+ "capability-name": "capabilityName"
+ }
+ },
+
+ {
+ "name": "paramThree",
+ "value": "paramThreeValue",
+ "resource-resolution-data":
+ {
+ "resource-key":
+ [
+ {
+ "name": "resourceKeyName",
+ "value": "resourceKeyValue"
+ }
+ ],
+
+ "status": "status",
+ "capability-name": "capabilityName"
+ }
+ }
+ ]
+ },
+
+ "sdnc-generated-cloud-resources": "true"
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json
new file mode 100644
index 0000000000..2c7728397f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json
@@ -0,0 +1,68 @@
+{
+ "vnf-resource-assignments":
+ {
+ "availability-zones":
+ {
+ "availability-zone":
+ [
+ "zone0",
+ "zone1",
+ "zone2"
+ ]
+ },
+
+ "vnf-networks":
+ {
+ "vnf-network":
+ [
+ {
+ "network-role": "vnfNetworkRole0",
+ "neutron-id": "neutronId0",
+ "network-name": "netName0",
+ "contrail-network-fqdn": "netFqdnValue0",
+ "subnets-data":
+ {
+ "subnet-data":
+ [
+ {
+ "ip-version": "ipv4",
+ "subnet-id": "subnetId0",
+ "dhcp-enabled" : "Y"
+ },
+ {
+ "ip-version": "ipv6",
+ "subnet-id": "subnetId1",
+ "dhcp-enabled" : "Y"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+
+ "vnf-parameters-data":
+ {
+ "param":
+ [
+ {
+ "name": "key1",
+ "value": "value1"
+ }
+ ]
+ },
+
+ "aic-clli": "",
+ "tenant": "",
+ "vnf-topology-identifier-structure":
+ {
+
+ },
+
+ "onap-model-information":
+ {
+
+ },
+
+ "aic-cloud-region": ""
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json
new file mode 100644
index 0000000000..a302777810
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json
@@ -0,0 +1,68 @@
+{
+ "vnf-resource-assignments":
+ {
+ "availability-zones":
+ {
+ "availability-zone":
+ [
+ "zone0",
+ "zone1",
+ "zone2"
+ ]
+ },
+
+ "vnf-networks":
+ {
+ "vnf-network":
+ [
+ {
+ "network-role": "vnfNetworkRole0",
+ "neutron-id": "neutronId0",
+ "network-name": "netName0",
+ "contrail-network-fqdn": "netFqdnValue0",
+ "subnets-data":
+ {
+ "subnet-data":
+ [
+ {
+ "ip-version": "ipv4",
+ "subnet-id": "subnetId0",
+ "dhcp-enabled" : "N"
+ },
+ {
+ "ip-version": "ipv6",
+ "subnet-id": "subnetId1",
+ "dhcp-enabled" : "N"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+
+ "vnf-parameters-data":
+ {
+ "param":
+ [
+ {
+ "name": "key1",
+ "value": "value1"
+ }
+ ]
+ },
+
+ "aic-clli": "",
+ "tenant": "",
+ "vnf-topology-identifier-structure":
+ {
+
+ },
+
+ "onap-model-information":
+ {
+
+ },
+
+ "aic-cloud-region": ""
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json
new file mode 100644
index 0000000000..67c095a217
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json
@@ -0,0 +1,88 @@
+{
+ "vnf-resource-assignments":
+ {
+ "availability-zones":
+ {
+ "availability-zone":
+ [
+ "zone0",
+ "zone1",
+ "zone2"
+ ]
+ },
+
+ "vnf-networks":
+ {
+ "vnf-network":
+ [
+ {
+ "network-role": "vnfNetworkRole0",
+ "neutron-id": "neutronId0",
+ "network-name": "netName0",
+ "contrail-network-fqdn": "netFqdnValue0",
+ "subnets-data":
+ {
+ "subnet-data":
+ [
+ {
+ "ip-version": "ipv4",
+ "subnet-id": "subnetId0",
+ "dhcp-enabled" : "Y"
+ },
+ {
+ "ip-version": "ipv4",
+ "subnet-id": "subnetId1",
+ "dhcp-enabled" : "Y"
+ },
+ {
+ "ip-version": "ipv4",
+ "subnet-id": "subnetId2",
+ "dhcp-enabled" : "Y"
+ },
+ {
+ "ip-version": "ipv6",
+ "subnet-id": "subnetId3",
+ "dhcp-enabled" : "N"
+ },
+ {
+ "ip-version": "ipv6",
+ "subnet-id": "subnetId4",
+ "dhcp-enabled" : "Y"
+ },
+ {
+ "ip-version": "ipv6",
+ "subnet-id": "subnetId5",
+ "dhcp-enabled" : "Y"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+
+ "vnf-parameters-data":
+ {
+ "param":
+ [
+ {
+ "name": "key1",
+ "value": "value1"
+ }
+ ]
+ },
+
+ "aic-clli": "",
+ "tenant": "",
+ "vnf-topology-identifier-structure":
+ {
+
+ },
+
+ "onap-model-information":
+ {
+
+ },
+
+ "aic-cloud-region": ""
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json
new file mode 100644
index 0000000000..0047764713
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json
@@ -0,0 +1,69 @@
+{
+ "vnf-resource-assignments":
+ {
+ "availability-zones":
+ {
+ "availability-zone":
+ [
+ "zone0",
+ "zone1",
+ "zone2"
+ ]
+ },
+
+ "vnf-networks":
+ {
+ "vnf-network":
+ [
+ {
+ "network-role": "vnfNetworkRole0",
+ "neutron-id": "neutronId0",
+ "network-name": "netName0",
+ "contrail-network-fqdn": "netFqdnValue0",
+ "subnets-data":
+ {
+ "subnet-data":
+ [
+ {
+ "ip-version": "ipv4",
+ "subnet-id": "subnetId0"
+ },
+
+ {
+ "ip-version": "ipv6",
+ "subnet-id": "subnetId1"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+
+ "vnf-parameters-data":
+ {
+ "param":
+ [
+ {
+ "name": "key1",
+ "value": "value1"
+ }
+ ]
+ },
+
+ "aic-clli": "",
+ "tenant": "",
+ "vnf-topology-identifier-structure":
+ {
+
+ },
+
+ "onap-model-information":
+ {
+
+ },
+
+ "aic-cloud-region": "",
+
+ "sdnc-generated-cloud-resources": "true"
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json
new file mode 100644
index 0000000000..53cd70c514
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json
@@ -0,0 +1,113 @@
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "complete",
+ "statusMessage": "success",
+ "solutions": {
+ "licenseSolutions": [
+ {
+ "entitlementPoolUUID": [
+ "f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupUUID": [
+ "s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_primary_1",
+ "serviceResourceId": "testResourceIdAR"
+ },
+ {
+ "entitlementPoolUUID": [
+ "91d563e8-e714-4393-8f99-cc480144a05e",
+ "21d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupUUID": [
+ "31d563e8-e714-4393-8f99-cc480144a05e",
+ "71d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_secondary_1",
+ "serviceResourceId": "testResourceIdVNF"
+ }
+ ],
+ "placementSolutions": [
+ [
+ {
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceInstanceId": "testSIID1",
+ "serviceResourceId": "testResourceIdAR",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID1"]
+ },
+ "assignmentInfo": [
+ {
+ "key": "cloudOwner",
+ "value": "aic"
+ },
+ {
+ "key": "vnfHostName",
+ "value": "MDTNJ01"
+ },
+ {
+ "key": "isRehome",
+ "value": "False"
+ },
+ {
+ "key": "locationId",
+ "value": "dfwtx"
+ }
+ ]
+ },
+ { "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceResourceId": "testResourceIdAR2",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID2"]
+ },
+ "assignmentInfo": [
+ {
+ "key": "cloudOwner",
+ "value": "aic"
+ },
+ {
+ "key": "vnfHostName",
+ "value": "testVnfHostname2"
+ },
+ {
+ "key": "isRehome",
+ "value": "False"
+ },
+ {
+ "key": "locationId",
+ "value": "testCloudRegionId2"
+ }
+ ]
+ },
+ {
+ "resourceModuleName": "VNF",
+ "serviceResourceId": "testResourceIdVNF",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "aic",
+ "identifiers": [
+ "testCloudRegionId3"
+ ]
+ },
+ "assignmentInfo": [
+ {
+ "key": "cloudOwner",
+ "value": "aic"
+ },
+ {
+ "key": "locationId",
+ "value": "testCloudRegionId3"
+ },
+ { "key":"flavors",
+ "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
+ ]
+ }
+ ]
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json
new file mode 100644
index 0000000000..609d8924f7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json
@@ -0,0 +1,119 @@
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "completed",
+ "statusMessage": "success",
+ "solutions": {
+ "licenseSolutions": [
+ {
+ "resourceModuleName": "vHNPortalaaS_primary_1",
+ "serviceResourceId": "testResourceIdAR",
+ "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"],
+ "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ },
+ {
+ "resourceModuleName": "net",
+ "serviceResourceId": "testResourceIdNet2",
+ "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n",
+ "j1d563e8-e714-4393-8f99-cc480144a05n"],
+ "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n",
+ "b1d563e8-e714-4393-8f99-cc480144a05n"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ },
+ {
+ "resourceModuleName": "vHNPortalaaS_secondary_1",
+ "serviceResourceId": "testResourceIdVNF",
+ "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e",
+ "21d563e8-e714-4393-8f99-cc480144a05e"],
+ "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e",
+ "71d563e8-e714-4393-8f99-cc480144a05e"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ }
+ ],
+ "placementSolutions": [
+ [
+ {
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceResourceId": "testResourceIdAR",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID1"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "vnfHostName", "value": "MDTNJ01" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "locationId", "value": "dfwtx" }
+ ]
+ },
+ {
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceResourceId": "testResourceIdAR2",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID2"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "vnfHostName", "value": "testVnfHostname2" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "locationId", "value": "testCloudRegionId2" }
+ ]
+ },
+ {
+ "resourceModuleName": "NETWORK",
+ "serviceResourceId": "testResourceIdNet",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testServiceInstanceIdNet"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "vnfHostName", "value": "testVnfHostNameNet" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "locationId", "value": "testCloudRegionIdNet" }
+ ]
+ },
+ {
+ "resourceModuleName": "NETWORK",
+ "serviceResourceId": "testResourceIdNet2",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "aic",
+ "identifiers": ["testCloudRegionIdNet2"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "locationId", "value": "testCloudRegionIdNet2" }
+ ]
+ },
+ {
+ "resourceModuleName": "VNF",
+ "serviceResourceId": "testResourceIdVNF",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "aic",
+ "identifiers": ["testCloudRegionId3"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "locationId", "value": "testCloudRegionId3" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
+ ]
+ }
+ ]
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json
new file mode 100644
index 0000000000..15e601bae8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json
@@ -0,0 +1,50 @@
+{
+ "transactionId": "xxx-xxx-xxxx",
+ "requestId": "yyy-yyy-yyyy",
+ "requestStatus": "completed",
+ "statusMessage": "success",
+ "solutions": {
+ "placementSolutions": [
+ [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "some_resource_id",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "amazon" },
+ { "key": "vnfHostName", "value": "ahr344gh" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }
+ ]
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "some_resource_id",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "amazon",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "amazon" },
+ { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
+ ]
+ }
+ ]
+ ],
+ "licenseSolutions": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "some_resource_id",
+ "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json
new file mode 100644
index 0000000000..2024df401b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json
@@ -0,0 +1,18 @@
+{
+ "plans":[
+ {
+ "name":"356fdb73-cef2-4dda-8865-31fd6733d6e4",
+ "message":"Unable to find any candidate for demand vGW",
+ "links":[
+ [
+ {
+ "rel":"self",
+ "href":"http://172.17.0.6:8091/v1/plans/1c15e194-6df5-43fe-a5ff-42e6093b8ddd"
+ }
+ ]
+ ],
+ "id":"1c15e194-6df5-43fe-a5ff-42e6093b8ddd",
+ "status":"error"
+ }
+ ]
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json
new file mode 100644
index 0000000000..b82688428e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json
@@ -0,0 +1,9 @@
+{
+ "requestError": {
+ "policyException": {
+ "requestId": "ae81d9a8-c949-493a-999c-f76c80503233",
+ "text": "Message content size exceeds the allowable limit",
+ "messageId": "SVC0001"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json
new file mode 100644
index 0000000000..338b689d2e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json
@@ -0,0 +1,12 @@
+{
+ "requestError": {
+ "serviceException": {
+ "variables": [
+ "severity", 400
+ ],
+ "requestId": "ae81d9a8-c949-493a-999c-f76c80503233",
+ "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8",
+ "messageId": "SVC0001"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json
new file mode 100644
index 0000000000..889431663d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json
@@ -0,0 +1,47 @@
+{
+ "serviceResources": {
+ "serviceType": null,
+ "serviceAllottedResources": [],
+ "modelInfo": {
+ "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8",
+ "modelName": "ADIOD vRouter vCE 011017 Service",
+ "modelVersion": "5.0",
+ "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4"
+ },
+ "serviceRole": null,
+ "serviceVnfs": [
+ {
+ "toscaNodeType": "org.openecomp.resource.vf.AdiodVce",
+ "vfModules": [
+ {
+ "initialCount": null,
+ "vfModuleLabel": null,
+ "modelInfo": {
+ "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5",
+ "modelName": "AdiodVce..base_vCE..module-0",
+ "modelVersion": "2",
+ "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829",
+ "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276"
+ },
+ "hasVolumeGroup": true,
+ "isBase": true
+ }
+ ],
+ "modelInfo": {
+ "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelName": "ADIoD vCE",
+ "modelVersion": "2.0",
+ "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587",
+ "modelInstanceName": "ADIoD vCE 0",
+ "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1"
+ },
+ "nfRole": "",
+ "nfType": "",
+ "nfFunction": "ADIoDvCE",
+ "nfNamingCode": "",
+ "multiStageDesign": "N"
+ }
+ ],
+ "serviceNetworks": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest
new file mode 100644
index 0000000000..42b2a0f24a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest
@@ -0,0 +1,99 @@
+{
+ "requestInfo": {
+ "transactionId": "testRequestId-xxx-xxx",
+ "requestId": "testRequestId-yyy-yyy",
+ "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId",
+ "sourceId": "so",
+ "requestType": "create",
+ "numSolutions": 1,
+ "optimizers": ["placement"],
+ "timeout": 600
+ },
+ "placementInfo": {
+ "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" },
+ "placementDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "tenantId": "vGMuxInfra-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vGMuxInfra-customeModelName"
+ }
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e",
+ "tenantId": "vG-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vG-modelInvariantId",
+ "modelVersionId": "vG-versionId",
+ "modelName": "vG-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vG-customeModelName"
+ },
+ "existingCandidates": [
+ {
+ "identifierType": "service_instance_id",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ }
+ ],
+ "excludedCandidates": [
+ {
+ "identifierType": "service_instance_id",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "vmware",
+ "identifiers": ["NYMDT67"]
+ }
+ ],
+ "requiredCandidates": [
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "amazon",
+ "identifiers": ["TXAUS219"]
+ }
+ ]
+ }
+ ]
+ },
+ "serviceInfo": {
+ "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec",
+ "serviceName": "vCPE",
+ "modelInfo": {
+ "modelInvariantId": "vCPE-invariantId",
+ "modelVersionId": "vCPE-versionId",
+ "modelName": "vCPE-model",
+ "modelType": "service",
+ "modelVersion": "1.0",
+ "modelCustomizationName": ""
+ }
+ },
+ "licenseDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": ""
+ },
+ "existingLicenses": {
+ "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"],
+ "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"]
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf
new file mode 100644
index 0000000000..67c9fbedc9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf
@@ -0,0 +1,56 @@
+{
+ "requestInfo": {
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId",
+ "sourceId": "so",
+ "requestType": "create",
+ "numSolutions": 1,
+ "optimizers": ["placement"],
+ "timeout": 600 },
+ "placementInfo": {
+ "requestParameters": {
+ "customerLatitude": "32.89748",
+ "customerLongitude": "-97.040443",
+ "customerName": "xyz" },
+ "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201",
+ "subscriberName": "SUB_12_0322_DS_1201",
+ "subscriberCommonSiteId": "" },
+ "placementDemands": [
+ {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": {
+ "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1",
+ "modelName": "ADIoD vCE",
+ "modelType": "",
+ "modelVersion": "2.0",
+ "modelCustomizationName": "" }}
+ ]
+ },
+ "serviceInfo": {
+ "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "serviceName": "null",
+ "modelInfo": {
+ "modelType": "",
+ "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8",
+ "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "modelName": "ADIOD vRouter vCE 011017 Service",
+ "modelVersion": "5.0",
+ "modelCustomizationName": ""
+ }
+ },
+ "licenseInfo": {
+ "licenseDemands": [
+ {
+"resourceModuleName": "VNF",
+"serviceResourceId": "test-resource-id-000",
+"resourceInstanceType": "VNF",
+"resourceModelInfo": {
+ "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1",
+ "modelName": "ADIoD vCE",
+ "modelType": "",
+ "modelVersion": "2.0",
+ "modelCustomizationName": ""
+ }
+ }]
+ }} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json
new file mode 100644
index 0000000000..5addff2d70
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json
@@ -0,0 +1,596 @@
+{
+ "cloud-owner": "att-aic",
+ "cloud-region-id": "mtn6",
+ "cloud-type": "openstack",
+ "owner-defined-type": "LCP",
+ "cloud-region-version": "3.0",
+ "cloud-zone": "AUS1",
+ "complex-name": "mtn6",
+ "resource-version": "1485202577",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-125"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2002"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1702-126"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "oam-net"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0509A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0511C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512C"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_1Bindings_324_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-155"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "ST-MTN6-NoBinding-1707-18-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1710-4001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-119"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_1311"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-2001"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "aaaa-bbbb-cccc-dddd-eeee"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "direct_dhcp_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_NoBinding-1707-0512B"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-1Binding-1710-0814-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-MTN6-NoBinding-1707-20-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1111-2222-3333-4444-5555"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "dev_Bindings_full_1710_0907A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "wwww-xxxx-yyyy-zzzz"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "MSO_Dev_HostRoutes-1802-bns-1002"
+ }]
+ },
+ {
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR",
+ "relationship-data": [ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "AUSTTXGR"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json
new file mode 100644
index 0000000000..b0fcb786c2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json
@@ -0,0 +1,67 @@
+{
+ "network-policy-id": "e7a3560c-8b29-4611-a404-83af0b31ce64",
+ "network-policy-fqdn": "default-domain:ECOMP_MSO_DND:MSOPolicyC",
+ "resource-version": "1517429966296",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_1311"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1806_BB_it2_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1806_BB_it2_2"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json
new file mode 100644
index 0000000000..8034614626
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json
@@ -0,0 +1,55 @@
+{
+ "route-table-reference-id": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00",
+ "route-table-reference-fqdn": "default-domain:ECOMP_MSO_DND:RTA",
+ "resource-version": "1517437770161",
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1806_BB_it2_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1806_BB_it2_2"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json
new file mode 100644
index 0000000000..86c5d8ea98
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json
@@ -0,0 +1,106 @@
+{
+ "vpn-id": "9a7b327d9-287aa00-82c4b0-100001",
+ "vpn-name": "MSO_VPN_TEST",
+ "resource-version": "1515683690339",
+ "route-targets": {"route-target": [
+ {
+ "global-route-target": "2001:051111",
+ "route-target-role": "EXPORT",
+ "resource-version": "1515683690360"
+ },
+ {
+ "global-route-target": "1000:051113",
+ "route-target-role": "IMPORT",
+ "resource-version": "1515683690372"
+ },
+ {
+ "global-route-target": "1000:051112",
+ "route-target-role": "BOTH",
+ "resource-version": "1515683690384"
+ },
+ {
+ "global-route-target": "1000:051115",
+ "route-target-role": "EXPORT",
+ "resource-version": "1515683690408"
+ },
+ {
+ "global-route-target": "1000:051114",
+ "route-target-role": "IMPORT",
+ "resource-version": "1515683690396"
+ }
+ ]},
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_1311"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_021618"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1802_020118"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "DEV-1Binding-1710-0814-1000A"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1806_BB_it2_1"
+ }]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1",
+ "relationship-data": [ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1"
+ }],
+ "related-to-property": [ {
+ "property-key": "l3-network.network-name",
+ "property-value": "Dev_Bindings_1806_BB_it2_2"
+ }]
+ }
+ ]}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf
new file mode 100644
index 0000000000..09634c199b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf
@@ -0,0 +1,107 @@
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "complete",
+ "statusMessage": "",
+ "solutionInfo": {
+ "licenseInfo": [
+ {
+ "entitlementPoolList": [
+ "f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupList": [
+ "s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_primary_1",
+ "serviceResourceId": "testResourceIdAR"
+ },
+ {
+ "entitlementPoolList": [
+ "91d563e8-e714-4393-8f99-cc480144a05e",
+ "21d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupList": [
+ "31d563e8-e714-4393-8f99-cc480144a05e",
+ "71d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_secondary_1",
+ "serviceResourceId": "testResourceIdVNF"
+ }
+ ],
+ "placementInfo": [
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "vnfHostName",
+ "variableValue": "MDTNJ01"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "KDTNJ01"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "dfwtx",
+ "inventoryType": "service",
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceInstanceId": "testSIID1",
+ "serviceResourceId": "testResourceIdAR"
+ },
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "vnfHostName",
+ "variableValue": "testVnfHostname2"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "testAicClli2"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "testCloudRegionId2",
+ "inventoryType": "service",
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceInstanceId": "testSIID2",
+ "serviceResourceId": "testResourceIdAR2"
+ },
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "testAicClli3"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "testCloudRegionId3",
+ "inventoryType": "cloud",
+ "resourceModuleName": "VNF",
+ "serviceInstanceId": "",
+ "serviceResourceId": "testResourceIdVNF"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net
new file mode 100644
index 0000000000..ac9b466ab7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net
@@ -0,0 +1,165 @@
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "complete",
+ "statusMessage": "",
+ "solutionInfo": {
+ "licenseInfo": [
+ {
+ "entitlementPoolList": [
+ "f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupList": [
+ "s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_primary_1",
+ "serviceResourceId": "testResourceIdAR"
+ },
+ {
+ "entitlementPoolList": [
+ "f1d563e8-e714-4393-8f99-cc480144a05n",
+ "j1d563e8-e714-4393-8f99-cc480144a05n"
+ ],
+ "licenseKeyGroupList": [
+ "s1d563e8-e714-4393-8f99-cc480144a05n",
+ "b1d563e8-e714-4393-8f99-cc480144a05n"
+ ],
+ "resourceModuleName": "net",
+ "serviceResourceId": "testResourceIdNet2"
+ },
+ {
+ "entitlementPoolList": [
+ "91d563e8-e714-4393-8f99-cc480144a05e",
+ "21d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupList": [
+ "31d563e8-e714-4393-8f99-cc480144a05e",
+ "71d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_secondary_1",
+ "serviceResourceId": "testResourceIdVNF"
+ }
+ ],
+ "placementInfo": [
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "vnfHostName",
+ "variableValue": "MDTNJ01"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "KDTNJ01"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "dfwtx",
+ "inventoryType": "service",
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceInstanceId": "testSIID1",
+ "serviceResourceId": "testResourceIdAR"
+ },
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "vnfHostName",
+ "variableValue": "testVnfHostname2"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "testAicClli2"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "testCloudRegionId2",
+ "inventoryType": "service",
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceInstanceId": "testSIID2",
+ "serviceResourceId": "testResourceIdAR2"
+ },
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "vnfHostName",
+ "variableValue": "testVnfHostNameNet"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "testAicClliNet"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "testCloudRegionIdNet",
+ "inventoryType": "service",
+ "resourceModuleName": "NETWORK",
+ "serviceInstanceId": "testServiceInstanceIdNet",
+ "serviceResourceId": "testResourceIdNet"
+ },
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "testAicClliNet2"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "testCloudRegionIdNet2",
+ "inventoryType": "cloud",
+ "resourceModuleName": "NETWORK",
+ "serviceInstanceId": "",
+ "serviceResourceId": "testResourceIdNet2"
+ },
+ {
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "aic"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "testAicClli3"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ],
+ "cloudRegionId": "testCloudRegionId3",
+ "inventoryType": "cloud",
+ "resourceModuleName": "VNF",
+ "serviceInstanceId": "",
+ "serviceResourceId": "testResourceIdVNF"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf
new file mode 100644
index 0000000000..9159d80c43
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf
@@ -0,0 +1,50 @@
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "complete",
+ "statusMessage": "",
+ "solutionInfo": {
+ "placementInfo": [
+ {
+ "serviceResourceId": "test-resource-id-000",
+ "resourceModuleName": "ADIOD vRouter vCE",
+ "inventoryType": "service",
+ "serviceInstanceId": "service-instance-01234",
+ "cloudRegionId": "mtmnj1a",
+ "isRehome": "False",
+ "assignmentInfo": [
+ {
+ "variableName": "cloudOwner",
+ "variableValue": "att-aic"
+ },
+ {
+ "variableName": "vnfHostName",
+ "variableValue": "MDTNJ01"
+ },
+ {
+ "variableName": "aicClli",
+ "variableValue": "KDTNJ01"
+ },
+ {
+ "variableName": "aicVersion",
+ "variableValue": "3.0"
+ }
+ ]
+ }
+ ],
+ "licenseInfo": [
+ {
+ "serviceResourceId": "test-resource-id-000",
+ "resourceModuleName": "ADIOD vRouter vCE",
+ "entitlementPoolList": [
+ "f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupList": [
+ "s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound
new file mode 100644
index 0000000000..2150a053fb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound
@@ -0,0 +1,15 @@
+{
+ "requestState": "",
+ "responseTime": "",
+ "solutionInfo": {
+ "placementInfo": [],
+ "licenseInfo": {
+ "featureGroupId": ""
+ }
+ },
+ "percentProgress": "",
+ "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e",
+ "startTime": "",
+ "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8",
+ "requestType": ""
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException
new file mode 100644
index 0000000000..b82688428e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException
@@ -0,0 +1,9 @@
+{
+ "requestError": {
+ "policyException": {
+ "requestId": "ae81d9a8-c949-493a-999c-f76c80503233",
+ "text": "Message content size exceeds the allowable limit",
+ "messageId": "SVC0001"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException
new file mode 100644
index 0000000000..6cc78a7cdb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException
@@ -0,0 +1,12 @@
+{
+ "requestError": {
+ "serviceException": {
+ "variables": [
+ "severity", 400
+ ],
+ "requestId": "ae81d9a8-c949-493a-999c-f76c80503233",
+ "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8",
+ "messageId": "SVC0001"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf
new file mode 100644
index 0000000000..2af6bf3423
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf
@@ -0,0 +1,65 @@
+{
+ "requestInfo": {
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "callbackUrl": "http://localhost:8090/workflows/messages/message/SNIROResponse/testRequestId",
+ "sourceId": "mso",
+ "optimizer": [
+ "placement",
+ "license"
+ ],
+ "numSolutions": 1,
+ "timeout": 600
+ },
+ "placementInfo": {
+ "serviceModelInfo": {
+ "modelType": "",
+ "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8",
+ "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "modelName": "ADIOD vRouter vCE 011017 Service",
+ "modelVersion": "5.0"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "SUB12_0322_DS_1201",
+ "subscriberName": "SUB_12_0322_DS_1201",
+ "subscriberCommonSiteId": ""
+ },
+ "demandInfo": {
+ "placementDemand": [
+ {
+ "resourceInstanceType": "VNF",
+ "serviceResourceId": "test-resource-id-000",
+ "resourceModuleName": "ADIoD vCE 0",
+ "resourceModelInfo": {
+ "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587",
+ "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelName": "ADIoD vCE",
+ "modelVersion": "2.0",
+ "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1",
+ "modelType": ""
+ },
+ "tenantId": "",
+ "tenantName": ""
+ }
+ ],
+ "licenseDemand": [
+ {
+ "resourceInstanceType": "VNF",
+ "serviceResourceId": "test-resource-id-000",
+ "resourceModuleName": "ADIoD vCE 0",
+ "resourceModelInfo": {
+ "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587",
+ "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelName": "ADIoD vCE",
+ "modelVersion": "2.0",
+ "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1",
+ "modelType": ""
+ }
+ }
+ ]
+ },
+ "policyId": [],
+ "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "orderInfo": "{\"requestParameters\": null}"
+ }
+ } \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json
new file mode 100644
index 0000000000..a30ee59d5c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json
@@ -0,0 +1,66 @@
+{
+ "cloudSiteId": "cloudRegionId",
+ "tenantId": "tenantId",
+ "vnfType": "vnfType",
+ "vfModuleId": "vfModuleId",
+ "vfModuleName": "vfModuleName",
+ "vfModuleType": "vfModuleModelName",
+ "vnfVersion": "serviceModelVersion",
+ "modelCustomizationUuid": "vfModuleModelCustomizationUuid",
+ "skipAAI": true,
+ "backout": false,
+ "failIfExists": true,
+ "msoRequest":
+ {
+ "requestId": "requestId",
+ "serviceInstanceId": "serviceInstanceId"
+ },
+
+ "vfModuleParams":
+ {
+ "vnf_id": "vnfId",
+ "vnf_name": "vnfName",
+ "vf_module_id": "vfModuleId",
+ "vf_module_index": "1",
+ "vf_module_name": "vfModuleName",
+ "environment_context": "environmentContext",
+ "fw_0_subint_ctrl_port_0_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_net_ids": "networkId0",
+ "fw_0_subint_ctrl_port_0_net_names": "1",
+ "fw_subint_ctrl_port_0_subintcount": "1",
+ "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_vlan_ids": "1",
+ "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40",
+ "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60",
+ "workload_context": "workloadContext",
+ "key1": "value1",
+ "availability_zone_0": "zone0",
+ "availability_zone_1": "zone1",
+ "availability_zone_2": "zone2",
+ "vnfNetworkRole0_net_fqdn": "netFqdnValue0",
+ "vnfNetworkRole0_net_id": "neutronId0",
+ "vnfNetworkRole0_net_name": "netName0",
+ "vnfNetworkRole0_subnet_id": "subnetId0",
+ "vnfNetworkRole0_v6_subnet_id": "subnetId1",
+ "vmType0_name_0": "vmName0",
+ "vmType0_name_1": "vmName1",
+ "vmType0_names": "vmName0,vmName1",
+ "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40",
+ "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60",
+ "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]",
+ "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1",
+ "vmType0_vmNetworkRole0_ip_0": "ip0",
+ "vmType0_vmNetworkRole0_ip_1": "ip1",
+ "vmType0_vmNetworkRole0_ips": "ip0,ip1",
+ "vmType0_vmNetworkRole0_v6_ip_0": "ip2",
+ "vmType0_vmNetworkRole0_v6_ip_1": "ip3",
+ "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3",
+ "paramOne": "paramOneValue",
+ "paramTwo": "paramTwoValue",
+ "paramThree": "paramThreeValue"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json
new file mode 100644
index 0000000000..49a68b909a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json
@@ -0,0 +1,64 @@
+{
+ "cloudSiteId": "cloudRegionId",
+ "tenantId": "tenantId",
+ "vnfType": "vnfType",
+ "vfModuleId": "vfModuleId",
+ "vfModuleName": "vfModuleName",
+ "vfModuleType": "vfModuleModelName",
+ "vnfVersion": "serviceModelVersion",
+ "modelCustomizationUuid": "vfModuleModelCustomizationUuid",
+ "skipAAI": true,
+ "backout": false,
+ "failIfExists": true,
+ "msoRequest":
+ {
+ "requestId": "requestId",
+ "serviceInstanceId": "serviceInstanceId"
+ },
+
+ "vfModuleParams":
+ {
+ "vnf_id": "vnfId",
+ "vnf_name": "vnfName",
+ "vf_module_id": "vfModuleId",
+ "vf_module_index": "1",
+ "vf_module_name": "vfModuleName",
+ "environment_context": "environmentContext",
+ "fw_0_subint_ctrl_port_0_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_net_ids": "networkId0",
+ "fw_0_subint_ctrl_port_0_net_names": "1",
+ "fw_subint_ctrl_port_0_subintcount": "1",
+ "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_vlan_ids": "1",
+ "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40",
+ "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60",
+ "workload_context": "workloadContext",
+ "key1": "value1",
+ "availability_zone_0": "zone0",
+ "availability_zone_1": "zone1",
+ "availability_zone_2": "zone2",
+ "vnfNetworkRole0_net_fqdn": "netFqdnValue0",
+ "vnfNetworkRole0_net_id": "neutronId0",
+ "vnfNetworkRole0_net_name": "netName0",
+ "vmType0_name_0": "vmName0",
+ "vmType0_name_1": "vmName1",
+ "vmType0_names": "vmName0,vmName1",
+ "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40",
+ "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60",
+ "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]",
+ "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1",
+ "vmType0_vmNetworkRole0_ip_0": "ip0",
+ "vmType0_vmNetworkRole0_ip_1": "ip1",
+ "vmType0_vmNetworkRole0_ips": "ip0,ip1",
+ "vmType0_vmNetworkRole0_v6_ip_0": "ip2",
+ "vmType0_vmNetworkRole0_v6_ip_1": "ip3",
+ "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3",
+ "paramOne": "paramOneValue",
+ "paramTwo": "paramTwoValue",
+ "paramThree": "paramThreeValue"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json
new file mode 100644
index 0000000000..a862051582
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json
@@ -0,0 +1,66 @@
+{
+ "cloudSiteId": "cloudRegionId",
+ "tenantId": "tenantId",
+ "vnfType": "vnfType",
+ "vfModuleId": "vfModuleId",
+ "vfModuleName": "vfModuleName",
+ "vfModuleType": "vfModuleModelName",
+ "vnfVersion": "serviceModelVersion",
+ "modelCustomizationUuid": "vfModuleModelCustomizationUuid",
+ "skipAAI": true,
+ "backout": false,
+ "failIfExists": true,
+ "msoRequest":
+ {
+ "requestId": "requestId",
+ "serviceInstanceId": "serviceInstanceId"
+ },
+
+ "vfModuleParams":
+ {
+ "vnf_id": "vnfId",
+ "vnf_name": "vnfName",
+ "vf_module_id": "vfModuleId",
+ "vf_module_index": "1",
+ "vf_module_name": "vfModuleName",
+ "environment_context": "environmentContext",
+ "fw_0_subint_ctrl_port_0_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_net_ids": "networkId0",
+ "fw_0_subint_ctrl_port_0_net_names": "1",
+ "fw_subint_ctrl_port_0_subintcount": "1",
+ "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_vlan_ids": "1",
+ "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40",
+ "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60",
+ "workload_context": "workloadContext",
+ "key1": "value1",
+ "availability_zone_0": "zone0",
+ "availability_zone_1": "zone1",
+ "availability_zone_2": "zone2",
+ "vnfNetworkRole0_net_fqdn": "netFqdnValue0",
+ "vnfNetworkRole0_net_id": "neutronId0",
+ "vnfNetworkRole0_net_name": "netName0",
+ "vnfNetworkRole0_subnet_id": "subnetId0",
+ "vnfNetworkRole0_v6_subnet_id": "subnetId4",
+ "vmType0_name_0": "vmName0",
+ "vmType0_name_1": "vmName1",
+ "vmType0_names": "vmName0,vmName1",
+ "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40",
+ "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60",
+ "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]",
+ "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1",
+ "vmType0_vmNetworkRole0_ip_0": "ip0",
+ "vmType0_vmNetworkRole0_ip_1": "ip1",
+ "vmType0_vmNetworkRole0_ips": "ip0,ip1",
+ "vmType0_vmNetworkRole0_v6_ip_0": "ip2",
+ "vmType0_vmNetworkRole0_v6_ip_1": "ip3",
+ "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3",
+ "paramOne": "paramOneValue",
+ "paramTwo": "paramTwoValue",
+ "paramThree": "paramThreeValue"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json
new file mode 100644
index 0000000000..9c77f14f4b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json
@@ -0,0 +1,33 @@
+{
+ "cloudSiteId": "cloudRegionId",
+ "tenantId": "tenantId",
+ "vnfType": "vnfType",
+ "vfModuleId": "vfModuleId",
+ "vfModuleName": "vfModuleName",
+ "vfModuleType": "vfModuleModelName",
+ "vnfVersion": "serviceModelVersion",
+ "modelCustomizationUuid": "vfModuleModelCustomizationUuid",
+ "skipAAI": true,
+ "backout": false,
+ "failIfExists": true,
+ "msoRequest":
+ {
+ "requestId": "requestId",
+ "serviceInstanceId": "serviceInstanceId"
+ },
+
+ "vfModuleParams":
+ {
+ "environment_context": "environmentContext",
+ "key1": "value1",
+ "paramOne": "paramOneValue",
+ "paramThree": "paramThreeValue",
+ "paramTwo": "paramTwoValue",
+ "vf_module_id": "vfModuleId",
+ "vf_module_index": "1",
+ "vf_module_name": "vfModuleName",
+ "vnf_id": "vnfId",
+ "vnf_name": "vnfName",
+ "workload_context": "workloadContext"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json
new file mode 100644
index 0000000000..21e5bde3ec
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json
@@ -0,0 +1,11 @@
+{
+ "cloudSiteId" : "cloudRegionId",
+ "tenantId" : "tenantId",
+ "vnfId" : "vnfId",
+ "vfModuleId" : "vfModuleId",
+ "skipAAI" : true,
+ "msoRequest" : {
+ "requestId" : "requestId",
+ "serviceInstanceId" : "serviceInstanceId"
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json
new file mode 100644
index 0000000000..7b369ab97e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json
@@ -0,0 +1,70 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersion": "10"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "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"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "VMX",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "service": {
+ "modelInfo": {
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
+ },
+ "instanceParams": [],
+ "resources": {
+ "networks": [
+ {
+ "modelInfo": {
+ "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
+ "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ }
+ },
+ {
+ "modelInfo": {
+ "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
+ "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json
new file mode 100644
index 0000000000..771283c603
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json
@@ -0,0 +1,38 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersion": "10.0"
+ },
+ "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": "az2016"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "VMX",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "name": "someUserParam",
+ "value": "someValue"
+ }
+ ]
+
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
new file mode 100644
index 0000000000..51caddd48a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
@@ -0,0 +1,125 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersion": "10.0"
+ },
+ "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"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "VMX",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "service": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
+ },
+ "instanceParams": [],
+ "resources": {
+ "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": [],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0",
+ "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79",
+ "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
+ },
+ "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"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "100"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
+ "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
+ "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "50"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2",
+ "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64",
+ "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vmx_vpfe_int_ip_0": "192.168.0.16"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json
new file mode 100644
index 0000000000..a18b6aa54e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json
@@ -0,0 +1,27 @@
+{
+ "vnf-topology": {
+ "tenant": "0422ffb57ba042c0800a29dc85ca70f8",
+ "vnf-topology-identifier-structure": {
+ "vnf-id": "66dac89b-2a5b-4cb9-b22e-a7e4488fb3db",
+ "vnf-type": "InfraMSO_vSAMP10a_Service/InfraMSO_vSAMP10a-2 0",
+ "vnf-name": "MSO-DEV-VNF-1806HF1-InfraMSO_vSAMP10a-1XXX-GR_21"
+ },
+ "aic-clli": "AUSTTXGR",
+ "vnf-resource-assignments": {
+ "availability-zones": {
+ "availability-zone": [
+ "AZ-MN02"
+ ],
+ "max-count": 1
+ }
+ },
+ "aic-cloud-region": "mtn6",
+ "onap-model-information": {
+ "model-customization-uuid": "034226ae-879a-46b5-855c-d02babcb6cb6",
+ "model-uuid": "cb79c25f-b30d-4d95-afb5-97be4021f3db",
+ "model-invariant-uuid": "e93d3a7a-446d-486b-ae48-d474a9156064",
+ "model-name": "InfraMSO_vSAMP10a-2",
+ "model-version": "1.0"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml
new file mode 100644
index 0000000000..15e2ffce1c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml
@@ -0,0 +1,21 @@
+<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
+ statusCode="200">
+ <rest:headers>
+ <rest:header name="Transfer-Encoding" value="chunked"/>
+ <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/>
+ <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
+ <rest:header name="X-AAI-TXID"
+ value="localhost-20160314-20:53:33:487-134392"/>
+ <rest:header name="Content-Type" value="application/xml"/>
+ <rest:header name="Server" value="Apache-Coyote/1.1"/>
+ <rest:header name="Cache-Control" value="private"/>
+ </rest:headers>
+ <rest:payload contentType="text/xml">
+ <network-policy xmlns="http://com.aai.inventory/v8">
+ <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id>
+ <network-policy-fqdn>fqdn123</network-policy-fqdn>
+ <heat-stack-id>slowburn</heat-stack-id>
+ <resource-version>145878989</resource-version>
+ </network-policy>F
+ </rest:payload>
+</rest:RESTResponse> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml
new file mode 100644
index 0000000000..2126ae7464
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml
@@ -0,0 +1,6 @@
+<CreateAAIVfModuleVolumeGroupRequest>
+ <vnf-id>skask</vnf-id>
+ <vf-module-id>lukewarm</vf-module-id>
+ <aic-cloud-region>pdk1</aic-cloud-region>
+ <volume-group-id>78987</volume-group-id>
+</CreateAAIVfModuleVolumeGroupRequest> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml
new file mode 100644
index 0000000000..5232e530e9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml
@@ -0,0 +1,29 @@
+<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-info>
+ <request-id>DEV-VF-0011</request-id>
+ <action>UPDATE_VF_MODULE</action>
+ <source>PORTAL</source>
+ </request-info>
+ <vnf-inputs>
+ <vnf-id>skask</vnf-id> <!-- Required -->
+ <vf-module-id>supercool</vf-module-id> <!-- Required -->
+ <vnf-type>pcrf-capacity</vnf-type> <!-- Optional -->
+ <vf-module-model-name>PCRF::module-0</vf-module-model-name> <!-- Required -->
+ <asdc-service-model-version></asdc-service-model-version> <!-- Optional -->
+ <service-id>serviceIdUUID</service-id> <!-- Required -->
+ <aic-cloud-region>MDTWNJ21</aic-cloud-region> <!-- Required -->
+ <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id> <!-- Required -->
+ <volume-group-id>78987</volume-group-id> <!-- Optional -->
+ <persona-model-id>introvert</persona-model-id> <!-- Optional -->
+ <persona-model-version>3.14</persona-model-version> <!-- Optional -->
+ <contrail-service-instance-fqdn>myhost.appl.edu</contrail-service-instance-fqdn> <!-- Optional -->
+ <vnf-persona-model-id>introvert</vnf-persona-model-id> <!-- Optional -->
+ <vnf-persona-model-version>3.14</vnf-persona-model-version> <!-- Optional -->
+ </vnf-inputs>
+ <vnf-params>
+ <param name="oam_network_name">VLAN-OAM-1323</param>
+ <param name="vm_name">slcp34246vbc246ceb</param>
+ <param name="ipag_network">970cd2b9-7f09-4a12-af47-182ea38ba1f0</param>
+ <param name="vpe_network">545cc2c3-1930-4100-b534-5d82d0e12bb6</param>
+ </vnf-params>
+</vnf-request>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml
new file mode 100644
index 0000000000..c86a4aaa73
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml
@@ -0,0 +1,38 @@
+<generic-vnf xmlns="http://com.aai.inventory/v7">
+ <vnf-id>skask</vnf-id>
+ <vnf-name>STMTN5MMSC20</vnf-name>
+ <vnf-type>pcrf-capacity</vnf-type>
+ <service-id>SDN-MOBILITY</service-id>
+ <equipment-role>vPCRF</equipment-role>
+ <orchestration-status>pending-create</orchestration-status>
+ <in-maint>false</in-maint>
+ <is-closed-loop-disabled>false</is-closed-loop-disabled>
+ <persona-model-id>introvert</persona-model-id>
+ <persona-model-version>2.0</persona-model-version>
+ <resource-version>0000020</resource-version>
+ <vf-modules>
+ <vf-module>
+ <vf-module-id>lukewarm</vf-module-id>
+ <vf-module-name>PCRF::module-0-0</vf-module-name>
+ <persona-model-id>introvert</persona-model-id>
+ <persona-model-version>2.0</persona-model-version>
+ <is-base-vf-module>true</is-base-vf-module>
+ <heat-stack-id>fastburn</heat-stack-id>
+ <orchestration-status>pending-create</orchestration-status>
+ <resource-version>0000074</resource-version>
+ </vf-module>
+ <vf-module>
+ <vf-module-id>supercool</vf-module-id>
+ <vf-module-name>PCRF::module-1-0</vf-module-name>
+ <persona-model-id>extrovert</persona-model-id>
+ <persona-model-version>2.0</persona-model-version>
+ <is-base-vf-module>false</is-base-vf-module>
+ <heat-stack-id>slowburn</heat-stack-id>
+ <orchestration-status>pending-create</orchestration-status>
+ <resource-version>0000075</resource-version>
+ </vf-module>
+ </vf-modules>
+ <relationship-list/>
+ <l-interfaces/>
+ <lag-interfaces/>
+</generic-vnf>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml
new file mode 100644
index 0000000000..65f235cf4b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml
@@ -0,0 +1,5 @@
+<PrepareUpdateAAIVfModuleRequest>
+ <vnf-id>skask</vnf-id>
+ <vf-module-id>supercool</vf-module-id>
+ <orchestration-status>pending-delete</orchestration-status>
+</PrepareUpdateAAIVfModuleRequest> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml
new file mode 100644
index 0000000000..f40b6bc991
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml
@@ -0,0 +1,21 @@
+<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
+ statusCode="200">
+ <rest:headers>
+ <rest:header name="Transfer-Encoding" value="chunked"/>
+ <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/>
+ <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
+ <rest:header name="X-AAI-TXID"
+ value="localhost-20160314-20:53:33:487-134392"/>
+ <rest:header name="Content-Type" value="application/xml"/>
+ <rest:header name="Server" value="Apache-Coyote/1.1"/>
+ <rest:header name="Cache-Control" value="private"/>
+ </rest:headers>
+ <rest:payload contentType="text/xml">
+ <network-policy xmlns="http://com.aai.inventory/v8">
+ <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id>
+ <network-policy-fqdn>GN_EVPN_Test</network-policy-fqdn>
+ <heat-stack-id>195159195</heat-stack-id>
+ <resource-version>14567890</resource-version>
+ </network-policy>
+ </rest:payload>
+</rest:RESTResponse> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml
new file mode 100644
index 0000000000..4cab6c6615
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml
@@ -0,0 +1,13 @@
+<output xmlns="com:att:sdnctl:vnf">
+ <vnf-information>
+ <vnf-id>skask</vnf-id>
+ </vnf-information>
+ <response-code>200</response-code>
+ <svc-request-id>{{REQUEST-ID}}</svc-request-id>
+ <ack-final-indicator>Y</ack-final-indicator>
+ <service-information>
+ <subscriber-name>dontcare</subscriber-name>
+ <service-instance-id>0</service-instance-id>
+ <service-type>SDN-MOBILITY</service-type>
+ </service-information>
+</output> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml
new file mode 100644
index 0000000000..7d3d0e54d1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml
@@ -0,0 +1,13 @@
+ <output xmlns="com:att:sdnctl:vnf">
+ <vnf-information>
+ <vnf-id>skask</vnf-id>
+ </vnf-information>
+ <response-code>200</response-code>
+ <svc-request-id>{{REQUEST-ID}}</svc-request-id>
+ <ack-final-indicator>Y</ack-final-indicator>
+ <service-information>
+ <subscriber-name>dontcare</subscriber-name>
+ <service-instance-id>0</service-instance-id>
+ <service-type>SDN-MOBILITY</service-type>
+ </service-information>
+ </output> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml
new file mode 100644
index 0000000000..7d3d0e54d1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml
@@ -0,0 +1,13 @@
+ <output xmlns="com:att:sdnctl:vnf">
+ <vnf-information>
+ <vnf-id>skask</vnf-id>
+ </vnf-information>
+ <response-code>200</response-code>
+ <svc-request-id>{{REQUEST-ID}}</svc-request-id>
+ <ack-final-indicator>Y</ack-final-indicator>
+ <service-information>
+ <subscriber-name>dontcare</subscriber-name>
+ <service-instance-id>0</service-instance-id>
+ <service-type>SDN-MOBILITY</service-type>
+ </service-information>
+ </output> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml
new file mode 100644
index 0000000000..dbd55b0cf4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml
@@ -0,0 +1,315 @@
+<output xmlns="com:att:sdnctl:vnf">
+<vnf-list xmlns="com:att:sdnctl:vnf">
+ <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id>
+ <service-data>
+ <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id>
+ <sdnc-request-header>
+ <svc-request-id>9ddf628a-9eca-430e-8974-22d520a31be1</svc-request-id>
+ <svc-action>assign</svc-action>
+ <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url>
+ </sdnc-request-header>
+ <service-information>
+ <subscriber-name>notsurewecare</subscriber-name>
+ <service-instance-id>bd1b3789-6474-4935-94b2-90b656e035d0</service-instance-id>
+ <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
+ <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
+ </service-information>
+ <oper-status>
+ <order-status>PendingCreate</order-status>
+ </oper-status>
+ <vnf-request-information>
+ <aic-cloud-region>VNN1CA52LCP</aic-cloud-region>
+ <vnf-name>ZVNNMOGX01_base</vnf-name>
+ <generic-vnf-id>afd0f02a-1ddb-43bb-aded-5113e46e82ae</generic-vnf-id>
+ <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type>
+ <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name>
+ <tenant>33d209df14ac4c08ad60747185d2f3e0</tenant>
+ <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id>
+ <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type>
+ </vnf-request-information>
+ <vnf-topology-information>
+ <vnf-assignments>
+ <vnf-networks>
+ <network-role>mog_exn</network-role>
+ <network-id>03dbd833-785c-40c0-bf32-37594b5334bc</network-id>
+ <network-name>MNS-25180-P-VNNYCA01_exn_protected_net_1</network-name>
+ <contrail-network-fqdn/>
+ <subnet-id/>
+ <neutron-id>6f82d234-41a4-48e9-a9e8-415667a72929</neutron-id>
+ <sriov-vlan-filter-list>
+ <sriov-vlan-filter>filter1</sriov-vlan-filter>
+ </sriov-vlan-filter-list>
+ <sriov-vlan-filter-list>
+ <sriov-vlan-filter>filter2</sriov-vlan-filter>
+ </sriov-vlan-filter-list>
+ </vnf-networks>
+ <vnf-networks>
+ <network-role>mog_oam</network-role>
+ <network-id>3f181cde-9380-4c20-9d3a-e1a4ee74f994</network-id>
+ <network-name>MNS-25180-P-VNNYCA01_oam_protected_net_1</network-name>
+ <contrail-network-fqdn/>
+ <subnet-id/>
+ <neutron-id>713b6770-13fa-4949-8dbb-a1288c5e5932</neutron-id>
+ </vnf-networks>
+ <vnf-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-id>821a550a-3f50-4725-995b-f212d5caec7c</network-id>
+ <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_1</network-name>
+ <contrail-network-fqdn/>
+ <subnet-id/>
+ <neutron-id>18926e56-12b6-4a4d-98b6-37e0c05626ee</neutron-id>
+ </vnf-networks>
+ <vnf-networks>
+ <network-role>mog_cor_A</network-role>
+ <network-id>3dabf5c0-cffb-420c-8960-8499c74eb25f</network-id>
+ <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_2</network-name>
+ <contrail-network-fqdn/>
+ <subnet-id/>
+ <neutron-id>35530b29-a4de-48ff-a014-111110ccc652</neutron-id>
+ </vnf-networks>
+ <vnf-networks>
+ <network-role>mog_gn</network-role>
+ <network-id>3ce97321-6e7f-49af-bd12-f833e377c310</network-id>
+ <network-name>MNS-25180-P-VNNYCA01_gn_direct_net_1</network-name>
+ <contrail-network-fqdn/>
+ <subnet-id/>
+ <neutron-id>32bfdd2c-28e1-4895-87a6-373bf12c3129</neutron-id>
+ </vnf-networks>
+ <vnf-networks>
+ <network-role>mog_dmz</network-role>
+ <network-id>d43ca910-02a5-47dc-8510-100a68a3c9e0</network-id>
+ <network-name>MNS-25180-P-VNNYCA01_dmz_protected_net_1</network-name>
+ <contrail-network-fqdn/>
+ <subnet-id/>
+ <neutron-id>cb9500fb-943f-412e-aea6-458711564a75</neutron-id>
+ </vnf-networks>
+ <availability-zones>
+ <availability-zone>nova</availability-zone>
+ </availability-zones>
+ <vnf-vms>
+ <vm-type>ps</vm-type>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MPS001</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MPS002</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MPS003</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MPS004</vm-name>
+ </vm-names>
+ <vm-count>4</vm-count>
+ <vm-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-ips>
+ <ip-address>107.224.36.251</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.252</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.253</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.254</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ </vnf-vms>
+ <vnf-vms>
+ <vm-type>cm</vm-type>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MCM001</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01OAM002</vm-name>
+ </vm-names>
+ <vm-count>1</vm-count>
+ <vm-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-ips>
+ <ip-address>107.224.36.249</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.250</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_oam</network-role>
+ <network-ips>
+ <ip-address>107.239.167.250</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.239.167.251</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ </vnf-vms>
+ <vnf-vms>
+ <vm-type>oam</vm-type>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01OAM001</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01OAM002</vm-name>
+ </vm-names>
+ <vm-count>2</vm-count>
+ <vm-networks>
+ <network-role>mog_oam</network-role>
+ <network-ips>
+ <ip-address>107.239.167.252</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.239.167.251</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-ips>
+ <ip-address>107.224.36.249</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.250</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ </vnf-vms>
+ <vnf-vms>
+ <vm-type>pd</vm-type>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MPD001</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MPD002</vm-name>
+ </vm-names>
+ <vm-count>2</vm-count>
+ <vm-networks>
+ <network-role>mog_dmz</network-role>
+ <network-ips>
+ <ip-address>107.225.25.253</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.225.25.254</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip>107.225.254.253</floating-ip>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_oam</network-role>
+ <network-ips>
+ <ip-address>107.239.167.254</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.239.167.253</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip>107.239.167.249</floating-ip>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_exn</network-role>
+ <network-ips>
+ <ip-address>107.224.46.253</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.46.254</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip>107.224.46.252</floating-ip>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-ips>
+ <ip-address>107.224.36.247</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.248</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip>107.224.41.252</floating-ip>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_gn</network-role>
+ <network-ips>
+ <ip-address>107.224.41.253</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.41.254</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip>107.224.41.252</floating-ip>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_cor_A</network-role>
+ <network-ips>
+ <ip-address>107.224.38.253</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.38.254</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ </vnf-vms>
+ <vnf-vms>
+ <vm-type>sm</vm-type>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MSM001</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MSM002</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MSM003</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MSM004</vm-name>
+ </vm-names>
+ <vm-count>4</vm-count>
+ <vm-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-ips>
+ <ip-address>107.224.36.243</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.244</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.245</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.246</ip-address>
+ </network-ips>
+ <use-dhcp>N</use-dhcp>
+ </vm-networks>
+ </vnf-vms>
+ </vnf-assignments>
+ <vnf-topology-identifier>
+ <vnf-name>ZVNNMOGX01_base</vnf-name>
+ <service-type>SDN-MOBILITY</service-type>
+ <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type>
+ <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type>
+ <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name>
+ </vnf-topology-identifier>
+ </vnf-topology-information>
+ <request-information>
+ <request-id>9ddf628a-9eca-430e-8974-22d520a31be1</request-id>
+ <notification-url/>
+ <source>PORTAL</source>
+ <request-action>VNFActivateRequest</request-action>
+ </request-information>
+ </service-data>
+ <service-status>
+ <response-code>200</response-code>
+ <final-indicator>Y</final-indicator>
+ <request-status>synccomplete</request-status>
+ <response-timestamp>2016-08-05T16:15:19.398Z</response-timestamp>
+ <rpc-name>vnf-topology-operation</rpc-name>
+ <vnfsdn-action>VNFActivateRequest</vnfsdn-action>
+ <rpc-action>assign</rpc-action>
+ </service-status>
+</vnf-list>
+
+</output>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml
new file mode 100644
index 0000000000..e8a69da0f8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml
@@ -0,0 +1,141 @@
+<output xmlns="com:att:sdnctl:vnf">
+ <vnf-list xmlns="com:att:sdnctl:vnf">
+ <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id>
+ <service-status>
+ <response-code>200</response-code>
+ <final-indicator>Y</final-indicator>
+ <request-status>synccomplete</request-status>
+ <response-timestamp>2016-06-08T19:44:59.138Z</response-timestamp>
+ <rpc-name>vnf-topology-operation</rpc-name>
+ <vnfsdn-action>VNFActivateRequest</vnfsdn-action>
+ <rpc-action>assign</rpc-action>
+ </service-status>
+ <service-data>
+ <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743</vnf-id>
+ <service-information>
+ <subscriber-name>notsurewecare</subscriber-name>
+ <service-instance-id>28455973-1ee5-4ad1-8d35-c4732679743a</service-instance-id>
+ <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
+ <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
+ </service-information>
+ <sdnc-request-header>
+ <svc-request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</svc-request-id>
+ <svc-notification-url>http://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url>
+ <svc-action>assign</svc-action>
+ </sdnc-request-header>
+ <vnf-request-information>
+ <aic-cloud-region>AAIAIC25</aic-cloud-region>
+ <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name>
+ <generic-vnf-id>91ad7ab0-9ffd-471d-971c-3eb913a2cc75</generic-vnf-id>
+ <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type>
+ <generic-vnf-name>MSOTEST06</generic-vnf-name>
+ <tenant>4ae1d3446a4c48b2bec44b6cfba06d68</tenant>
+ <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id>
+ <vnf-type>vSAMP3::base::module-0</vnf-type>
+ </vnf-request-information>
+ <oper-status>
+ <order-status>PendingCreate</order-status>
+ </oper-status>
+ <vnf-topology-information>
+ <vnf-parameters>
+ <vnf-parameter-name>image</vnf-parameter-name>
+ <vnf-parameter-value>Ubuntu_Perf</vnf-parameter-value>
+ </vnf-parameters>
+ <vnf-parameters>
+ <vnf-parameter-name>flavor</vnf-parameter-name>
+ <vnf-parameter-value>m1.small</vnf-parameter-value>
+ </vnf-parameters>
+ <vnf-assignments>
+ <vnf-networks>
+ <network-role>int_imbl</network-role>
+ <network-id>680b7453-0ec4-4d96-b355-280d981d418f</network-id>
+ <network-name>Nimbus-25193-T-Willows2_int_imbl_net_1</network-name>
+ <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1</contrail-network-fqdn>
+ <subnet-id></subnet-id>
+ <ipv6-subnet-id>775607fb-e16a-45ef-94a7-82fba0d16eec</ipv6-subnet-id>
+ <neutron-id>640d07fb-e16a-45ef-94a7-82fba0d169bf</neutron-id>
+ <sriov-vlan-filter-list>
+ <sriov-vlan-filter>filter1</sriov-vlan-filter>
+ </sriov-vlan-filter-list>
+ <sriov-vlan-filter-list>
+ <sriov-vlan-filter>filter2</sriov-vlan-filter>
+ </sriov-vlan-filter-list>
+ </vnf-networks>
+ <vnf-networks>
+ <network-role>sgi_protected</network-role>
+ <network-id>f9039ce9-e3cf-4716-b2d1-ec7912178ea4</network-id>
+ <network-name>Nimbus-25193-T-Willows2_sgi_protected_net_1</network-name>
+ <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1</contrail-network-fqdn>
+ <subnet-id>b9999ce9-e3cf-4716-b2d1-ec791217678c</subnet-id>
+ <ipv6-subnet-id></ipv6-subnet-id>
+ <neutron-id>bf11bba8-b971-4ab5-8281-215b3fedcd3c</neutron-id>
+ </vnf-networks>
+ <vnf-vms>
+ <vm-type>cm</vm-type>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01MCM001</vm-name>
+ </vm-names>
+ <vm-names>
+ <vm-name>ZVNN1MOGX01OAM002</vm-name>
+ </vm-names>
+ <vm-count>1</vm-count>
+ <vm-networks>
+ <network-role>mog_cor_B</network-role>
+ <network-ips>
+ <ip-address>107.224.36.249</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.224.36.250</ip-address>
+ </network-ips>
+ <network-ips-v6>
+ <ip-address-ipv6>2606:ae00:2e01:800::67</ip-address-ipv6>
+ </network-ips-v6>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip>107.224.41.252</floating-ip>
+ <floating-ip-v6>2001:1890:1001:2B32::29:C</floating-ip-v6>
+ </vm-networks>
+ <vm-networks>
+ <network-role>mog_oam</network-role>
+ <network-ips>
+ <ip-address>107.239.167.250</ip-address>
+ </network-ips>
+ <network-ips>
+ <ip-address>107.239.167.251</ip-address>
+ </network-ips>
+ <network-ips-v6>
+ <ip-address-ipv6>aa::aa::aa::aa::aa::aa</ip-address-ipv6>
+ </network-ips-v6>
+ <network-ips-v6>
+ <ip-address-ipv6>bb::bb::bb::bb::bb::bb</ip-address-ipv6>
+ </network-ips-v6>
+ <interface-route-prefixes>
+ <interface-route-prefix-cidr>1.2.3.4/26</interface-route-prefix-cidr>
+ </interface-route-prefixes>
+ <interface-route-prefixes>
+ <interface-route-prefix-cidr>2002::/64</interface-route-prefix-cidr>
+ </interface-route-prefixes>
+ <use-dhcp>N</use-dhcp>
+ <floating-ip-v6>1111:1890:1001:2B32::29:D</floating-ip-v6>
+ </vm-networks>
+ </vnf-vms>
+ <availability-zones>
+ <availability-zone>nova</availability-zone>
+ </availability-zones>
+ </vnf-assignments>
+ <vnf-topology-identifier>
+ <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name>
+ <service-type>SDN-MOBILITY</service-type>
+ <vnf-type>vSAMP3::base::module-0</vnf-type>
+ <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type>
+ <generic-vnf-name>MSOTEST06</generic-vnf-name>
+ </vnf-topology-identifier>
+ </vnf-topology-information>
+ <request-information>
+ <request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</request-id>
+ <notification-url></notification-url>
+ <source>SoapUI-bns-vf-base-vSAMP3-9001</source>
+ <request-action>VNFActivateRequest</request-action>
+ </request-information>
+ </service-data>
+</vnf-list>
+</output>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml
new file mode 100644
index 0000000000..77528ccf61
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml
@@ -0,0 +1,5 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <SDNCAdapterResponse xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"/>
+ </soap:Body>
+</soap:Envelope> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml
new file mode 100644
index 0000000000..3e7c6503f4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml
@@ -0,0 +1,5 @@
+<UpdateAAIGenericVnfRequest>
+ <vnf-id>skask</vnf-id>
+ <persona-model-id>introvert</persona-model-id>
+ <persona-model-version>3.14</persona-model-version>
+</UpdateAAIGenericVnfRequest> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml
new file mode 100644
index 0000000000..8a690403c4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml
@@ -0,0 +1,10 @@
+<UpdateAAIVfModuleRequest>
+ <vnf-id>skask</vnf-id>
+ <vf-module-id>supercool</vf-module-id>
+ <heat-stack-id>slowburn</heat-stack-id>
+ <orchestration-status>complete</orchestration-status>
+ <volume-group-id>78987</volume-group-id>
+ <persona-model-id>introvert</persona-model-id>
+ <persona-model-version>3.14</persona-model-version>
+ <contrail-service-instance-fqdn>myhost.appl.com</contrail-service-instance-fqdn>
+</UpdateAAIVfModuleRequest> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml
new file mode 100644
index 0000000000..0dc1b1d410
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml
@@ -0,0 +1,35 @@
+<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-info>
+ <request-id>DEV-VF-0011</request-id>
+ <action>UPDATE_VF_MODULE</action>
+ <source>PORTAL</source>
+ </request-info>
+ <vnf-inputs>
+ <vnf-id>skask</vnf-id> <!-- Required --> <!-- with vf-module-id, identifies the vf-module to update -->
+ <vf-module-id>supercool</vf-module-id> <!-- Required --> <!-- with vnf-id, identifies the vf-module to update -->
+ <vnf-type>pcrf-capacity</vnf-type> <!-- Required --> <!-- not in vf-module; used for recipe selection/filtering;
+ thus, not used by UpdateVfModule flow -->
+ <vf-module-model-name>PCRF::module-0</vf-module-model-name> <!-- Required --> <!-- not in vf-module; used for recipe selection/filtering;
+ thus, not used by UpdateVfModule flow -->
+ <asdc-service-model-version></asdc-service-model-version> <!-- Optional --> <!-- not in vf-module; used for recipe selection;
+ thus, not used by UpdateVfModule flow -->
+ <service-id>serviceIdUUID</service-id> <!-- Required --> <!-- not in vf-module; used for query filtering;
+ thus, not used by UpdateVfModule flow -->
+ <aic-cloud-region>MDTWNJ21</aic-cloud-region> <!-- Required --> <!-- in vf-module as part of volume-group relationship;
+ however, used for query filtering only; not updatable in AAI -->
+ <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id> <!-- Required --> <!-- not in vf-module; used to confirm volume group tenant -->
+ <volume-group-id>78987</volume-group-id> <!-- Optional --> <!-- in vf-module as part of volume-group relationship; used
+ to update VNF adapter; not updatable in AAI -->
+ <persona-model-id>introvert</persona-model-id> <!-- Optional --> <!-- Not in AID, in vf-module -->
+ <persona-model-version>3.14</persona-model-version> <!-- Optional --> <!-- Not in AID, in vf-module -->
+ <contrail-service-instance-fqdn>myhost.appl.edu</contrail-service-instance-fqdn> <!-- Optional --> <!-- Not in AID, in vf-module -->
+ <vnf-persona-model-id>introvert</vnf-persona-model-id> <!-- Optional --> <!-- Not in AID, in generic-vnf (as persona-model-id) -->
+ <vnf-persona-model-version>3.14</vnf-persona-model-version> <!-- Optional --> <!-- Not in AID, in generic-vnf (as persona-model-version) -->
+ </vnf-inputs>
+ <vnf-params>
+ <param name="oam_network_name">VLAN-OAM-1323</param>
+ <param name="vm_name">slcp34246vbc246ceb</param>
+ <param name="ipag_network">970cd2b9-7f09-4a12-af47-182ea38ba1f0</param>
+ <param name="vpe_network">545cc2c3-1930-4100-b534-5d82d0e12bb6</param>
+ </vnf-params>
+</vnf-request>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml
new file mode 100644
index 0000000000..49ecd0bf3f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml
@@ -0,0 +1,55 @@
+<createVfModuleResponse>
+ <vnfId>skask</vnfId>
+ <vfModuleId>supercool</vfModuleId>
+ <vfModuleStackId>slowburn</vfModuleStackId>
+ <vfModuleCreated>true</vfModuleCreated>
+ <vfModuleOutputs>
+ <entry>
+ <key>key1</key>
+ <value>value1</value>
+ </entry>
+ <entry>
+ <key>key2</key>
+ <value>value2</value>
+ </entry>
+ <entry>
+<key>server1_private_ip</key>
+<value>192.168.28.3</value>
+</entry>
+<entry>
+<key>contrail-service-instance-fqdn</key>
+<value>default-domain:MSOTest:MsoNW-RA</value>
+</entry>
+<entry>
+<key>policyKey1_contrail_network_policy_fqdn</key>
+<value>MSOTest:DefaultPolicyFQDN1</value>
+</entry>
+<entry>
+<key>policyKey2_contrail_network_policy_fqdn</key>
+<value>MSOTest:DefaultPolicyFQDN2</value>
+</entry>
+<entry>
+<key>oam_management_v6_address</key>
+<value>2000:abc:bce:1111</value>
+</entry>
+<entry>
+<key>oam_management_v4_address</key>
+<value>127.0.0.1</value>
+</entry>
+ </vfModuleOutputs>
+ <rollback> <!-- JC's doc has "vfModuleRollback" -->
+ <vnfId>skask</vnfId>
+ <vfModuleId>supercool</vfModuleId>
+ <vfModuleStackId>slowburn</vfModuleStackId>
+ <vfModuleCreated>true</vfModuleCreated>
+ <tenantId>tenantId</tenantId>
+ <cloudSiteId>cloudSiteId</cloudSiteId>
+ <msoRequest>
+ <requestId>requestId</requestId>
+ <serviceInstanceId>serviceInstanceId</serviceInstanceId>
+ </msoRequest>
+ <messageId>{{MESSAGE-ID}}</messageId> <!-- JC's doc does not have this -->
+ </rollback>
+ <messageId>{{MESSAGE-ID}}</messageId>
+</createVfModuleResponse>
+
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml
new file mode 100644
index 0000000000..c602dd9667
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml
@@ -0,0 +1,16 @@
+<updateVfModuleResponse>
+ <vnfId>skask</vnfId>
+ <vfModuleId>supercool</vfModuleId>
+ <vfModuleStackId>slowburn</vfModuleStackId>
+ <vfModuleOutputs>
+ <entry>
+ <key>key1</key>
+ <value>value1</value>
+ </entry>
+ <entry>
+ <key>key2</key>
+ <value>value2</value>
+ </entry>
+ </vfModuleOutputs>
+ <messageId>{{MESSAGE-ID}}</messageId>
+</updateVfModuleResponse>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml
new file mode 100644
index 0000000000..830d2e2237
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml
@@ -0,0 +1,15 @@
+<updateVolumeGroupResponse>
+ <volumeGroupId>78987</volumeGroupId>
+ <volumeGroupStackId>slowburn</volumeGroupStackId>
+ <vfModuleOutputs>
+ <entry>
+ <key>key1</key>
+ <value>value1</value>
+ </entry>
+ <entry>
+ <key>key2</key>
+ <value>value2</value>
+ </entry>
+ </vfModuleOutputs>
+ <messageId>{{MESSAGE-ID}}</messageId>
+</updateVolumeGroupResponse>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml
new file mode 100644
index 0000000000..b882c4c6f4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml
@@ -0,0 +1,10 @@
+<vf-module xmlns="http://com.aai.inventory/v7">
+ <vf-module-id>lukewarm</vf-module-id>
+ <vf-module-name>PCRF::module-1</vf-module-name>
+ <heat-stack-id>slowburn</heat-stack-id>
+ <orchestration-status>pending-create</orchestration-status>
+ <is-base-vf-module>true</is-base-vf-module>
+ <resource-version>330-90</resource-version>
+ <persona-model-id>introvert</persona-model-id>
+ <persona-model-version>2.0</persona-model-version>
+</vf-module> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml
new file mode 100644
index 0000000000..3b8bea4e4e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml
@@ -0,0 +1,9 @@
+<vf-module xmlns="http://com.aai.inventory/v7">
+ <vf-module-id>b37d96db-7d2c-47ce-bf61-a6c7b82fe161</vf-module-id>
+ <vf-module-name>PCRF::module-0-2</vf-module-name>
+ <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id>
+ <persona-model-version>1.0</persona-model-version>
+ <is-base-vf-module>false</is-base-vf-module>
+ <orchestration-status>pending-create</orchestration-status>
+ <resource-version>330-90</resource-version>
+</vf-module> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml
new file mode 100644
index 0000000000..5a2b7300b1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml
@@ -0,0 +1,27 @@
+<vf-module xmlns="http://com.aai.inventory/v7">
+ <vf-module-id>supercool</vf-module-id>
+ <vf-module-name>PCRF::module-2</vf-module-name>
+ <heat-stack-id>fastburn</heat-stack-id>
+ <orchestration-status>pending-create</orchestration-status>
+ <is-base-vf-module>false</is-base-vf-module>
+ <resource-version>330-89</resource-version>
+ <model-invariant-id>introvert</model-invariant-id>
+ <model-version-id>2.0</model-version-id>
+ <relationship-list>
+ <relationship>
+ <related-to>volume-group</related-to>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>pdk1</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>volume-group.volume-group-id</relationship-key>
+ <relationship-value>78987</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+</vf-module> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml
new file mode 100644
index 0000000000..7e913dd418
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml
@@ -0,0 +1,25 @@
+ <volume-group xmlns="http://com.aai.inventory/v7">
+ <volume-group-id>78987</volume-group-id>
+ <volume-group-name>Volume_2</volume-group-name>
+ <heat-stack-id>slowburn</heat-stack-id>
+ <vnf-type>pcrf-capacity</vnf-type>
+ <orchestration-status>Active</orchestration-status>
+ <resource-version>0000020</resource-version>
+ <relationship-list>
+ <relationship>
+ <related-to>tenant</related-to>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>MDTWNJ21</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>tenant.tenant-id</relationship-key>
+ <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+ </volume-group> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..ac8446cbb9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
@@ -0,0 +1,214 @@
+aai:
+ auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
+ endpoint: http://localhost:${wiremock.server.port}
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost:3904
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE
+log:
+ debug:
+ CompleteMsoProcess: 'true'
+ CreateNetworkInstanceInfra: 'true'
+ CreateServiceInstanceInfra: 'true'
+ DeleteNetworkInstanceInfra: 'true'
+ FalloutHandler: 'true'
+ UpdateNetworkInstanceInfra: 'true'
+ VnfAdapterRestV1: 'true'
+ sdncAdapter: 'true'
+ vnfAdapterCreateV1: 'true'
+ vnfAdapterRestV1: 'true'
+mso:
+ adapters:
+ completemsoprocess:
+ endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess
+ db:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ network:
+ endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks
+ openecomp:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+ po:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ password: 3141634BF7E070AA289CF2892C986C0B
+ sdnc:
+ endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc
+ timeout: PT60S
+ tenant:
+ endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock
+ vnf:
+ endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs
+ volume-groups:
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups
+ vnf-async:
+ endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync
+ workflow:
+ message:
+ endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message
+
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+
+ bpmn:
+ optimisticlockingexception:
+ retrycount: '3'
+ callbackRetryAttempts: '5'
+ catalog:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ correlation:
+ timeout: 60
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ default:
+ adapter:
+ namespace: http://org.onap.so
+ healthcheck:
+ log:
+ debug: 'false'
+ infra:
+ customer:
+ id: testCustIdInfra
+ logPath: logs
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ po:
+ timeout: PT60S
+ request:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ rollback: 'true'
+ site-name: localDevEnv
+ workflow:
+ default:
+ aai:
+ cloud-region:
+ version: '9'
+ generic-vnf:
+ version: '9'
+ v8:
+ customer:
+ uri: /aai/v8/business/customers/customer
+ generic-query:
+ uri: /aai/v8/search/generic-query
+ l3-network:
+ uri: /aai/v8/network/l3-networks/l3-network
+ network-policy:
+ uri: /aai/v8/network/network-policies/network-policy
+ nodes-query:
+ uri: /aai/v8/search/nodes-query
+ route-table-reference:
+ uri: /aai/v8/network/route-table-references/route-table-reference
+ tenant:
+ uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
+ vce:
+ uri: /aai/v8/network/vces/vce
+ vpn-binding:
+ uri: /aai/v8/network/vpn-bindings/vpn-binding
+ v9:
+ cloud-region:
+ uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
+ generic-vnf:
+ uri: /aai/v9/network/generic-vnfs/generic-vnf
+ global:
+ default:
+ aai:
+ namespace: http://org.openecomp.aai.inventory/
+ version: '8'
+ message:
+ endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage
+ notification:
+ name: GenericNotificationService
+ sdncadapter:
+ callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService
+ vnfadapter:
+ create:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ delete:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ query:
+ callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1
+ rollback:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ global:
+ dmaap:
+ username: dmaapUsername
+ password: dmaapPassword
+ host: http://localhost:28090
+ publisher:
+ topic: com.att.mso.asyncStatusUpdate
+policy:
+ auth: Basic dGVzdHBkcDphbHBoYTEyMw==
+ client:
+ auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
+ endpoint: https://localhost:8081/pdp/api/
+ environment: TEST
+sdnc:
+ auth: Basic YWRtaW46YWRtaW4=
+ host: http://localhost:8446
+ path: /restconf/operations/GENERIC-RESOURCE-API
+sniro:
+ conductor:
+ enabled: true
+ host: http://localhost:${wiremock.server.port}
+ uri: /v1/release-orders
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ manager:
+ timeout: PT30M
+ host: http://localhost:${wiremock.server.port}
+ uri.v1: /sniro/api/v2/placement
+ uri.v2: /sniro/api/placement/v2
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ headers.patchVersion: 1
+ headers.minorVersion: 1
+ headers.latestVersion: 2
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/camundabpmn
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+
+mariaDB4j:
+ dataDir:
+ port: 3307
+ databaseName: camundabpmn
+camunda:
+ bpm:
+ metrics:
+ enabled: false
+ db-reporter-activate: false \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/schema.sql b/bpmn/so-bpmn-tasks/src/test/resources/schema.sql
new file mode 100644
index 0000000000..7a15e84662
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/schema.sql
@@ -0,0 +1,1188 @@
+
+USE `camundabpmn`;
+
+
+create table ACT_GE_PROPERTY (
+ NAME_ varchar(64),
+ VALUE_ varchar(300),
+ REV_ integer,
+ primary key (NAME_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+
+create table ACT_GE_BYTEARRAY (
+ ID_ varchar(64),
+ REV_ integer,
+ NAME_ varchar(255),
+ DEPLOYMENT_ID_ varchar(64),
+ BYTES_ LONGBLOB,
+ GENERATED_ TINYINT,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RE_DEPLOYMENT (
+ ID_ varchar(64),
+ NAME_ varchar(255),
+ DEPLOY_TIME_ timestamp(3),
+ SOURCE_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_EXECUTION (
+ ID_ varchar(64),
+ REV_ integer,
+ PROC_INST_ID_ varchar(64),
+ BUSINESS_KEY_ varchar(255),
+ PARENT_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ SUPER_EXEC_ varchar(64),
+ SUPER_CASE_EXEC_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ ACT_INST_ID_ varchar(64),
+ IS_ACTIVE_ TINYINT,
+ IS_CONCURRENT_ TINYINT,
+ IS_SCOPE_ TINYINT,
+ IS_EVENT_SCOPE_ TINYINT,
+ SUSPENSION_STATE_ integer,
+ CACHED_ENT_STATE_ integer,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_JOB (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ TYPE_ varchar(255) NOT NULL,
+ LOCK_EXP_TIME_ timestamp(3) NULL,
+ LOCK_OWNER_ varchar(255),
+ EXCLUSIVE_ boolean,
+ EXECUTION_ID_ varchar(64),
+ PROCESS_INSTANCE_ID_ varchar(64),
+ PROCESS_DEF_ID_ varchar(64),
+ PROCESS_DEF_KEY_ varchar(255),
+ RETRIES_ integer,
+ EXCEPTION_STACK_ID_ varchar(64),
+ EXCEPTION_MSG_ varchar(4000),
+ DUEDATE_ timestamp(3) NULL,
+ REPEAT_ varchar(255),
+ HANDLER_TYPE_ varchar(255),
+ HANDLER_CFG_ varchar(4000),
+ DEPLOYMENT_ID_ varchar(64),
+ SUSPENSION_STATE_ integer NOT NULL DEFAULT 1,
+ JOB_DEF_ID_ varchar(64),
+ PRIORITY_ bigint NOT NULL DEFAULT 0,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_JOBDEF (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ ACT_ID_ varchar(255),
+ JOB_TYPE_ varchar(255) NOT NULL,
+ JOB_CONFIGURATION_ varchar(255),
+ SUSPENSION_STATE_ integer,
+ JOB_PRIORITY_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RE_PROCDEF (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ HAS_START_FORM_KEY_ TINYINT,
+ SUSPENSION_STATE_ integer,
+ TENANT_ID_ varchar(64),
+ VERSION_TAG_ varchar(64),
+ HISTORY_TTL_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_TASK (
+ ID_ varchar(64),
+ REV_ integer,
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64),
+ NAME_ varchar(255),
+ PARENT_TASK_ID_ varchar(64),
+ DESCRIPTION_ varchar(4000),
+ TASK_DEF_KEY_ varchar(255),
+ OWNER_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ DELEGATION_ varchar(64),
+ PRIORITY_ integer,
+ CREATE_TIME_ timestamp(3),
+ DUE_DATE_ datetime(3),
+ FOLLOW_UP_DATE_ datetime(3),
+ SUSPENSION_STATE_ integer,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_IDENTITYLINK (
+ ID_ varchar(64),
+ REV_ integer,
+ GROUP_ID_ varchar(255),
+ TYPE_ varchar(255),
+ USER_ID_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_VARIABLE (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ TYPE_ varchar(255) not null,
+ NAME_ varchar(255) not null,
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ VAR_SCOPE_ varchar(64) not null,
+ SEQUENCE_COUNTER_ bigint,
+ IS_CONCURRENT_LOCAL_ TINYINT,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_EVENT_SUBSCR (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ EVENT_TYPE_ varchar(255) not null,
+ EVENT_NAME_ varchar(255),
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ ACTIVITY_ID_ varchar(255),
+ CONFIGURATION_ varchar(255),
+ CREATED_ timestamp(3) not null,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_INCIDENT (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ INCIDENT_TIMESTAMP_ timestamp(3) not null,
+ INCIDENT_MSG_ varchar(4000),
+ INCIDENT_TYPE_ varchar(255) not null,
+ EXECUTION_ID_ varchar(64),
+ ACTIVITY_ID_ varchar(255),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ CAUSE_INCIDENT_ID_ varchar(64),
+ ROOT_CAUSE_INCIDENT_ID_ varchar(64),
+ CONFIGURATION_ varchar(255),
+ TENANT_ID_ varchar(64),
+ JOB_DEF_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_AUTHORIZATION (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ TYPE_ integer not null,
+ GROUP_ID_ varchar(255),
+ USER_ID_ varchar(255),
+ RESOURCE_TYPE_ integer not null,
+ RESOURCE_ID_ varchar(255),
+ PERMS_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_FILTER (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ RESOURCE_TYPE_ varchar(255) not null,
+ NAME_ varchar(255) not null,
+ OWNER_ varchar(255),
+ QUERY_ LONGTEXT not null,
+ PROPERTIES_ LONGTEXT,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_METER_LOG (
+ ID_ varchar(64) not null,
+ NAME_ varchar(64) not null,
+ REPORTER_ varchar(255),
+ VALUE_ bigint,
+ TIMESTAMP_ timestamp(3),
+ MILLISECONDS_ bigint DEFAULT 0,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_EXT_TASK (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ WORKER_ID_ varchar(255),
+ TOPIC_NAME_ varchar(255),
+ RETRIES_ integer,
+ ERROR_MSG_ varchar(4000),
+ ERROR_DETAILS_ID_ varchar(64),
+ LOCK_EXP_TIME_ timestamp(3) NULL,
+ SUSPENSION_STATE_ integer,
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ ACT_ID_ varchar(255),
+ ACT_INST_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ PRIORITY_ bigint NOT NULL DEFAULT 0,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_BATCH (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ TYPE_ varchar(255),
+ TOTAL_JOBS_ integer,
+ JOBS_CREATED_ integer,
+ JOBS_PER_SEED_ integer,
+ INVOCATIONS_PER_JOB_ integer,
+ SEED_JOB_DEF_ID_ varchar(64),
+ BATCH_JOB_DEF_ID_ varchar(64),
+ MONITOR_JOB_DEF_ID_ varchar(64),
+ SUSPENSION_STATE_ integer,
+ CONFIGURATION_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
+create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_);
+create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
+create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_);
+create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_);
+create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
+create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
+create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
+create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_);
+create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);
+create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_);
+create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
+create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_);
+create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_);
+-- CAM-5914
+create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_);
+-- this index needs to be limited in mariadb see CAM-6938
+create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155));
+create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_);
+create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_);
+create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_);
+
+-- new metric milliseconds column
+CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_);
+CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_);
+CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_);
+
+-- old metric timestamp column
+CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_);
+CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_);
+
+create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_);
+create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_);
+create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_);
+create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_);
+create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_);
+create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_);
+
+alter table ACT_GE_BYTEARRAY
+ add constraint ACT_FK_BYTEARR_DEPL
+ foreign key (DEPLOYMENT_ID_)
+ references ACT_RE_DEPLOYMENT (ID_);
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_PARENT
+ foreign key (PARENT_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_SUPER
+ foreign key (SUPER_EXEC_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_PROCDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF (ID_);
+
+alter table ACT_RU_IDENTITYLINK
+ add constraint ACT_FK_TSKASS_TASK
+ foreign key (TASK_ID_)
+ references ACT_RU_TASK (ID_);
+
+alter table ACT_RU_IDENTITYLINK
+ add constraint ACT_FK_ATHRZ_PROCEDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF(ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_PROCDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF (ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION(ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_BYTEARRAY
+ foreign key (BYTEARRAY_ID_)
+ references ACT_GE_BYTEARRAY (ID_);
+
+alter table ACT_RU_JOB
+ add constraint ACT_FK_JOB_EXCEPTION
+ foreign key (EXCEPTION_STACK_ID_)
+ references ACT_GE_BYTEARRAY (ID_);
+
+alter table ACT_RU_EVENT_SUBSCR
+ add constraint ACT_FK_EVENT_EXEC
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION(ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_PROCDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF (ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_CAUSE
+ foreign key (CAUSE_INCIDENT_ID_)
+ references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_RCAUSE
+ foreign key (ROOT_CAUSE_INCIDENT_ID_)
+ references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_EXT_TASK
+ add constraint ACT_FK_EXT_TASK_ERROR_DETAILS
+ foreign key (ERROR_DETAILS_ID_)
+ references ACT_GE_BYTEARRAY (ID_);
+
+create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_);
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_JOB_DEF
+ foreign key (JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+alter table ACT_RU_AUTHORIZATION
+ add constraint ACT_UNIQ_AUTH_USER
+ unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_);
+
+alter table ACT_RU_AUTHORIZATION
+ add constraint ACT_UNIQ_AUTH_GROUP
+ unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_UNIQ_VARIABLE
+ unique (VAR_SCOPE_, NAME_);
+
+alter table ACT_RU_EXT_TASK
+ add constraint ACT_FK_EXT_TASK_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_);
+alter table ACT_RU_BATCH
+ add constraint ACT_FK_BATCH_SEED_JOB_DEF
+ foreign key (SEED_JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_);
+alter table ACT_RU_BATCH
+ add constraint ACT_FK_BATCH_MONITOR_JOB_DEF
+ foreign key (MONITOR_JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_);
+alter table ACT_RU_BATCH
+ add constraint ACT_FK_BATCH_JOB_DEF
+ foreign key (BATCH_JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 --
+create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_);
+create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_);
+create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_);
+create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_);
+create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_);
+-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 --
+create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_);
+-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 --
+create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_);
+
+-- indexes to improve deployment
+create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_);
+create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_);
+create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_);
+create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_);
+create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_);
+create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_);
+create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_);
+create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_);
+create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_);
+-- create case definition table --
+create table ACT_RE_CASE_DEF (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ HISTORY_TTL_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create case execution table --
+create table ACT_RU_CASE_EXECUTION (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ CASE_INST_ID_ varchar(64),
+ SUPER_CASE_EXEC_ varchar(64),
+ SUPER_EXEC_ varchar(64),
+ BUSINESS_KEY_ varchar(255),
+ PARENT_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ PREV_STATE_ integer,
+ CURRENT_STATE_ integer,
+ REQUIRED_ boolean,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create case sentry part table --
+
+create table ACT_RU_CASE_SENTRY_PART (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ CASE_INST_ID_ varchar(64),
+ CASE_EXEC_ID_ varchar(64),
+ SENTRY_ID_ varchar(255),
+ TYPE_ varchar(255),
+ SOURCE_CASE_EXEC_ID_ varchar(64),
+ STANDARD_EVENT_ varchar(255),
+ SOURCE_ varchar(255),
+ VARIABLE_EVENT_ varchar(255),
+ VARIABLE_NAME_ varchar(255),
+ SATISFIED_ boolean,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create index on business key --
+create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_);
+
+-- create foreign key constraints on ACT_RU_CASE_EXECUTION --
+alter table ACT_RU_CASE_EXECUTION
+ add constraint ACT_FK_CASE_EXE_CASE_INST
+ foreign key (CASE_INST_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_CASE_EXECUTION
+ add constraint ACT_FK_CASE_EXE_PARENT
+ foreign key (PARENT_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_CASE_EXECUTION
+ add constraint ACT_FK_CASE_EXE_CASE_DEF
+ foreign key (CASE_DEF_ID_)
+ references ACT_RE_CASE_DEF(ID_);
+
+-- create foreign key constraints on ACT_RU_VARIABLE --
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_CASE_EXE
+ foreign key (CASE_EXECUTION_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_CASE_INST
+ foreign key (CASE_INST_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+-- create foreign key constraints on ACT_RU_TASK --
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_CASE_EXE
+ foreign key (CASE_EXECUTION_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_CASE_DEF
+ foreign key (CASE_DEF_ID_)
+ references ACT_RE_CASE_DEF(ID_);
+
+-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART --
+alter table ACT_RU_CASE_SENTRY_PART
+ add constraint ACT_FK_CASE_SENTRY_CASE_INST
+ foreign key (CASE_INST_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_CASE_SENTRY_PART
+ add constraint ACT_FK_CASE_SENTRY_CASE_EXEC
+ foreign key (CASE_EXEC_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_);
+create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_);
+-- create decision definition table --
+create table ACT_RE_DECISION_DEF (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ DEC_REQ_ID_ varchar(64),
+ DEC_REQ_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ HISTORY_TTL_ integer,
+ VERSION_TAG_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create decision requirements definition table --
+create table ACT_RE_DECISION_REQ_DEF (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) NOT NULL,
+ VERSION_ integer NOT NULL,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+alter table ACT_RE_DECISION_DEF
+ add constraint ACT_FK_DEC_REQ
+ foreign key (DEC_REQ_ID_)
+ references ACT_RE_DECISION_REQ_DEF(ID_);
+
+create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_);
+create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_);
+create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_);
+create table ACT_HI_PROCINST (
+ ID_ varchar(64) not null,
+ PROC_INST_ID_ varchar(64) not null,
+ BUSINESS_KEY_ varchar(255),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64) not null,
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ START_USER_ID_ varchar(255),
+ START_ACT_ID_ varchar(255),
+ END_ACT_ID_ varchar(255),
+ SUPER_PROCESS_INSTANCE_ID_ varchar(64),
+ SUPER_CASE_INSTANCE_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ DELETE_REASON_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ STATE_ varchar(255),
+ primary key (ID_),
+ unique (PROC_INST_ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_ACTINST (
+ ID_ varchar(64) not null,
+ PARENT_ACT_INST_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64) not null,
+ PROC_INST_ID_ varchar(64) not null,
+ EXECUTION_ID_ varchar(64) not null,
+ ACT_ID_ varchar(255) not null,
+ TASK_ID_ varchar(64),
+ CALL_PROC_INST_ID_ varchar(64),
+ CALL_CASE_INST_ID_ varchar(64),
+ ACT_NAME_ varchar(255),
+ ACT_TYPE_ varchar(255) not null,
+ ASSIGNEE_ varchar(64),
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ ACT_INST_STATE_ integer,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_TASKINST (
+ ID_ varchar(64) not null,
+ TASK_DEF_KEY_ varchar(255),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ NAME_ varchar(255),
+ PARENT_TASK_ID_ varchar(64),
+ DESCRIPTION_ varchar(4000),
+ OWNER_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ DELETE_REASON_ varchar(4000),
+ PRIORITY_ integer,
+ DUE_DATE_ datetime(3),
+ FOLLOW_UP_DATE_ datetime(3),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_VARINST (
+ ID_ varchar(64) not null,
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ NAME_ varchar(255) not null,
+ VAR_TYPE_ varchar(100),
+ REV_ integer,
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ STATE_ varchar(20),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_DETAIL (
+ ID_ varchar(64) not null,
+ TYPE_ varchar(255) not null,
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ VAR_INST_ID_ varchar(64),
+ NAME_ varchar(255) not null,
+ VAR_TYPE_ varchar(255),
+ REV_ integer,
+ TIME_ datetime(3) not null,
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ OPERATION_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_IDENTITYLINK (
+ ID_ varchar(64) not null,
+ TIMESTAMP_ timestamp(3) not null,
+ TYPE_ varchar(255),
+ USER_ID_ varchar(255),
+ GROUP_ID_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ OPERATION_TYPE_ varchar(64),
+ ASSIGNER_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_COMMENT (
+ ID_ varchar(64) not null,
+ TYPE_ varchar(255),
+ TIME_ datetime(3) not null,
+ USER_ID_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ ACTION_ varchar(255),
+ MESSAGE_ varchar(4000),
+ FULL_MSG_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_ATTACHMENT (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ USER_ID_ varchar(255),
+ NAME_ varchar(255),
+ DESCRIPTION_ varchar(4000),
+ TYPE_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ URL_ varchar(4000),
+ CONTENT_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_OP_LOG (
+ ID_ varchar(64) not null,
+ DEPLOYMENT_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ JOB_ID_ varchar(64),
+ JOB_DEF_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
+ USER_ID_ varchar(255),
+ TIMESTAMP_ timestamp(3) not null,
+ OPERATION_TYPE_ varchar(64),
+ OPERATION_ID_ varchar(64),
+ ENTITY_TYPE_ varchar(30),
+ PROPERTY_ varchar(64),
+ ORG_VALUE_ varchar(4000),
+ NEW_VALUE_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_INCIDENT (
+ ID_ varchar(64) not null,
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CREATE_TIME_ timestamp(3) not null,
+ END_TIME_ timestamp(3) null,
+ INCIDENT_MSG_ varchar(4000),
+ INCIDENT_TYPE_ varchar(255) not null,
+ ACTIVITY_ID_ varchar(255),
+ CAUSE_INCIDENT_ID_ varchar(64),
+ ROOT_CAUSE_INCIDENT_ID_ varchar(64),
+ CONFIGURATION_ varchar(255),
+ INCIDENT_STATE_ integer,
+ TENANT_ID_ varchar(64),
+ JOB_DEF_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_JOB_LOG (
+ ID_ varchar(64) not null,
+ TIMESTAMP_ timestamp(3) not null,
+ JOB_ID_ varchar(64) not null,
+ JOB_DUEDATE_ timestamp(3) NULL,
+ JOB_RETRIES_ integer,
+ JOB_PRIORITY_ bigint NOT NULL DEFAULT 0,
+ JOB_EXCEPTION_MSG_ varchar(4000),
+ JOB_EXCEPTION_STACK_ID_ varchar(64),
+ JOB_STATE_ integer,
+ JOB_DEF_ID_ varchar(64),
+ JOB_DEF_TYPE_ varchar(255),
+ JOB_DEF_CONFIGURATION_ varchar(255),
+ ACT_ID_ varchar(255),
+ EXECUTION_ID_ varchar(64),
+ PROCESS_INSTANCE_ID_ varchar(64),
+ PROCESS_DEF_ID_ varchar(64),
+ PROCESS_DEF_KEY_ varchar(255),
+ DEPLOYMENT_ID_ varchar(64),
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_BATCH (
+ ID_ varchar(64) not null,
+ TYPE_ varchar(255),
+ TOTAL_JOBS_ integer,
+ JOBS_PER_SEED_ integer,
+ INVOCATIONS_PER_JOB_ integer,
+ SEED_JOB_DEF_ID_ varchar(64),
+ MONITOR_JOB_DEF_ID_ varchar(64),
+ BATCH_JOB_DEF_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_EXT_TASK_LOG (
+ ID_ varchar(64) not null,
+ TIMESTAMP_ timestamp(3) not null,
+ EXT_TASK_ID_ varchar(64) not null,
+ RETRIES_ integer,
+ TOPIC_NAME_ varchar(255),
+ WORKER_ID_ varchar(255),
+ PRIORITY_ bigint NOT NULL DEFAULT 0,
+ ERROR_MSG_ varchar(4000),
+ ERROR_DETAILS_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ ACT_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ STATE_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
+create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
+create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_);
+create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_);
+
+create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
+create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
+create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
+create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_);
+create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_);
+create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_);
+create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_);
+
+create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_);
+create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_);
+create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
+create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_);
+
+create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
+create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
+create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_);
+create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_);
+create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
+create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
+create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_);
+create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_);
+create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_);
+create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_);
+
+create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
+create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_);
+create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_);
+create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_);
+create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_);
+
+create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
+create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
+create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_);
+create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_);
+create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_);
+create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_);
+
+create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_);
+create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_);
+create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_);
+
+create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_);
+create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_);
+create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_);
+create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_);
+create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_);
+create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_);
+
+create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_);
+create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_);
+create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_);
+create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_);
+create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_);
+
+create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_);
+create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_);
+
+create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_);
+create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_);
+
+create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_);
+create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_);
+create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_);
+create table ACT_HI_CASEINST (
+ ID_ varchar(64) not null,
+ CASE_INST_ID_ varchar(64) not null,
+ BUSINESS_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64) not null,
+ CREATE_TIME_ datetime(3) not null,
+ CLOSE_TIME_ datetime(3),
+ DURATION_ bigint,
+ STATE_ integer,
+ CREATE_USER_ID_ varchar(255),
+ SUPER_CASE_INSTANCE_ID_ varchar(64),
+ SUPER_PROCESS_INSTANCE_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ primary key (ID_),
+ unique (CASE_INST_ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_CASEACTINST (
+ ID_ varchar(64) not null,
+ PARENT_ACT_INST_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64) not null,
+ CASE_INST_ID_ varchar(64) not null,
+ CASE_ACT_ID_ varchar(255) not null,
+ TASK_ID_ varchar(64),
+ CALL_PROC_INST_ID_ varchar(64),
+ CALL_CASE_INST_ID_ varchar(64),
+ CASE_ACT_NAME_ varchar(255),
+ CASE_ACT_TYPE_ varchar(255),
+ CREATE_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ STATE_ integer,
+ REQUIRED_ boolean,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_);
+create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_);
+create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_);
+create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_);
+create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_);
+create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_);
+create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_);
+create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_);
+-- create history decision instance table --
+create table ACT_HI_DECINST (
+ ID_ varchar(64) NOT NULL,
+ DEC_DEF_ID_ varchar(64) NOT NULL,
+ DEC_DEF_KEY_ varchar(255) NOT NULL,
+ DEC_DEF_NAME_ varchar(255),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ EVAL_TIME_ datetime(3) not null,
+ COLLECT_VALUE_ double,
+ USER_ID_ varchar(255),
+ ROOT_DEC_INST_ID_ varchar(64),
+ DEC_REQ_ID_ varchar(64),
+ DEC_REQ_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create history decision input table --
+create table ACT_HI_DEC_IN (
+ ID_ varchar(64) NOT NULL,
+ DEC_INST_ID_ varchar(64) NOT NULL,
+ CLAUSE_ID_ varchar(64),
+ CLAUSE_NAME_ varchar(255),
+ VAR_TYPE_ varchar(100),
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create history decision output table --
+create table ACT_HI_DEC_OUT (
+ ID_ varchar(64) NOT NULL,
+ DEC_INST_ID_ varchar(64) NOT NULL,
+ CLAUSE_ID_ varchar(64),
+ CLAUSE_NAME_ varchar(255),
+ RULE_ID_ varchar(64),
+ RULE_ORDER_ integer,
+ VAR_NAME_ varchar(255),
+ VAR_TYPE_ varchar(100),
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+
+create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_);
+create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_);
+create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_);
+create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_);
+create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_);
+create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_);
+create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_);
+
+
+create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_);
+create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_);
+
+create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_);
+create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_);
+
+-- mariadb_identity_7.8.0-ee
+
+create table ACT_ID_GROUP (
+ ID_ varchar(64),
+ REV_ integer,
+ NAME_ varchar(255),
+ TYPE_ varchar(255),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_MEMBERSHIP (
+ USER_ID_ varchar(64),
+ GROUP_ID_ varchar(64),
+ primary key (USER_ID_, GROUP_ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_USER (
+ ID_ varchar(64),
+ REV_ integer,
+ FIRST_ varchar(255),
+ LAST_ varchar(255),
+ EMAIL_ varchar(255),
+ PWD_ varchar(255),
+ SALT_ varchar(255),
+ PICTURE_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_INFO (
+ ID_ varchar(64),
+ REV_ integer,
+ USER_ID_ varchar(64),
+ TYPE_ varchar(64),
+ KEY_ varchar(255),
+ VALUE_ varchar(255),
+ PASSWORD_ LONGBLOB,
+ PARENT_ID_ varchar(255),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_TENANT (
+ ID_ varchar(64),
+ REV_ integer,
+ NAME_ varchar(255),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_TENANT_MEMBER (
+ ID_ varchar(64) not null,
+ TENANT_ID_ varchar(64) not null,
+ USER_ID_ varchar(64),
+ GROUP_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+alter table ACT_ID_MEMBERSHIP
+ add constraint ACT_FK_MEMB_GROUP
+ foreign key (GROUP_ID_)
+ references ACT_ID_GROUP (ID_);
+
+alter table ACT_ID_MEMBERSHIP
+ add constraint ACT_FK_MEMB_USER
+ foreign key (USER_ID_)
+ references ACT_ID_USER (ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_UNIQ_TENANT_MEMB_USER
+ unique (TENANT_ID_, USER_ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_UNIQ_TENANT_MEMB_GROUP
+ unique (TENANT_ID_, GROUP_ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_FK_TENANT_MEMB
+ foreign key (TENANT_ID_)
+ references ACT_ID_TENANT (ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_FK_TENANT_MEMB_USER
+ foreign key (USER_ID_)
+ references ACT_ID_USER (ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_FK_TENANT_MEMB_GROUP
+ foreign key (GROUP_ID_)
+ references ACT_ID_GROUP (ID_);
+
+