aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java/org
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:14:34 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:24:59 -0400
commitf47919f1fe367b612fa9c96d34c59f01a541e882 (patch)
tree5b6aa2fc36747d868897e68ccbec0c6db0aee81c /bpmn/so-bpmn-tasks/src/main/java/org
parent54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff)
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java221
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java1030
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java988
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java295
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java148
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java399
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java1026
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java196
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java135
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java222
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java119
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java86
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java236
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java109
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java105
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java192
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java263
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java202
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java229
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java191
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java181
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java89
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SourceSystem.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java364
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java153
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java191
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java158
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java205
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java146
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java174
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java167
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java274
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java141
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java2401
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java217
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java744
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java52
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java537
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java237
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterRestProperties.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java675
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClient.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java183
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterRestProperties.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClient.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java137
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestProperties.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java257
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperUtils.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java1505
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java93
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java189
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java305
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java207
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java120
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java211
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java99
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java145
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java145
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java98
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNOHealthCheckResources.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java344
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java112
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java265
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java170
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java144
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java197
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java165
152 files changed, 11705 insertions, 11194 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 55f898742c..513ff74180 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -54,7 +54,7 @@ public class HomingV2 {
// Default solution is SNIRO. OOF gets called only if specified.
private boolean isOof(BuildingBlockExecution execution) {
for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
- .getUserParams()) {
+ .getUserParams()) {
if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) {
return true;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
index f65dde1af5..2524fc7892 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
@@ -65,19 +65,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriUtils;
-
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
/**
- * The oof homing building block obtains licensing and homing solutions for a given
- * resource or set of resources.
+ * The oof homing building block obtains licensing and homing solutions for a given resource or set of resources.
*
*/
@Component("OofHoming")
@@ -109,14 +106,13 @@ public class OofHomingV2 {
private static final int INTERNAL = 500;
/**
- * Generates the request payload then sends to Oof to perform homing and
- * licensing for the provided demands
+ * Generates the request payload then sends to Oof to perform homing and licensing for the provided demands
*
* @param execution
*/
- public void callOof(BuildingBlockExecution execution){
+ public void callOof(BuildingBlockExecution execution) {
logger.trace("Started Sniro Homing Call Sniro");
- try{
+ try {
GeneralBuildingBlock bb = execution.getGeneralBuildingBlock();
RequestContext requestContext = bb.getRequestContext();
@@ -127,13 +123,13 @@ public class OofHomingV2 {
Customer customer = bb.getCustomer();
String timeout = execution.getVariable("timeout");
- if(isBlank(timeout)){
+ if (isBlank(timeout)) {
timeout = env.getProperty("oof.timeout", "PT30M");
}
OofRequest request = new OofRequest();
- RequestInfo requestInfo = (RequestInfo)buildRequestInfo(requestId, timeout);
+ RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout);
request.setRequestInformation(requestInfo);
ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
@@ -151,71 +147,74 @@ public class OofHomingV2 {
licenseInfo.put("licenseDemands", licenseDemands);
request.setLicenseInformation(licenseInfo.toString());
- if(placementDemands.size() > 0 || licenseDemands.length() > 0){
+ if (placementDemands.size() > 0 || licenseDemands.length() > 0) {
client.postDemands(request);
- }else{
+ } else {
logger.debug(SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
- throw new BpmnError(UNPROCESSABLE, 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
+ // Variables for ReceiveWorkflowMessage subflow
execution.setVariable("asyncCorrelator", requestId);
execution.setVariable("asyncMessageType", "OofResponse");
execution.setVariable("asyncTimeout", timeout);
logger.trace("Completed Oof Homing Call Oof");
- }catch(BpmnError e){
+ } catch (BpmnError e) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
+ } catch (BadResponseException e) {
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing oof request: " + e.getMessage());
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
+ "Internal Error - occurred while preparing oof request: " + e.getMessage());
}
}
/**
- * Validates, processes, and sets the homing and licensing solutions that are returned by
- * Oof
+ * Validates, processes, and sets the homing and licensing solutions that are returned by Oof
*
* @param execution
* @param asyncResponse
*/
- public void processSolution(BuildingBlockExecution execution, String asyncResponse){
+ public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
logger.trace("Started Oof Homing Process Solution");
- try{
+ try {
oofValidator.validateSolution(asyncResponse);
- ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription()
+ .getServiceInstances().get(0);
logger.debug("Processing Oof asyncronous response");
JSONObject response = new JSONObject(asyncResponse);
- if(response.has(SOLUTIONS)){
+ if (response.has(SOLUTIONS)) {
JSONObject allSolutions = response.getJSONObject(SOLUTIONS);
- if(allSolutions.has("placementSolutions")){
+ if (allSolutions.has("placementSolutions")) {
JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions");
- for(int i = 0; i < placementSolutions.length(); i++){
+ for (int i = 0; i < placementSolutions.length(); i++) {
JSONArray placements = placementSolutions.getJSONArray(i);
processPlacementSolution(serviceInstance, placements, i);
}
}
- if(allSolutions.has("licenseSolutions")){
+ if (allSolutions.has("licenseSolutions")) {
JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions");
- if(licenseSolutions.length() > 0){
+ if (licenseSolutions.length() > 0) {
processLicenseSolution(serviceInstance, licenseSolutions);
}
}
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, "Oof response does not contain: " + SOLUTIONS);
}
execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
logger.trace("Completed Oof Homing Process Solution");
- }catch(BpmnError e){
+ } catch (BpmnError e) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
+ } catch (BadResponseException e) {
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
+ "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
}
}
@@ -224,12 +223,13 @@ public class OofHomingV2 {
*
* @throws Exception
*/
- private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
+ private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
logger.trace("Building request information");
RequestInfo requestInfo = new RequestInfo();
- if(requestId != null){
+ if (requestId != null) {
String host = env.getProperty("mso.workflow.message.endpoint");
- String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8");
+ String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/"
+ + UriUtils.encodePathSegment(requestId, "UTF-8");
Duration d = Duration.parse(timeout);
long timeoutSeconds = d.getSeconds();
@@ -240,7 +240,7 @@ public class OofHomingV2 {
requestInfo.setSourceId("mso");
requestInfo.setRequestType("create");
requestInfo.setTimeout(timeoutSeconds);
- } else{
+ } else {
throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
}
return requestInfo;
@@ -250,17 +250,17 @@ public class OofHomingV2 {
* Builds the request information section for the homing/licensing request
*
*/
- private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
+ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance) {
logger.trace("Building service information");
ServiceInfo info = new ServiceInfo();
ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
- if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
+ if (isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())) {
info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
+ if (modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0) { // temp solution
info.setServiceName(modelInfo.getServiceType());
}
info.setModelInfo(buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID);
}
return info;
@@ -270,32 +270,32 @@ public class OofHomingV2 {
* Builds initial section of placement info for the homing/licensing request
*
*/
- private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
+ private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams) {
PlacementInfo placementInfo = new PlacementInfo();
- if(customer != null){
+ if (customer != null) {
logger.debug("Adding subscriber to placement information");
SubscriberInfo subscriberInfo = new SubscriberInfo();
subscriberInfo.setGlobalSubscriberId(customer.getGlobalCustomerId());
subscriberInfo.setSubscriberName(customer.getSubscriberName());
subscriberInfo.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
placementInfo.setSubscriberInfo(subscriberInfo);
- if(requestParams != null){
+ if (requestParams != null) {
logger.debug("Adding request parameters to placement information");
OofRequestParameters oofRequestParams = new OofRequestParameters();
- for (Map requestParam : requestParams.getUserParams()){
- if (requestParam.containsKey("customerLatitude")){
+ for (Map requestParam : requestParams.getUserParams()) {
+ if (requestParam.containsKey("customerLatitude")) {
oofRequestParams.setCustomerLatitude(requestParam.get("customerLatitude").toString());
}
- if (requestParam.containsKey("customerLongitude")){
+ if (requestParam.containsKey("customerLongitude")) {
oofRequestParams.setCustomerLongitude(requestParam.get("customerLongitude").toString());
}
- if (requestParam.containsKey("customerName")){
+ if (requestParam.containsKey("customerName")) {
oofRequestParams.setCustomerName(requestParam.get("customerName").toString());
}
}
placementInfo.setRequestParameters(oofRequestParams);
}
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
}
return placementInfo;
@@ -306,33 +306,33 @@ public class OofHomingV2 {
* Builds the placement demand list for the homing/licensing request
*
*/
- private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance){
+ private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance) {
logger.trace("Building placement information demands");
ArrayList<PlacementDemand> placementDemands = new ArrayList();
List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
- if(!allottedResourceList.isEmpty()){
+ if (!allottedResourceList.isEmpty()) {
logger.debug("Adding allotted resources to placement demands list");
- for(AllottedResource ar : allottedResourceList){
- if(isBlank(ar.getId())){
+ for (AllottedResource ar : allottedResourceList) {
+ if (isBlank(ar.getId())) {
ar.setId(UUID.randomUUID().toString());
}
PlacementDemand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
- //addCandidates(ar, demand);
+ // addCandidates(ar, demand);
placementDemands.add(demand);
}
}
List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
- if(!vpnBondingLinkList.isEmpty()){
+ if (!vpnBondingLinkList.isEmpty()) {
logger.debug("Adding vpn bonding links to placement demands list");
- for(VpnBondingLink vbl:vpnBondingLinkList){
+ for (VpnBondingLink vbl : vpnBondingLinkList) {
List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
- for(ServiceProxy sp : serviceProxyList){
- if(isBlank(sp.getId())){
+ for (ServiceProxy sp : serviceProxyList) {
+ if (isBlank(sp.getId())) {
sp.setId(UUID.randomUUID().toString());
}
PlacementDemand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
- //addCandidates(sp, demand);
+ // addCandidates(sp, demand);
placementDemands.add(demand);
}
}
@@ -344,13 +344,13 @@ public class OofHomingV2 {
* Builds the license demand list for the homing/licensing request
*
*/
- private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){
+ private JSONArray buildLicenseDemands(ServiceInstance serviceInstance) {
logger.trace("Building license information");
JSONArray licenseDemands = new JSONArray();
List<GenericVnf> vnfList = serviceInstance.getVnfs();
- if(!vnfList.isEmpty()){
+ if (!vnfList.isEmpty()) {
logger.debug("Adding vnfs to license demands list");
- for(GenericVnf vnf : vnfList){
+ for (GenericVnf vnf : vnfList) {
JSONObject demand = buildLicenseDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
licenseDemands.put(demand);
}
@@ -362,14 +362,14 @@ public class OofHomingV2 {
* Builds a single license demand object
*
*/
- private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata){
+ private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata) {
logger.debug("Building demand for service or resource: " + id);
JSONObject demand = new JSONObject();
- if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ 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{
+ } else {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
}
return demand;
@@ -379,14 +379,14 @@ public class OofHomingV2 {
* Builds a single demand object
*
*/
- private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata){
+ private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata) {
logger.debug("Building demand for service or resource: " + id);
PlacementDemand placementDemand = new PlacementDemand();
- if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
placementDemand.setServiceResourceId(id);
placementDemand.setResourceModuleName(metadata.getModelInstanceName());
placementDemand.setResourceModelInfo((ResourceModelInfo) buildModelInfo(metadata));
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
}
return placementDemand;
@@ -396,18 +396,18 @@ public class OofHomingV2 {
* Builds the resource model info section
*
*/
- private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
+ private ModelInfo buildModelInfo(ModelInfoMetadata metadata) {
ModelInfo modelInfo = new ModelInfo();
String invariantUuid = metadata.getModelInvariantUuid();
String modelUuid = metadata.getModelUuid();
- if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
+ if (isNotBlank(invariantUuid) && isNotBlank(modelUuid)) {
modelInfo.setModelInvariantId(invariantUuid);
modelInfo.setModelVersionId(modelUuid);
modelInfo.setModelName(metadata.getModelName());
modelInfo.setModelVersion(metadata.getModelVersion());
- }else if(isNotBlank(invariantUuid)){
+ } else if (isNotBlank(invariantUuid)) {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID);
- }else{
+ } else {
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID);
}
return modelInfo;
@@ -417,30 +417,30 @@ public class OofHomingV2 {
* Adds required, excluded, and existing candidates to a demand
*
*/
- private void addCandidates(SolutionCandidates candidates, JSONObject demand){
+ private void addCandidates(SolutionCandidates candidates, JSONObject demand) {
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
- if(!required.isEmpty()){
+ if (!required.isEmpty()) {
demand.put("requiredCandidates", required);
}
- if(!excluded.isEmpty()){
+ if (!excluded.isEmpty()) {
demand.put("excludedCandidates", excluded);
}
- //TODO support existing candidates
+ // TODO support existing candidates
}
/**
* Processes the license solutions and sets to the corresponding generic vnf
*
*/
- private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){
+ private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions) {
List<GenericVnf> vnfs = serviceInstance.getVnfs();
logger.debug("Processing the license solution");
- for(int i = 0; i < licenseSolutions.length(); i++){
+ 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())){
+ 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);
@@ -456,47 +456,48 @@ public class OofHomingV2 {
}
/**
- * Processes a placement solution list then correlates and sets each placement solution
- * to its corresponding resource
+ * 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){
+ private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i) {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
- logger.debug("Processing placement solution " + i+1);
- for(int p = 0; p < placements.length(); p++){
+ logger.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){
+ 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){
+ 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{
+ 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())){
+ 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())){
+ 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));
@@ -512,7 +513,7 @@ public class OofHomingV2 {
* Creates and sets necessary pojos with placement solution data for a given demand
*
*/
- private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){
+ private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement) {
logger.debug("Mapping placement solution");
String invalidMessage = "Oof Response contains invalid: ";
@@ -528,45 +529,45 @@ public class OofHomingV2 {
ServiceInstance si = new ServiceInstance();
CloudRegion cloud = setCloud(assignmentsMap);
- if(type.equals("service")){
- if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){
+ 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")){
+ if (assignmentsMap.containsKey("vnfHostName")) {
logger.debug("Resources has been homed to a vnf");
GenericVnf vnf = setVnf(assignmentsMap);
vnf.setCloudRegion(cloud);
si.getVnfs().add(vnf);
- }else if(assignmentsMap.containsKey("primaryPnfName")){
+ } else if (assignmentsMap.containsKey("primaryPnfName")) {
logger.debug("Resources has been homed to a pnf");
Pnf priPnf = setPnf(assignmentsMap, "primary");
priPnf.setCloudRegion(cloud);
si.getPnfs().add(priPnf);
- if(assignmentsMap.containsKey("secondaryPnfName")){
+ if (assignmentsMap.containsKey("secondaryPnfName")) {
Pnf secPnf = setPnf(assignmentsMap, "secondary");
secPnf.setCloudRegion(cloud);
si.getPnfs().add(secPnf);
}
}
- }else{
+ } else {
logger.debug(invalidMessage + IDENTIFIER_TYPE);
throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
}
- }else if(type.equals("cloud")){
- if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
+ } else if (type.equals("cloud")) {
+ if (identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())) {
logger.debug("Resources has been homed to a cloud region");
cloud.setLcpCloudRegionId(identifierValue);
solutionInfo.setHomed(false);
solutionInfo.setTargetedCloudRegion(cloud);
si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- }else{
+ } else {
logger.debug(invalidMessage + IDENTIFIER_TYPE);
throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
}
- }else{
+ } else {
logger.debug(invalidMessage + INVENTORY_TYPE);
throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE);
}
@@ -578,7 +579,7 @@ public class OofHomingV2 {
* Sets the cloud data to a cloud region object
*
*/
- private CloudRegion setCloud(Map<String, String> assignmentsMap){
+ private CloudRegion setCloud(Map<String, String> assignmentsMap) {
CloudRegion cloud = new CloudRegion();
cloud.setCloudOwner(assignmentsMap.get("cloudOwner"));
cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion"));
@@ -590,7 +591,7 @@ public class OofHomingV2 {
* Sets the vnf data to a generic vnf object
*
*/
- private GenericVnf setVnf(Map<String, String> assignmentsMap){
+ private GenericVnf setVnf(Map<String, String> assignmentsMap) {
GenericVnf vnf = new GenericVnf();
vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
vnf.setVnfName(assignmentsMap.get("vnfHostName"));
@@ -602,7 +603,7 @@ public class OofHomingV2 {
* Sets the pnf data to a pnf object
*
*/
- private Pnf setPnf(Map<String, String> assignmentsMap, String role){
+ private Pnf setPnf(Map<String, String> assignmentsMap, String role) {
Pnf pnf = new Pnf();
pnf.setRole(role);
pnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
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
index 2e7184b9ff..29037980cc 100644
--- 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
@@ -23,13 +23,11 @@
package org.onap.so.bpmn.buildingblock;
import static org.apache.commons.lang3.StringUtils.*;
-
import java.time.Duration;
import java.util.ArrayList;
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;
@@ -56,10 +54,8 @@ 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.Demand;
import org.onap.so.client.sniro.beans.LicenseInfo;
import org.onap.so.client.sniro.beans.ModelInfo;
@@ -78,8 +74,7 @@ import org.springframework.web.util.UriUtils;
/**
- * The sniro homing building block obtains licensing and homing solutions for a given
- * resource or set of resources.
+ * The sniro homing building block obtains licensing and homing solutions for a given resource or set of resources.
*
* @author cb645j
*
@@ -87,514 +82,521 @@ import org.springframework.web.util.UriUtils;
@Component("SniroHoming")
public class SniroHomingV2 {
- private static final Logger logger = LoggerFactory.getLogger(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 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){
- logger.debug("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();
-
- RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
- request.setRequestInformation(requestInfo);
-
- ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
- request.setServiceInformation(serviceInfo);
-
- PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams);
-
- List<Demand> placementDemands = buildPlacementDemands(serviceInstance);
- placementInfo.setDemands(placementDemands);
- request.setPlacementInformation(placementInfo);
-
- LicenseInfo licenseInfo = new LicenseInfo();
-
- List<Demand> licenseDemands = buildLicenseDemands(serviceInstance);
- licenseInfo.setDemands(licenseDemands);
- request.setLicenseInformation(licenseInfo);
-
- if(placementDemands.size() > 0 || licenseDemands.size() > 0){
- client.postDemands(request);
- }else{
- logger.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);
-
- logger.trace("Completed Sniro Homing Call Sniro");
- }catch(BpmnError e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- logger.error("Exception occurred", 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){
- logger.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);
-
- logger.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());
-
- logger.trace("Completed Sniro Homing Process Solution");
- }catch(BpmnError e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
- }catch(BadResponseException e){
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
- }catch(Exception e){
- logger.error("Exception occurred", 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 RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
- logger.trace("Building request information");
- RequestInfo requestInfo = new RequestInfo();
- 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);
-
- requestInfo.setTransactionId(requestId);
- requestInfo.setRequestId(requestId);
- requestInfo.setCallbackUrl(callbackUrl);
- requestInfo.setRequestType("create");
- requestInfo.setTimeout(d.getSeconds());
-
- } else{
- throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
- }
- return requestInfo;
- }
-
- /**
- * Builds the request information section for the homing/licensing request
- *
- */
- private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
- logger.trace("Building service information");
- ServiceInfo info = new ServiceInfo();
- ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
- if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
- info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
- info.setServiceName(modelInfo.getServiceType());
- }
- if(modelInfo.getServiceRole() != null){
- info.setServiceRole(modelInfo.getServiceRole());
- }
- info.setModelInfo(buildModelInfo(modelInfo));
- }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 PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
- PlacementInfo placementInfo = new PlacementInfo();
- if(customer != null){
- logger.debug("Adding subscriber to placement information");
- SubscriberInfo subscriber = new SubscriberInfo();
- subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId());
- subscriber.setSubscriberName(customer.getSubscriberName());
- subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
- placementInfo.setSubscriberInfo(subscriber);
- if(requestParams != null){
- logger.debug("Adding request parameters to placement information");
- placementInfo.setRequestParameters(requestParams.toJsonString());
- }
- }else{
- throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
- }
- return placementInfo;
-
- }
-
- /**
- * Builds the placement demand list for the homing/licensing request
- *
- */
- private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance){
- logger.trace("Building placement information demands");
- List<Demand> placementDemands = new ArrayList<Demand>();
-
- List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
- if(!allottedResourceList.isEmpty()){
- logger.debug("Adding allotted resources to placement demands list");
- for(AllottedResource ar : allottedResourceList){
- if(isBlank(ar.getId())){
- ar.setId(UUID.randomUUID().toString());
- }
- Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
- addCandidates(ar, demand);
- placementDemands.add(demand);
- }
- }
- List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
- if(!vpnBondingLinkList.isEmpty()){
- logger.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());
- }
- Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
- addCandidates(sp, demand);
- placementDemands.add(demand);
- }
- }
- }
- return placementDemands;
- }
-
- /**
- * Builds the license demand list for the homing/licensing request
- *
- */
- private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance){
- logger.trace("Building license information");
- List<Demand> licenseDemands = new ArrayList<Demand>();
- List<GenericVnf> vnfList = serviceInstance.getVnfs();
- if(!vnfList.isEmpty()){
- logger.debug("Adding vnfs to license demands list");
- for(GenericVnf vnf : vnfList){
- Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
- licenseDemands.add(demand);
- }
- }
- return licenseDemands;
- }
-
- /**
- * Builds a single demand object
- *
- */
- private Demand buildDemand(String id, ModelInfoMetadata metadata){
- logger.debug("Building demand for service or resource: " + id);
- Demand demand = new Demand();
- if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
- demand.setServiceResourceId(id);
- demand.setResourceModuleName(metadata.getModelInstanceName());
- demand.setModelInfo(buildModelInfo(metadata));
- }else{
- throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
- }
- return demand;
- }
-
- /**
- * Builds the resource model info section
- *
- */
- private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
- ModelInfo object = new ModelInfo();
- String invariantUuid = metadata.getModelInvariantUuid();
- String modelUuid = metadata.getModelUuid();
- if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
- object.setModelInvariantId(invariantUuid);
- object.setModelVersionId(modelUuid);
- object.setModelName(metadata.getModelName());
- object.setModelVersion(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, Demand demand){
- List<Candidate> required = candidates.getRequiredCandidates();
- List<Candidate> excluded = candidates.getExcludedCandidates();
- if(!required.isEmpty()){
- List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for(Candidate c:required){
- org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
- can.setIdentifiers(c.getIdentifiers());
- can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
- }
- demand.setRequiredCandidates(cans);
- }
- if(!excluded.isEmpty()){
- List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for(Candidate c:excluded){
- org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
- can.setIdentifiers(c.getIdentifiers());
- can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
- }
- demand.setExcludedCandidates(cans);
- }
- //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();
-
- logger.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();
-
- logger.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){
- logger.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")));
-
- ServiceInstance si = new ServiceInstance();
- CloudRegion cloud = setCloud(assignmentsMap);
- 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")){
- logger.debug("Resources has been homed to a vnf");
- GenericVnf vnf = setVnf(assignmentsMap);
- vnf.setCloudRegion(cloud);
- si.getVnfs().add(vnf);
-
- }else if(assignmentsMap.containsKey("primaryPnfName")){
- logger.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 if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
- logger.debug("Resources has been homed to a cloud region");
- cloud.setLcpCloudRegionId(identifierValue);
- solutionInfo.setHomed(false);
- solutionInfo.setTargetedCloudRegion(cloud);
- si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- }else{
- logger.debug(invalidMessage + IDENTIFIER_TYPE);
- throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_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;
- }
+ private static final Logger logger = LoggerFactory.getLogger(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 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) {
+ logger.debug("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();
+
+ RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
+ request.setRequestInformation(requestInfo);
+
+ ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
+ request.setServiceInformation(serviceInfo);
+
+ PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams);
+
+ List<Demand> placementDemands = buildPlacementDemands(serviceInstance);
+ placementInfo.setDemands(placementDemands);
+ request.setPlacementInformation(placementInfo);
+
+ LicenseInfo licenseInfo = new LicenseInfo();
+
+ List<Demand> licenseDemands = buildLicenseDemands(serviceInstance);
+ licenseInfo.setDemands(licenseDemands);
+ request.setLicenseInformation(licenseInfo);
+
+ if (placementDemands.size() > 0 || licenseDemands.size() > 0) {
+ client.postDemands(request);
+ } else {
+ logger.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);
+
+ logger.trace("Completed Sniro Homing Call Sniro");
+ } catch (BpmnError e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ } catch (BadResponseException e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ } catch (Exception e) {
+ logger.error("Exception occurred", 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) {
+ logger.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);
+
+ logger.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());
+
+ logger.trace("Completed Sniro Homing Process Solution");
+ } catch (BpmnError e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ } catch (BadResponseException e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ } catch (Exception e) {
+ logger.error("Exception occurred", 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 RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
+ logger.trace("Building request information");
+ RequestInfo requestInfo = new RequestInfo();
+ 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);
+
+ requestInfo.setTransactionId(requestId);
+ requestInfo.setRequestId(requestId);
+ requestInfo.setCallbackUrl(callbackUrl);
+ requestInfo.setRequestType("create");
+ requestInfo.setTimeout(d.getSeconds());
+
+ } else {
+ throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
+ }
+ return requestInfo;
+ }
+
+ /**
+ * Builds the request information section for the homing/licensing request
+ *
+ */
+ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance) {
+ logger.trace("Building service information");
+ ServiceInfo info = new ServiceInfo();
+ ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
+ if (isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())) {
+ info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ if (modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0) { // temp solution
+ info.setServiceName(modelInfo.getServiceType());
+ }
+ if (modelInfo.getServiceRole() != null) {
+ info.setServiceRole(modelInfo.getServiceRole());
+ }
+ info.setModelInfo(buildModelInfo(modelInfo));
+ } 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 PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams) {
+ PlacementInfo placementInfo = new PlacementInfo();
+ if (customer != null) {
+ logger.debug("Adding subscriber to placement information");
+ SubscriberInfo subscriber = new SubscriberInfo();
+ subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId());
+ subscriber.setSubscriberName(customer.getSubscriberName());
+ subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
+ placementInfo.setSubscriberInfo(subscriber);
+ if (requestParams != null) {
+ logger.debug("Adding request parameters to placement information");
+ placementInfo.setRequestParameters(requestParams.toJsonString());
+ }
+ } else {
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
+ }
+ return placementInfo;
+
+ }
+
+ /**
+ * Builds the placement demand list for the homing/licensing request
+ *
+ */
+ private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance) {
+ logger.trace("Building placement information demands");
+ List<Demand> placementDemands = new ArrayList<Demand>();
+
+ List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
+ if (!allottedResourceList.isEmpty()) {
+ logger.debug("Adding allotted resources to placement demands list");
+ for (AllottedResource ar : allottedResourceList) {
+ if (isBlank(ar.getId())) {
+ ar.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
+ addCandidates(ar, demand);
+ placementDemands.add(demand);
+ }
+ }
+ List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
+ if (!vpnBondingLinkList.isEmpty()) {
+ logger.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());
+ }
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
+ }
+ return placementDemands;
+ }
+
+ /**
+ * Builds the license demand list for the homing/licensing request
+ *
+ */
+ private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance) {
+ logger.trace("Building license information");
+ List<Demand> licenseDemands = new ArrayList<Demand>();
+ List<GenericVnf> vnfList = serviceInstance.getVnfs();
+ if (!vnfList.isEmpty()) {
+ logger.debug("Adding vnfs to license demands list");
+ for (GenericVnf vnf : vnfList) {
+ Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
+ licenseDemands.add(demand);
+ }
+ }
+ return licenseDemands;
+ }
+
+ /**
+ * Builds a single demand object
+ *
+ */
+ private Demand buildDemand(String id, ModelInfoMetadata metadata) {
+ logger.debug("Building demand for service or resource: " + id);
+ Demand demand = new Demand();
+ if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
+ demand.setServiceResourceId(id);
+ demand.setResourceModuleName(metadata.getModelInstanceName());
+ demand.setModelInfo(buildModelInfo(metadata));
+ } else {
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
+ }
+ return demand;
+ }
+
+ /**
+ * Builds the resource model info section
+ *
+ */
+ private ModelInfo buildModelInfo(ModelInfoMetadata metadata) {
+ ModelInfo object = new ModelInfo();
+ String invariantUuid = metadata.getModelInvariantUuid();
+ String modelUuid = metadata.getModelUuid();
+ if (isNotBlank(invariantUuid) && isNotBlank(modelUuid)) {
+ object.setModelInvariantId(invariantUuid);
+ object.setModelVersionId(modelUuid);
+ object.setModelName(metadata.getModelName());
+ object.setModelVersion(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, Demand demand) {
+ List<Candidate> required = candidates.getRequiredCandidates();
+ List<Candidate> excluded = candidates.getExcludedCandidates();
+ if (!required.isEmpty()) {
+ List<org.onap.so.client.sniro.beans.Candidate> cans =
+ new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for (Candidate c : required) {
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setRequiredCandidates(cans);
+ }
+ if (!excluded.isEmpty()) {
+ List<org.onap.so.client.sniro.beans.Candidate> cans =
+ new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for (Candidate c : excluded) {
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setExcludedCandidates(cans);
+ }
+ // 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();
+
+ logger.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();
+
+ logger.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) {
+ logger.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")));
+
+ ServiceInstance si = new ServiceInstance();
+ CloudRegion cloud = setCloud(assignmentsMap);
+ 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")) {
+ logger.debug("Resources has been homed to a vnf");
+ GenericVnf vnf = setVnf(assignmentsMap);
+ vnf.setCloudRegion(cloud);
+ si.getVnfs().add(vnf);
+
+ } else if (assignmentsMap.containsKey("primaryPnfName")) {
+ logger.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 if (identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())) {
+ logger.debug("Resources has been homed to a cloud region");
+ cloud.setLcpCloudRegionId(identifierValue);
+ solutionInfo.setHomed(false);
+ solutionInfo.setTargetedCloudRegion(cloud);
+ si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ } else {
+ logger.debug(invalidMessage + IDENTIFIER_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_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
index bdb46e8d2b..7b518dcc86 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -33,24 +32,25 @@ 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);
- ModelInfoServiceInstance model = serviceInstance.getModelInfoServiceInstance();
- if (model != null) {
- return Optional.of(model.getServiceType());
- }
- } catch(Exception e) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
- }
- return Optional.empty();
- }
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public Optional<String> getServiceType(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, 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
index 279957ca1e..4d4b7c9ad2 100644
--- 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
@@ -29,7 +29,6 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -74,493 +73,524 @@ import org.springframework.stereotype.Component;
@Component
public class AAICreateTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class);
- private static final String networkTypeProvider = "PROVIDER";
- private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
- private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
- private static String HEAT_STACK_ID = "heatStackId";
- private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
- @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;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private AAIInstanceGroupResources aaiInstanceGroupResources;
- @Autowired
- private Environment env;
-
- public void createServiceInstance(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, 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);
+ private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class);
+ private static final String networkTypeProvider = "PROVIDER";
+ private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
+ private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ private static String HEAT_STACK_ID = "heatStackId";
+ private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+ @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;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Autowired
+ private Environment env;
+
+ public void createServiceInstance(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, 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);
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
if (null == customer) {
- String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
- + serviceInstance.getServiceInstanceId();
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
- ErrorCode.UnknownError.getValue(), errorMessage);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ String errorMessage =
+ "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ + serviceInstance.getServiceInstanceId();
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
+ ErrorCode.UnknownError.getValue(), errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
}
aaiSIResources.createServiceSubscription(customer);
} catch (BpmnError ex) {
throw ex;
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
- catch (Exception ex) {
+ }
+
+ public void createProject(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Project project = serviceInstance.getProject();
+ if (project != null) {
+ if (project.getProjectName() == null || "".equals(project.getProjectName())) {
+ logger.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);
+ 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.";
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), 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)";
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
+ "BPMN", ErrorCode.UnknownError.getValue(), msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ } else {
+ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
- public void createProject(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Project project = serviceInstance.getProject();
- if(project != null) {
- if (project.getProjectName() == null || "".equals(project.getProjectName())) {
- logger.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);
- 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.";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), 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)";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- execution.setVariable("callHoming", Boolean.TRUE.equals(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);
- Platform platform = vnf.getPlatform();
- if(platform != null) {
- if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) {
- logger.debug("PlatformName is null in input. Skipping create platform...");
- } else {
- List<String> platforms = splitCDL(platform.getPlatformName());
- platforms.stream().forEach(platformName -> aaiVnfResources.createPlatformandConnectVnf(new Platform(platformName),vnf));
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
- }
-
- public List<String> splitCDL(String str){
- return Stream.of(str.split(","))
- .map(String::trim)
- .map (elem -> new String(elem))
- .collect(Collectors.toList());
- }
-
- public void createLineOfBusiness(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
- if(lineOfBusiness != null) {
- if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) {
- logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness...");
- } else {
- List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName());
- lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources.createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName),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);
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, 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);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- int moduleIndex = 0;
- if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
- moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule);
- }
- vfModule.setModuleIndex(moduleIndex);
- 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);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- VolumeGroup volumeGroup = null;
- try{
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- } catch (BBObjectNotFoundException e){
- logger.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);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- 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);
- 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);
- 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);
- 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 connectVnfToCloudRegion(BuildingBlockExecution execution) {
- try {
- boolean cloudRegionsToSkip = false;
- String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
- if (cloudRegions != null){
- cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
- }
- if(!cloudRegionsToSkip) {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.connectVnfToCloudRegion(vnf, 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 connectVnfToTenant(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.connectVnfToTenant(vnf, 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);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- }
- }
-
- public void createConfiguration(BuildingBlockExecution execution){
- try{
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.createConfiguration(configuration);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void createInstanceGroupVnf(BuildingBlockExecution execution){
- try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void createNetworkPolicies(BuildingBlockExecution execution) {
- try{
- String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
- if (fqdns != null && !fqdns.isEmpty()) {
- String fqdnList[] = fqdns.split(",");
- int fqdnCount = fqdnList.length;
- if (fqdnCount > 0) {
- for (int i=0; i < fqdnCount; i++) {
- String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
- Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri);
- if(!oNetPolicy.isPresent()) {
- logger.debug("This network policy FQDN is not in AAI yet: {}", fqdn);
- String networkPolicyId = UUID.randomUUID().toString();
- logger.debug("Adding network-policy with network-policy-id {}", networkPolicyId);
- NetworkPolicy networkPolicy = new NetworkPolicy();
- networkPolicy.setNetworkPolicyId(networkPolicyId);
- networkPolicy.setNetworkPolicyFqdn(fqdn);
- networkPolicy.setHeatStackId(execution.getVariable(HEAT_STACK_ID));
-
- aaiNetworkResources.createNetworkPolicy(networkPolicy);
- }
- }
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
- *
- * if we have a module type A, and there are 3 instances of those,
- * and then module type B has 2 instances, if we are adding a new module type A,
- * the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
- *
- */
- protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
-
- String newVfModuleModelInvariantUUID = null;
- if (newVfModule.getModelInfoVfModule() != null) {
- newVfModuleModelInvariantUUID = newVfModule.getModelInfoVfModule().getModelInvariantUUID();
- }
-
-
- if (genericVnf != null && genericVnf.getVfModules() != null && !genericVnf.getVfModules().isEmpty()) {
- List<VfModule> modules = genericVnf.getVfModules().stream().filter(item -> !item.getVfModuleId().equals(newVfModule.getVfModuleId())).collect(Collectors.toList());
- TreeSet<Integer> moduleIndices = new TreeSet<>();
- int nullIndexFound = 0;
- for (VfModule vfModule : modules) {
- if (vfModule.getModelInfoVfModule() != null) {
- if (vfModule.getModelInfoVfModule().getModelInvariantUUID().equals(newVfModuleModelInvariantUUID)) {
- if (vfModule.getModuleIndex() != null) {
- moduleIndices.add(vfModule.getModuleIndex());
- } else {
- nullIndexFound++;
- logger.warn("Found null index for vf-module-id {} and model-invariant-uuid {}", vfModule.getVfModuleId(), vfModule.getModelInfoVfModule().getModelInvariantUUID());
- }
- }
- }
- }
-
- return calculateUnusedIndex(moduleIndices, nullIndexFound);
- } else {
- return 0;
- }
- }
-
- protected int calculateUnusedIndex(TreeSet<Integer> moduleIndices, int nullIndexFound) {
- //pad array with nulls
- Integer[] temp = new Integer[moduleIndices.size() + nullIndexFound];
- Integer[] array = moduleIndices.toArray(temp);
- int result = 0;
- //when a null is found skip that potential value
- //effectively creates something like, [0,1,3,null,null] -> [0,1,null(2),3,null(4)]
- for (int i=0; i < array.length; i++, result++) {
- if (Integer.valueOf(result) != array[i]) {
- if (nullIndexFound > 0) {
- nullIndexFound--;
- i--;
- } else {
- break;
- }
- }
- }
-
- return result;
- }
+ public void createVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ execution.setVariable("callHoming", Boolean.TRUE.equals(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);
+ Platform platform = vnf.getPlatform();
+ if (platform != null) {
+ if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) {
+ logger.debug("PlatformName is null in input. Skipping create platform...");
+ } else {
+ List<String> platforms = splitCDL(platform.getPlatformName());
+ platforms.stream().forEach(platformName -> aaiVnfResources
+ .createPlatformandConnectVnf(new Platform(platformName), vnf));
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public List<String> splitCDL(String str) {
+ return Stream.of(str.split(",")).map(String::trim).map(elem -> new String(elem)).collect(Collectors.toList());
+ }
+
+ public void createLineOfBusiness(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
+ if (lineOfBusiness != null) {
+ if (lineOfBusiness.getLineOfBusinessName() == null
+ || "".equals(lineOfBusiness.getLineOfBusinessName())) {
+ logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness...");
+ } else {
+ List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName());
+ lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources
+ .createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), 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);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, 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);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ int moduleIndex = 0;
+ if (vfModule.getModelInfoVfModule() != null
+ && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
+ moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule);
+ }
+ vfModule.setModuleIndex(moduleIndex);
+ 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);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ } catch (BBObjectNotFoundException e) {
+ logger.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);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ 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);
+ 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);
+ 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 connectVnfToCloudRegion(BuildingBlockExecution execution) {
+ try {
+ boolean cloudRegionsToSkip = false;
+ String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
+ if (cloudRegions != null) {
+ cloudRegionsToSkip = Arrays.stream(cloudRegions)
+ .anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
+ }
+ if (!cloudRegionsToSkip) {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.connectVnfToCloudRegion(vnf, 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 connectVnfToTenant(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.connectVnfToTenant(vnf, 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);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ }
+ }
+
+ public void createConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.createConfiguration(configuration);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createInstanceGroupVnf(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void createNetworkPolicies(BuildingBlockExecution execution) {
+ try {
+ String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ if (fqdns != null && !fqdns.isEmpty()) {
+ String fqdnList[] = fqdns.split(",");
+ int fqdnCount = fqdnList.length;
+ if (fqdnCount > 0) {
+ for (int i = 0; i < fqdnCount; i++) {
+ String fqdn = fqdnList[i];
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy =
+ aaiNetworkResources.getNetworkPolicy(uri);
+ if (!oNetPolicy.isPresent()) {
+ logger.debug("This network policy FQDN is not in AAI yet: {}", fqdn);
+ String networkPolicyId = UUID.randomUUID().toString();
+ logger.debug("Adding network-policy with network-policy-id {}", networkPolicyId);
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId(networkPolicyId);
+ networkPolicy.setNetworkPolicyFqdn(fqdn);
+ networkPolicy.setHeatStackId(execution.getVariable(HEAT_STACK_ID));
+
+ aaiNetworkResources.createNetworkPolicy(networkPolicy);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
+ *
+ * if we have a module type A, and there are 3 instances of those, and then module type B has 2 instances, if we are
+ * adding a new module type A, the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
+ *
+ */
+ protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
+
+ String newVfModuleModelInvariantUUID = null;
+ if (newVfModule.getModelInfoVfModule() != null) {
+ newVfModuleModelInvariantUUID = newVfModule.getModelInfoVfModule().getModelInvariantUUID();
+ }
+
+
+ if (genericVnf != null && genericVnf.getVfModules() != null && !genericVnf.getVfModules().isEmpty()) {
+ List<VfModule> modules = genericVnf.getVfModules().stream()
+ .filter(item -> !item.getVfModuleId().equals(newVfModule.getVfModuleId()))
+ .collect(Collectors.toList());
+ TreeSet<Integer> moduleIndices = new TreeSet<>();
+ int nullIndexFound = 0;
+ for (VfModule vfModule : modules) {
+ if (vfModule.getModelInfoVfModule() != null) {
+ if (vfModule.getModelInfoVfModule().getModelInvariantUUID().equals(newVfModuleModelInvariantUUID)) {
+ if (vfModule.getModuleIndex() != null) {
+ moduleIndices.add(vfModule.getModuleIndex());
+ } else {
+ nullIndexFound++;
+ logger.warn("Found null index for vf-module-id {} and model-invariant-uuid {}",
+ vfModule.getVfModuleId(), vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ }
+ }
+ }
+ }
+
+ return calculateUnusedIndex(moduleIndices, nullIndexFound);
+ } else {
+ return 0;
+ }
+ }
+
+ protected int calculateUnusedIndex(TreeSet<Integer> moduleIndices, int nullIndexFound) {
+ // pad array with nulls
+ Integer[] temp = new Integer[moduleIndices.size() + nullIndexFound];
+ Integer[] array = moduleIndices.toArray(temp);
+ int result = 0;
+ // when a null is found skip that potential value
+ // effectively creates something like, [0,1,3,null,null] -> [0,1,null(2),3,null(4)]
+ for (int i = 0; i < array.length; i++, result++) {
+ if (Integer.valueOf(result) != array[i]) {
+ if (nullIndexFound > 0) {
+ nullIndexFound--;
+ i--;
+ } else {
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
}
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
index 095fd7f86d..28186528e4 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import java.util.List;
import java.util.Optional;
-
import org.onap.aai.domain.yang.NetworkPolicies;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -57,151 +56,151 @@ import org.springframework.stereotype.Component;
@Component
public class AAIDeleteTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class);
-
- private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
- private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
-
- @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;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private AAIInstanceGroupResources aaiInstanceGroupResources;
-
- public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, 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.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);
- 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);
- 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);
- 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);
- 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);
- CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
- aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
- public void deleteConfiguration(BuildingBlockExecution execution) {
- try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.deleteConfiguration(configuration);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
- try {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void deleteNetworkPolicies(BuildingBlockExecution execution) {
- try{
- String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
- if (fqdns != null && !fqdns.isEmpty()) {
- String fqdnList[] = fqdns.split(",");
- int fqdnCount = fqdnList.length;
- if (fqdnCount > 0) {
- for (int i=0; i < fqdnCount; i++) {
- String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
- Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
- if(oNetPolicies.isPresent()) {
- NetworkPolicies networkPolicies = oNetPolicies.get();
- List<NetworkPolicy> networkPolicyList = networkPolicies.getNetworkPolicy();
- if (networkPolicyList != null && !networkPolicyList.isEmpty()) {
- NetworkPolicy networkPolicy = networkPolicyList.get(0);
- String networkPolicyId = networkPolicy.getNetworkPolicyId();
- logger.debug("Deleting network-policy with network-policy-id {}", networkPolicyId);
- aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
- }
- }
- }
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class);
+
+ private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+
+ @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;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+
+ public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, 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.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);
+ 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);
+ 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);
+ 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);
+ 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);
+ CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
+ aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.deleteConfiguration(configuration);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
+ try {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void deleteNetworkPolicies(BuildingBlockExecution execution) {
+ try {
+ String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ if (fqdns != null && !fqdns.isEmpty()) {
+ String fqdnList[] = fqdns.split(",");
+ int fqdnCount = fqdnList.length;
+ if (fqdnCount > 0) {
+ for (int i = 0; i < fqdnCount; i++) {
+ String fqdn = fqdnList[i];
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
+ if (oNetPolicies.isPresent()) {
+ NetworkPolicies networkPolicies = oNetPolicies.get();
+ List<NetworkPolicy> networkPolicyList = networkPolicies.getNetworkPolicy();
+ if (networkPolicyList != null && !networkPolicyList.isEmpty()) {
+ NetworkPolicy networkPolicy = networkPolicyList.get(0);
+ String networkPolicyId = networkPolicy.getNetworkPolicyId();
+ logger.debug("Deleting network-policy with network-policy-id {}", networkPolicyId);
+ aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
+ }
+ }
+ }
+ }
+ }
+ } 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
index 177e09d5a1..12aade71bc 100644
--- 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
@@ -35,83 +35,83 @@ import org.springframework.stereotype.Component;
@Component
public class AAIFlagTasks {
- private static final Logger logger = LoggerFactory.getLogger(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);
- 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);
+ private static final Logger logger = LoggerFactory.getLogger(AAIFlagTasks.class);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
- copiedGenericVnf.setInMaint(inMaint);
- genericVnf.setInMaint(inMaint);
+ public void checkVnfInMaintFlag(BuildingBlockExecution execution) {
+ boolean inMaint = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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");
+ }
+ }
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) {
- boolean isClosedLoopDisabled = false;
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- if (isClosedLoopDisabled) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF Close Loop Disabled in A&AI");
- }
- }
-
- public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) {
- try {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ public void modifyVnfInMaintFlag(BuildingBlockExecution execution, boolean inMaint) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
- copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled);
- genericVnf.setClosedLoopDisabled(closedLoopDisabled);
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) {
- boolean inPserversLocked = false;
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- if (inPserversLocked) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF PServers in Locked in A&AI");
- }
- }
+ copiedGenericVnf.setInMaint(inMaint);
+ genericVnf.setInMaint(inMaint);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) {
+ boolean isClosedLoopDisabled = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (isClosedLoopDisabled) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF Close Loop Disabled in A&AI");
+ }
+ }
+
+ public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+ copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled);
+ genericVnf.setClosedLoopDisabled(closedLoopDisabled);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) {
+ boolean inPserversLocked = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (inPserversLocked) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF PServers in Locked in A&AI");
+ }
+ }
}
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
index e0e139e290..7668c6b00f 100644
--- 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
@@ -25,7 +25,6 @@ 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;
@@ -52,197 +51,209 @@ import org.springframework.stereotype.Component;
@Component
public class AAIQueryTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIQueryTasks.class);
- 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 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 {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- 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 {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- 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) {
- logger.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);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- 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);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- 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;
- }
-
- public void querySubnet(BuildingBlockExecution execution) {
- try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
- if (!networkRelationships.isPresent()) {
- throw (new Exception(ERROR_MSG));
- }
- List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
-
- if(!subnetsUriList.isEmpty()) {
- for(AAIResourceUri subnetUri : subnetsUriList) {
- Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri);
- if(oSubnet.isPresent()) {
- l3network.getSubnets().add(modelMapper.map(oSubnet.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class));
- }
- }
- }
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIQueryTasks.class);
+ 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 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 {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ 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 {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ 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) {
+ logger.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);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ 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);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ 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;
+ }
+
+ public void querySubnet(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
+
+ if (!subnetsUriList.isEmpty()) {
+ for (AAIResourceUri subnetUri : subnetsUriList) {
+ Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri);
+ if (oSubnet.isPresent()) {
+ l3network.getSubnets().add(modelMapper.map(oSubnet.get(),
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class));
+ }
+ }
+ }
+ } 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/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 82b61c17b5..3304d1b113 100644
--- 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
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import java.util.List;
import java.util.Map;
-
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -57,507 +56,526 @@ import org.springframework.stereotype.Component;
@Component
public class AAIUpdateTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
- @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;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
-
- public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- String heatStackId = execution.getVariable("heatStackId");
- if (heatStackId == null) {
- heatStackId = "";
- }
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- volumeGroup.setHeatStackId(heatStackId);
-
- aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (vnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
- if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
- }
- else {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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) {
- updateNetwork(execution, OrchestrationStatus.ASSIGNED);
- }
-
- /**
- * BPMN access method to update status of L3Network to Active in AAI
- * @param execution
- * @throws BBObjectNotFoundException
- */
- public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
- updateNetwork(execution, OrchestrationStatus.ACTIVE);
- }
-
- /**
- * BPMN access method to update status of L3Network to Created in AAI
- * @param execution
- * @throws BBObjectNotFoundException
- */
- public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
- updateNetwork(execution, OrchestrationStatus.CREATED);
- }
-
- protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
- try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- updateNetworkAAI(l3Network, status);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- protected void updateNetworkAAI(L3Network l3Network, OrchestrationStatus status) {
- L3Network copiedl3Network = l3Network.shallowCopyId();
-
- copiedl3Network.setOrchestrationStatus(status);
- l3Network.setOrchestrationStatus(status);
- aaiNetworkResources.updateNetwork(copiedl3Network);
-
- List<Subnet> subnets = l3Network.getSubnets();
- if (subnets != null){
- for (Subnet subnet : subnets){
- Subnet copiedSubnet = subnet.shallowCopyId();
- copiedSubnet.setOrchestrationStatus(status);
- aaiNetworkResources.updateSubnet(copiedl3Network, copiedSubnet);
- }
- }
- }
-
- /**
- * 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);
- 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
- execution.setVariable("aaiActivateVfModuleRollback", true);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
- try {
- String heatStackId = execution.getVariable("heatStackId");
- if (heatStackId == null) {
- heatStackId = "";
- }
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- vfModule.setHeatStackId(heatStackId);
- aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update L3Network after it was created in cloud
- * @param execution
- * @throws Exception
- */
- public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
- execution.setVariable("aaiNetworkActivateRollback", false);
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
-
- Map<String, String> subnetMap = response.getSubnetMap();
- List<Subnet> subnets = l3network.getSubnets();
- if (subnets != null && subnetMap != null){
- for (Subnet subnet: subnets){
- Subnet copiedSubnet = subnet.shallowCopyId();
- copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
- copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
- aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
- }
- }
-
- execution.setVariable("aaiNetworkActivateRollback", true);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update L3Network after it was updated in cloud
- * @param execution
- * @throws Exception
- */
- public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- L3Network copiedl3network = l3network.shallowCopyId();
- UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse");
- try {
- copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
- aaiNetworkResources.updateNetwork(copiedl3network);
-
- Map<String, String> subnetMap = response.getSubnetMap();
- List<Subnet> subnets = l3network.getSubnets();
- if (subnets != null && subnetMap != null){
- for (Subnet subnet: subnets){
- Subnet copiedSubnet = subnet.shallowCopyId();
- copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
- copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
- aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateObjectNetwork(BuildingBlockExecution execution) {
- try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
- 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);
- 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);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
- public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
- try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
- try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
- try {
- String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
- if (ipv4OamAddress != null) {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
-
- genericVnf.setIpv4OamAddress(ipv4OamAddress);
- copiedGenericVnf.setIpv4OamAddress(ipv4OamAddress);
-
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- }
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
- try {
- String managementV6Address = execution.getVariable("oamManagementV6Address");
- if (managementV6Address != null) {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
-
- genericVnf.setManagementV6Address(managementV6Address);
- copiedGenericVnf.setManagementV6Address(managementV6Address);
-
- aaiVnfResources.updateObjectVnf(copiedGenericVnf);
- }
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
- try {
- String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
- if (contrailServiceInstanceFqdn != null) {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
- aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution){
- try{
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
-
- }catch(Exception ex){
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
- }
-
- public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution){
- try{
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
-
- }catch(Exception ex){
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
+ private static final String ALACARTE = "aLaCarte";
+ private static final String MULTI_STAGE_DESIGN_OFF = "false";
+ private static final String MULTI_STAGE_DESIGN_ON = "true";
+ @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;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+
+ public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
+ OrchestrationStatus.CREATED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ String heatStackId = execution.getVariable("heatStackId");
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ volumeGroup.setHeatStackId(heatStackId);
+
+ aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
+ OrchestrationStatus.PENDING_ACTIVATION);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
+ if (vnf.getModelInfoGenericVnf() != null) {
+ multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
+ }
+ boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
+ if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
+ OrchestrationStatus.PENDING_ACTIVATION);
+ } else {
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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) {
+ updateNetwork(execution, OrchestrationStatus.ASSIGNED);
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Active in AAI
+ *
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
+ updateNetwork(execution, OrchestrationStatus.ACTIVE);
+ }
+
+ /**
+ * BPMN access method to update status of L3Network to Created in AAI
+ *
+ * @param execution
+ * @throws BBObjectNotFoundException
+ */
+ public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
+ updateNetwork(execution, OrchestrationStatus.CREATED);
+ }
+
+ protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ updateNetworkAAI(l3Network, status);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ protected void updateNetworkAAI(L3Network l3Network, OrchestrationStatus status) {
+ L3Network copiedl3Network = l3Network.shallowCopyId();
+
+ copiedl3Network.setOrchestrationStatus(status);
+ l3Network.setOrchestrationStatus(status);
+ aaiNetworkResources.updateNetwork(copiedl3Network);
+
+ List<Subnet> subnets = l3Network.getSubnets();
+ if (subnets != null) {
+ for (Subnet subnet : subnets) {
+ Subnet copiedSubnet = subnet.shallowCopyId();
+ copiedSubnet.setOrchestrationStatus(status);
+ aaiNetworkResources.updateSubnet(copiedl3Network, copiedSubnet);
+ }
+ }
+ }
+
+ /**
+ * 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);
+ 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
+ execution.setVariable("aaiActivateVfModuleRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
+ try {
+ String heatStackId = execution.getVariable("heatStackId");
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule.setHeatStackId(heatStackId);
+ aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update L3Network after it was created in cloud
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("aaiNetworkActivateRollback", false);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+
+ Map<String, String> subnetMap = response.getSubnetMap();
+ List<Subnet> subnets = l3network.getSubnets();
+ if (subnets != null && subnetMap != null) {
+ for (Subnet subnet : subnets) {
+ Subnet copiedSubnet = subnet.shallowCopyId();
+ copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
+ copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
+ }
+ }
+
+ execution.setVariable("aaiNetworkActivateRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to update L3Network after it was updated in cloud
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ L3Network copiedl3network = l3network.shallowCopyId();
+ UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse");
+ try {
+ copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
+ aaiNetworkResources.updateNetwork(copiedl3network);
+
+ Map<String, String> subnetMap = response.getSubnetMap();
+ List<Subnet> subnets = l3network.getSubnets();
+ if (subnets != null && subnetMap != null) {
+ for (Subnet subnet : subnets) {
+ Subnet copiedSubnet = subnet.shallowCopyId();
+ copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
+ copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateObjectNetwork(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ 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);
+ vfModule.setHeatStackId("");
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
+ OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
+ try {
+ String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
+ if (ipv4OamAddress != null) {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ genericVnf.setIpv4OamAddress(ipv4OamAddress);
+ copiedGenericVnf.setIpv4OamAddress(ipv4OamAddress);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
+ try {
+ String managementV6Address = execution.getVariable("oamManagementV6Address");
+ if (managementV6Address != null) {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ genericVnf.setManagementV6Address(managementV6Address);
+ copiedGenericVnf.setManagementV6Address(managementV6Address);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
+ try {
+ String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
+ if (contrailServiceInstanceFqdn != null) {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
+ aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 821dfc18b0..05d4f56fdc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.activity;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -44,106 +43,107 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component("ExecuteActivity")
public class ExecuteActivity implements JavaDelegate {
- private static final Logger logger = LoggerFactory.getLogger(ExecuteActivity.class);
- private static final String G_BPMN_REQUEST = "bpmnRequest";
- private static final String VNF_TYPE = "vnfType";
- private static final String G_ACTION = "requestAction";
- private static final String G_REQUEST_ID = "mso-request-id";
- private static final String VNF_ID = "vnfId";
- private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
-
- private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
- private static final String ACTIVITY_PREFIX = "activity:";
-
- private ObjectMapper mapper = new ObjectMapper();
-
- @Autowired
- private RuntimeService runtimeService;
- @Autowired
- private ExceptionBuilder exceptionBuilder;
-
- @Override
- public void execute(DelegateExecution execution) throws Exception {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
-
- try {
- final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE);
- logger.debug("activity implementation String: {}", implementationString);
- if (!implementationString.startsWith(ACTIVITY_PREFIX)) {
- buildAndThrowException(execution, "Implementation attribute has a wrong format");
- }
- String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, "");
- logger.info("activityName is: {}", activityName);
-
- BuildingBlock buildingBlock = buildBuildingBlock(activityName);
- ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("buildingBlock", executeBuildingBlock);
- variables.put("mso-request-id", requestId);
- variables.put("retryCount", 1);
- variables.put("aLaCarte", true);
-
- ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables).executeWithVariablesInReturn();
- VariableMap variableMap = buildingBlockResult.getVariables();
-
- WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
- if (workflowException != null) {
- logger.error("Workflow exception is: {}", workflowException.getErrorMessage());
- }
- execution.setVariable("WorkflowException", workflowException);
- }
- catch (Exception e) {
- buildAndThrowException(execution, e.getMessage());
- }
- }
-
- protected BuildingBlock buildBuildingBlock(String activityName) {
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName(activityName);
- buildingBlock.setMsoId(UUID.randomUUID().toString());
- buildingBlock.setKey("");
- buildingBlock.setIsVirtualLink(false);
- buildingBlock.setVirtualLinkKey("");
- return buildingBlock;
- }
-
- protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
- BuildingBlock buildingBlock) throws Exception {
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
- executeBuildingBlock.setaLaCarte(true);
- executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
- executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
- executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
- workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
- executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
- executeBuildingBlock.setRequestId(requestId);
- executeBuildingBlock.setBuildingBlock(buildingBlock);
- executeBuildingBlock.setRequestDetails(requestDetails);
- return executeBuildingBlock;
- }
-
- protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), msg, ex);
- execution.setVariable("ExecuteActivityErrorMessage", msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- protected void buildAndThrowException(DelegateExecution execution, String msg) {
- logger.error(msg);
- execution.setVariable("ExecuteActuvityErrorMessage", msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
+ private static final Logger logger = LoggerFactory.getLogger(ExecuteActivity.class);
+ private static final String G_BPMN_REQUEST = "bpmnRequest";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String G_ACTION = "requestAction";
+ private static final String G_REQUEST_ID = "mso-request-id";
+ private static final String VNF_ID = "vnfId";
+ private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+
+ private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
+ private static final String ACTIVITY_PREFIX = "activity:";
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private RuntimeService runtimeService;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+
+ try {
+ final String implementationString =
+ execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE);
+ logger.debug("activity implementation String: {}", implementationString);
+ if (!implementationString.startsWith(ACTIVITY_PREFIX)) {
+ buildAndThrowException(execution, "Implementation attribute has a wrong format");
+ }
+ String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, "");
+ logger.info("activityName is: {}", activityName);
+
+ BuildingBlock buildingBlock = buildBuildingBlock(activityName);
+ ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("buildingBlock", executeBuildingBlock);
+ variables.put("mso-request-id", requestId);
+ variables.put("retryCount", 1);
+ variables.put("aLaCarte", true);
+
+ ProcessInstanceWithVariables buildingBlockResult =
+ runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables)
+ .executeWithVariablesInReturn();
+ VariableMap variableMap = buildingBlockResult.getVariables();
+
+ WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
+ if (workflowException != null) {
+ logger.error("Workflow exception is: {}", workflowException.getErrorMessage());
+ }
+ execution.setVariable("WorkflowException", workflowException);
+ } catch (Exception e) {
+ buildAndThrowException(execution, e.getMessage());
+ }
+ }
+
+ protected BuildingBlock buildBuildingBlock(String activityName) {
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(activityName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ buildingBlock.setKey("");
+ buildingBlock.setIsVirtualLink(false);
+ buildingBlock.setVirtualLinkKey("");
+ return buildingBlock;
+ }
+
+ protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
+ BuildingBlock buildingBlock) throws Exception {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ executeBuildingBlock.setaLaCarte(true);
+ executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
+ executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
+ executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
+ workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
+ executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
+ executeBuildingBlock.setRequestId(requestId);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ executeBuildingBlock.setRequestDetails(requestDetails);
+ return executeBuildingBlock;
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg, ex);
+ execution.setVariable("ExecuteActivityErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ logger.error(msg);
+ execution.setVariable("ExecuteActuvityErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
}
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
index 67d2864204..0ec28d901c 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.util.Map;
-
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -38,68 +37,74 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterCreateTasks {
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Autowired
- private NetworkAdapterResources networkAdapterResources;
-
- public void createNetwork(BuildingBlockExecution execution) {
- execution.setVariable("networkAdapterCreateRollback", false);
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, 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());
-
- execution.setVariable("networkAdapterRequest", createNetworkRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void processResponseFromOpenstack(BuildingBlockExecution execution) {
- try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
-
- CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
- if(createNetworkResponse != null) {
- l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId());
- if (createNetworkResponse.getNetworkCreated()){
- //setting rollback TRUE only if network was actually created (not a silent success OP)
- execution.setVariable("networkAdapterCreateRollback", true);
- }
- } else {
- throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
- }
- } 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);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, 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);
- }
- }
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+
+ public void createNetwork(BuildingBlockExecution execution) {
+ execution.setVariable("networkAdapterCreateRollback", false);
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, 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());
+
+ execution.setVariable("networkAdapterRequest", createNetworkRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processResponseFromOpenstack(BuildingBlockExecution execution) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+
+ CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
+ if (createNetworkResponse != null) {
+ l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId());
+ if (createNetworkResponse.getNetworkCreated()) {
+ // setting rollback TRUE only if network was actually created (not a silent success OP)
+ execution.setVariable("networkAdapterCreateRollback", true);
+ }
+ } else {
+ throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
+ }
+ } 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);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, 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
index 7e0c5f6da4..7a7d681762 100644
--- 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
@@ -34,26 +34,28 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterDeleteTasks {
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- public void deleteNetwork(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
-
- execution.setVariable("networkAdapterRequest", deleteNetworkRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void deleteNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
+
+ execution.setVariable("networkAdapterRequest", deleteNetworkRequest);
+ } 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/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index 4861257833..859db11037 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -22,12 +22,10 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.io.StringReader;
import java.util.Optional;
-
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.adapters.nwrest.CreateNetworkError;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
@@ -48,111 +46,119 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterRestV1 {
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRestV1.class);
-
- private static final String NETWORK_REQUEST = "networkAdapterRequest";
- private static final String NETWORK_MESSAGE = "NetworkAResponse_MESSAGE";
- private static final String NETWORK_SYNC_CODE = "NETWORKREST_networkAdapterStatusCode";
- private static final String NETWORK_SYNC_RESPONSE = "NETWORKREST_networkAdapterResponse";
- private static final String NETWORK_CORRELATOR = "NetworkAResponse_CORRELATOR";
-
- @Autowired
- private ExceptionBuilder exceptionBuilder;
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRestV1.class);
+
+ private static final String NETWORK_REQUEST = "networkAdapterRequest";
+ private static final String NETWORK_MESSAGE = "NetworkAResponse_MESSAGE";
+ private static final String NETWORK_SYNC_CODE = "NETWORKREST_networkAdapterStatusCode";
+ private static final String NETWORK_SYNC_RESPONSE = "NETWORKREST_networkAdapterResponse";
+ private static final String NETWORK_CORRELATOR = "NetworkAResponse_CORRELATOR";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+
+ public void callNetworkAdapter(DelegateExecution execution) {
+ try {
+ Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
+ if (networkAdapterRequest != null) {
+ Optional<Response> response = Optional.empty();
+ if (networkAdapterRequest instanceof CreateNetworkRequest) {
+ CreateNetworkRequest createNetworkRequest = (CreateNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, createNetworkRequest.getMessageId());
+ response = networkAdapterResources.createNetworkAsync(createNetworkRequest);
+ } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
+ DeleteNetworkRequest deleteNetworkRequest = (DeleteNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, deleteNetworkRequest.getMessageId());
+ response = networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest);
+ } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
+ UpdateNetworkRequest updateNetworkRequest = (UpdateNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, updateNetworkRequest.getMessageId());
+ response = networkAdapterResources.updateNetworkAsync(updateNetworkRequest);
+ }
+ if (response.isPresent()) {
+ String statusCode = Integer.toString(response.get().getStatus());
+ String responseString = "";
+ if (response.get().getEntity() != null) {
+ responseString = (String) response.get().getEntity();
+ }
+ execution.setVariable(NETWORK_SYNC_CODE, statusCode);
+ execution.setVariable(NETWORK_SYNC_RESPONSE, responseString);
+ } else {
+ throw new Exception("No Ack response from Openstack Adapter");
+ }
+ } else {
+ throw new Exception("No Network Request was created. networkAdapterRequest was null.");
+ }
+ } catch (Exception ex) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processCallback(DelegateExecution execution) {
+ try {
+ Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
+ String callback = (String) execution.getVariable(NETWORK_MESSAGE);
+ String logCallbackMessage = "Callback from OpenstackAdapter: " + callback;
+ logger.debug(logCallbackMessage);
+ if (networkAdapterRequest != null) {
+ if (networkAdapterRequest instanceof CreateNetworkRequest) {
+ if (callback.contains("createNetworkError")) {
+ CreateNetworkError createNetworkError =
+ (CreateNetworkError) unmarshalXml(callback, CreateNetworkError.class);
+ throw new Exception(createNetworkError.getMessage());
+ } else {
+ CreateNetworkResponse createNetworkResponse =
+ (CreateNetworkResponse) unmarshalXml(callback, CreateNetworkResponse.class);
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+ }
+ } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
+ if (callback.contains("deleteNetworkError")) {
+ DeleteNetworkError deleteNetworkError =
+ (DeleteNetworkError) unmarshalXml(callback, DeleteNetworkError.class);
+ throw new Exception(deleteNetworkError.getMessage());
+ } else {
+ DeleteNetworkResponse deleteNetworkResponse =
+ (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
+ execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
+ }
+ } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
+ if (callback.contains("updateNetworkError")) {
+ UpdateNetworkError updateNetworkError =
+ (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class);
+ throw new Exception(updateNetworkError.getMessage());
+ } else {
+ UpdateNetworkResponse updateNetworkResponse =
+ (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class);
+ execution.setVariable("updateNetworkResponse", updateNetworkResponse);
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error in Openstack Adapter callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ }
+ }
+
+ protected <T> Object unmarshalXml(String xmlString, Class<T> resultClass) throws JAXBException {
+ StringReader reader = new StringReader(xmlString);
+ JAXBContext context = JAXBContext.newInstance(resultClass);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ return unmarshaller.unmarshal(reader);
+ }
+
+ public void handleTimeOutException(DelegateExecution execution) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Error timed out waiting on Openstack Async-Response");
+ }
- @Autowired
- private NetworkAdapterResources networkAdapterResources;
-
- public void callNetworkAdapter (DelegateExecution execution) {
- try {
- Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
- if (networkAdapterRequest != null) {
- Optional<Response> response = Optional.empty();
- if (networkAdapterRequest instanceof CreateNetworkRequest) {
- CreateNetworkRequest createNetworkRequest = (CreateNetworkRequest) networkAdapterRequest;
- execution.setVariable(NETWORK_CORRELATOR, createNetworkRequest.getMessageId());
- response = networkAdapterResources.createNetworkAsync(createNetworkRequest);
- } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
- DeleteNetworkRequest deleteNetworkRequest = (DeleteNetworkRequest) networkAdapterRequest;
- execution.setVariable(NETWORK_CORRELATOR, deleteNetworkRequest.getMessageId());
- response = networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest);
- } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
- UpdateNetworkRequest updateNetworkRequest = (UpdateNetworkRequest) networkAdapterRequest;
- execution.setVariable(NETWORK_CORRELATOR, updateNetworkRequest.getMessageId());
- response = networkAdapterResources.updateNetworkAsync(updateNetworkRequest);
- }
- if(response.isPresent()) {
- String statusCode = Integer.toString(response.get().getStatus());
- String responseString = "";
- if(response.get().getEntity() != null) {
- responseString = (String) response.get().getEntity();
- }
- execution.setVariable(NETWORK_SYNC_CODE, statusCode);
- execution.setVariable(NETWORK_SYNC_RESPONSE, responseString);
- } else {
- throw new Exception("No Ack response from Openstack Adapter");
- }
- } else {
- throw new Exception("No Network Request was created. networkAdapterRequest was null.");
- }
- } catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void processCallback (DelegateExecution execution) {
- try {
- Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
- String callback = (String) execution.getVariable(NETWORK_MESSAGE);
- String logCallbackMessage = "Callback from OpenstackAdapter: " + callback;
- logger.debug(logCallbackMessage);
- if (networkAdapterRequest != null) {
- if (networkAdapterRequest instanceof CreateNetworkRequest) {
- if(callback.contains("createNetworkError")) {
- CreateNetworkError createNetworkError = (CreateNetworkError) unmarshalXml(callback, CreateNetworkError.class);
- throw new Exception(createNetworkError.getMessage());
- } else {
- CreateNetworkResponse createNetworkResponse = (CreateNetworkResponse) unmarshalXml(callback, CreateNetworkResponse.class);
- execution.setVariable("createNetworkResponse", createNetworkResponse);
- }
- } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
- if(callback.contains("deleteNetworkError")) {
- DeleteNetworkError deleteNetworkError = (DeleteNetworkError) unmarshalXml(callback, DeleteNetworkError.class);
- throw new Exception(deleteNetworkError.getMessage());
- } else {
- DeleteNetworkResponse deleteNetworkResponse = (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
- execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
- }
- } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
- if (callback.contains("updateNetworkError")) {
- UpdateNetworkError updateNetworkError = (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class);
- throw new Exception(updateNetworkError.getMessage());
- } else {
- UpdateNetworkResponse updateNetworkResponse = (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class);
- execution.setVariable("updateNetworkResponse", updateNetworkResponse);
- }
- }
- }
- } catch (Exception e) {
- logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
- }
- }
-
- protected <T> Object unmarshalXml(String xmlString, Class<T> resultClass) throws JAXBException {
- StringReader reader = new StringReader(xmlString);
- JAXBContext context = JAXBContext.newInstance(resultClass);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- return unmarshaller.unmarshal(reader);
- }
-
- public void handleTimeOutException (DelegateExecution execution) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on Openstack Async-Response");
- }
-
- public void handleSyncError (DelegateExecution execution) {
- String statusCode = (String) execution.getVariable(NETWORK_SYNC_CODE);
- String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
- String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = " + responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
- }
+ public void handleSyncError(DelegateExecution execution) {
+ String statusCode = (String) execution.getVariable(NETWORK_SYNC_CODE);
+ String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
+ String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ + responseString;
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ }
}
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
index 9eeba0445b..77898dd5cc 100644
--- 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
@@ -40,37 +40,40 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterUpdateTasks {
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class);
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private NetworkAdapterObjectMapper networkAdapterObjectMapper;
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- public void updateNetwork(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
-
- UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer());
- execution.setVariable("networkAdapterRequest", updateNetworkRequest);
-
- } catch(Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void processResponseFromOpenstack(BuildingBlockExecution execution) {
- try {
- UpdateNetworkResponse updateNetworkResponse = execution.getVariable("updateNetworkResponse");
- if(updateNetworkResponse == null) {
- throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class);
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ public void updateNetwork(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+
+ UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance,
+ l3Network, gBBInput.getUserInput(), gBBInput.getCustomer());
+ execution.setVariable("networkAdapterRequest", updateNetworkRequest);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processResponseFromOpenstack(BuildingBlockExecution execution) {
+ try {
+ UpdateNetworkResponse updateNetworkResponse = execution.getVariable("updateNetworkResponse");
+ if (updateNetworkResponse == null) {
+ throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
+ }
+ } 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
index ae9e6e7488..849465e787 100644
--- 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
@@ -47,72 +47,79 @@ import static org.apache.commons.lang3.StringUtils.*;
@Component
public class VnfAdapterCreateTasks {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
- private static final String VNFREST_REQUEST = "VNFREST_Request";
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
+ private static final String VNFREST_REQUEST = "VNFREST_Request";
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources;
- @Autowired
- private VnfAdapterVfModuleResources vnfAdapterVfModuleResources;
+ @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();
+ public void createVolumeGroupRequest(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ ServiceInstance serviceInstance =
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
- ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ VfModule vfModule;
+ String sdncVfModuleQueryResponse = null;
+ try {
+ vfModule = extractPojosForBB.extractByKey(execution, 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
+ }
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- VfModule vfModule;
- String sdncVfModuleQueryResponse = null;
- try {
- vfModule = extractPojosForBB.extractByKey(execution, 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);
+ }
+ }
- 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();
- 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);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ } catch (BBObjectNotFoundException bbException) {
+ }
+ 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());
- ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VolumeGroup volumeGroup = null;
- try {
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- } catch(BBObjectNotFoundException bbException) {
- }
- 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,
+ volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+ execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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
index a96e2702cd..116dc30d63 100644
--- 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
@@ -42,46 +42,50 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterDeleteTasks {
- private static final Logger logger = LoggerFactory.getLogger(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);
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
-
- DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
- execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
- execution.setVariable("deleteVolumeGroupRequest", "true");
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class);
+ private static final String VNFREST_REQUEST = "VNFREST_Request";
- public void deleteVfModule(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, 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);
- }
- }
+ @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);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(
+ gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
+ execution.setVariable("deleteVolumeGroupRequest", "true");
+ } 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);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, 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
index e854efd414..bfa76c5053 100644
--- 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
@@ -45,7 +45,6 @@ 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;
@@ -59,96 +58,100 @@ import java.util.Map;
@Component
public class VnfAdapterImpl {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterImpl.class);
- private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn";
- private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
- private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
- private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterImpl.class);
+ private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn";
+ private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
+ private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
+ private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+
+ @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.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
+ execution.setVariable("heatStackId", null);
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
+ execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, null);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- public void preProcessVnfAdapter(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
- execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
- execution.setVariable("heatStackId", null);
- execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
- execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
- execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
- execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, null);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void postProcessVnfAdapter(BuildingBlockExecution execution) {
- try {
- String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
- if (!StringUtils.isEmpty( vnfAdapterResponse)) {
+ public void postProcessVnfAdapter(BuildingBlockExecution execution) {
+ try {
+ String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ if (!StringUtils.isEmpty(vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
- if(vnfRestResponse instanceof CreateVfModuleResponse) {
+ if (vnfRestResponse instanceof CreateVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
- if(!StringUtils.isEmpty(heatStackId)) {
- vfModule.setHeatStackId(heatStackId);
+ if (!StringUtils.isEmpty(heatStackId)) {
+ vfModule.setHeatStackId(heatStackId);
execution.setVariable("heatStackId", heatStackId);
}
- Map<String,String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
+ Map<String, String> vfModuleOutputs =
+ ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
if (vfModuleOutputs != null) {
- processVfModuleOutputs(execution, vfModuleOutputs);
+ processVfModuleOutputs(execution, vfModuleOutputs);
}
- } else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
+ } else if (vnfRestResponse instanceof DeleteVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
- if(null!= vfModuleDelete && vfModuleDelete) {
+ if (null != vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
execution.setVariable("heatStackId", null);
- Map<String,String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
+ Map<String, String> vfModuleOutputs =
+ ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
if (vfModuleOutputs != null) {
- processVfModuleOutputs(execution, vfModuleOutputs);
- if (execution.getVariable(OAM_MANAGEMENT_V4_ADDRESS) != null) {
- genericVnf.setIpv4OamAddress("");
- execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, "");
- }
- if (execution.getVariable(OAM_MANAGEMENT_V6_ADDRESS) != null) {
- genericVnf.setManagementV6Address("");
- execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, "");
- }
- if (execution.getVariable(CONTRAIL_SERVICE_INSTANCE_FQDN) != null) {
- vfModule.setContrailServiceInstanceFqdn("");
- execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, "");
- }
+ processVfModuleOutputs(execution, vfModuleOutputs);
+ if (execution.getVariable(OAM_MANAGEMENT_V4_ADDRESS) != null) {
+ genericVnf.setIpv4OamAddress("");
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, "");
+ }
+ if (execution.getVariable(OAM_MANAGEMENT_V6_ADDRESS) != null) {
+ genericVnf.setManagementV6Address("");
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, "");
+ }
+ if (execution.getVariable(CONTRAIL_SERVICE_INSTANCE_FQDN) != null) {
+ vfModule.setContrailServiceInstanceFqdn("");
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, "");
+ }
}
}
- } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
+ } else if (vnfRestResponse instanceof CreateVolumeGroupResponse) {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
- if(!StringUtils.isEmpty(heatStackId)) {
+ if (!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
execution.setVariable("heatStackId", heatStackId);
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
- }
- } else if(vnfRestResponse instanceof DeleteVolumeGroupResponse) {
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
- if(null!= volumeGroupDelete && volumeGroupDelete) {
- volumeGroup.setHeatStackId(null);
- execution.setVariable("heatStackId", null);
- }
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
+ }
+ } else if (vnfRestResponse instanceof DeleteVolumeGroupResponse) {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
+ if (null != volumeGroupDelete && volumeGroupDelete) {
+ volumeGroup.setHeatStackId(null);
+ execution.setVariable("heatStackId", null);
+ }
}
}
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
private Object unMarshal(String input) throws MarshallerException {
try {
@@ -160,61 +163,60 @@ public class VnfAdapterImpl {
XMLReader xmlReader = spf.newSAXParser().getXMLReader();
JAXBContext jaxbContext = JAXBContext.newInstance(CreateVfModuleResponse.class,
- CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class,DeleteVolumeGroupResponse.class);
+ CreateVolumeGroupResponse.class, DeleteVfModuleResponse.class, DeleteVolumeGroupResponse.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) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
- throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), ErrorCode.SchemaError.getValue(), e);
+ logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
+ e.getMessage(), e);
+ throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(),
+ ErrorCode.SchemaError.getValue(), e);
}
}
-
- private void processVfModuleOutputs(BuildingBlockExecution execution, Map<String,String> vfModuleOutputs) {
- if (vfModuleOutputs == null) {
- return;
- }
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
- Iterator<String> keys = vfModuleOutputs.keySet().iterator();
- while (keys.hasNext()) {
- String key = keys.next();
- if (key.equals("contrail-service-instance-fqdn")) {
- String contrailServiceInstanceFqdn = vfModuleOutputs.get(key);
- logger.debug("Obtained contrailServiceInstanceFqdn: {}", contrailServiceInstanceFqdn);
- vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
- execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn);
- }
- else if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key);
- logger.debug("Obtained contrailNetworkPolicyFqdn: {}", contrailNetworkPolicyFqdn);
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn);
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = vfModuleOutputs.get(key);
- logger.debug("Obtained oamManagementV4Address: {}", oamManagementV4Address);
- genericVnf.setIpv4OamAddress(oamManagementV4Address);
- execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address);
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = vfModuleOutputs.get(key);
- logger.debug("Obtained oamManagementV6Address: {}", oamManagementV6Address);
- genericVnf.setManagementV6Address(oamManagementV6Address);
- execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address);
- }
-
- if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, String.join(",", contrailNetworkPolicyFqdnList));
- }
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
-
+
+ private void processVfModuleOutputs(BuildingBlockExecution execution, Map<String, String> vfModuleOutputs) {
+ if (vfModuleOutputs == null) {
+ return;
+ }
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
+ Iterator<String> keys = vfModuleOutputs.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ if (key.equals("contrail-service-instance-fqdn")) {
+ String contrailServiceInstanceFqdn = vfModuleOutputs.get(key);
+ logger.debug("Obtained contrailServiceInstanceFqdn: {}", contrailServiceInstanceFqdn);
+ vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn);
+ } else if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key);
+ logger.debug("Obtained contrailNetworkPolicyFqdn: {}", contrailNetworkPolicyFqdn);
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn);
+ } else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = vfModuleOutputs.get(key);
+ logger.debug("Obtained oamManagementV4Address: {}", oamManagementV4Address);
+ genericVnf.setIpv4OamAddress(oamManagementV4Address);
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address);
+ } else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = vfModuleOutputs.get(key);
+ logger.debug("Obtained oamManagementV6Address: {}", oamManagementV6Address);
+ genericVnf.setManagementV6Address(oamManagementV6Address);
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address);
+ }
+
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST,
+ String.join(",", contrailNetworkPolicyFqdnList));
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
index 976b1bc8df..01519fab6e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -30,34 +30,34 @@ import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
*/
public class Constants {
- public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
- public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
- public static final String INPUT_PARAMETER = "inputParameter";
- public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse";
- public static final String DELETE_VNF_NODE_STATUS = "deleteVnfNodeStatus";
- public static final String CREATE_VNF_NODE_STATUS = "createVnfNodeStatus";
- public static final String VNF_ASSIGNED = "Assigned";
- public static final String VNF_CREATED = "Created";
+ public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
+ public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
+ public static final String INPUT_PARAMETER = "inputParameter";
+ public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse";
+ public static final String DELETE_VNF_NODE_STATUS = "deleteVnfNodeStatus";
+ public static final String CREATE_VNF_NODE_STATUS = "createVnfNodeStatus";
+ public static final String VNF_ASSIGNED = "Assigned";
+ public static final String VNF_CREATED = "Created";
- public static final String DOT = ".";
- public static final String UNDERSCORE = "_";
- public static final String SPACE = "\\s+";
+ public static final String DOT = ".";
+ public static final String UNDERSCORE = "_";
+ public static final String SPACE = "\\s+";
- public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
- public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
+ public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
+ public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
- public static final String FORWARD_SLASH = "/";
- public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
+ public static final String FORWARD_SLASH = "/";
+ public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
- public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
- newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
+ public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
+ newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
- public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
- OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+ public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
+ OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
- public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
+ public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
- private Constants() {}
+ private Constants() {}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java
index 857c5cb6fe..f29f842709 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java
@@ -39,46 +39,46 @@ import com.google.common.base.Optional;
@Component
public class EtsiVnfDeleteTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(EtsiVnfDeleteTask.class);
- private final ExtractPojosForBB extractPojosForBB;
- private final ExceptionBuilder exceptionUtil;
- private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+ private static final Logger LOGGER = LoggerFactory.getLogger(EtsiVnfDeleteTask.class);
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionUtil;
+ private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
- @Autowired
- public EtsiVnfDeleteTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
- final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) {
- this.exceptionUtil = exceptionUtil;
- this.extractPojosForBB = extractPojosForBB;
- this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
- }
+ @Autowired
+ public EtsiVnfDeleteTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
+ final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) {
+ this.exceptionUtil = exceptionUtil;
+ this.extractPojosForBB = extractPojosForBB;
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ }
- /**
- * Invoke VNFM adapter to delete the VNF
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void invokeVnfmAdapter(final BuildingBlockExecution execution) {
- try {
- LOGGER.debug("Executing invokeVnfmAdapter ...");
- final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ /**
+ * Invoke VNFM adapter to delete the VNF
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void invokeVnfmAdapter(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing invokeVnfmAdapter ...");
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
- final Optional<DeleteVnfResponse> response = vnfmAdapterServiceProvider.invokeDeleteRequest(vnf.getVnfId());
+ final Optional<DeleteVnfResponse> response = vnfmAdapterServiceProvider.invokeDeleteRequest(vnf.getVnfId());
- if (!response.isPresent()) {
- final String errorMessage = "Unexpected error while processing delete request";
- LOGGER.error(errorMessage);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1211, errorMessage);
- }
+ if (!response.isPresent()) {
+ final String errorMessage = "Unexpected error while processing delete request";
+ LOGGER.error(errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1211, errorMessage);
+ }
- final DeleteVnfResponse vnfResponse = response.get();
+ final DeleteVnfResponse vnfResponse = response.get();
- LOGGER.debug("Vnf delete response: {}", vnfResponse);
- execution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
+ LOGGER.debug("Vnf delete response: {}", vnfResponse);
+ execution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
- LOGGER.debug("Finished executing invokeVnfmAdapter ...");
- } catch (final Exception exception) {
- LOGGER.error("Unable to invoke delete request", exception);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1212, exception);
+ LOGGER.debug("Finished executing invokeVnfmAdapter ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke delete request", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1212, exception);
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
index ebb9d521c3..661fdb258b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
@@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index 9e0c26ba20..4645680fc2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -39,64 +39,65 @@ import com.google.common.base.Optional;
*
*/
@Component
-public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask{
+public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
- @Autowired
- public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
- final ExceptionBuilder exceptionUtil) {
- super(vnfmAdapterServiceProvider, exceptionUtil);
- }
-
- /**
- * Get the current operation status of instantiation job
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing getCurrentOperationStatus ...");
- final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
- LOGGER.debug("Finished executing getCurrentOperationStatus ...");
- }
+ @Autowired
+ public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ super(vnfmAdapterServiceProvider, exceptionUtil);
+ }
- /**
- * Log and throw exception on timeout for job status
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void timeOutLogFailue(final BuildingBlockExecution execution) {
- final String message = "Instantiation operation time out";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1205, message);
- }
+ /**
+ * Get the current operation status of instantiation job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME,
+ getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
- /**
- * Check the final status of instantiation throw exception if not completed successfully
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- if (operationStatusOption == null || !operationStatusOption.isPresent()) {
- final String message = "Unable to instantiate jobId: "
- + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
- + "Unable to retrieve OperationStatus";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1206, message);
- } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
- final OperationStateEnum operationStatus = operationStatusOption.get();
- if (operationStatus != OperationStateEnum.COMPLETED) {
- final String message = "Unable to instantiate jobId: "
- + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null") + " OperationStatus: "
- + operationStatus;
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Instantiation operation time out";
LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1207, message);
- }
- LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1205, message);
+ }
+
+ /**
+ * Check the final status of instantiation throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message = "Unable to instantiate jobId: "
+ + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
+ + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1206, message);
+ } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message = "Unable to instantiate jobId: "
+ + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
+ + " OperationStatus: " + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1207, message);
+ }
+ LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
index e13d1e4dda..e91f362d53 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -42,61 +42,62 @@ import com.google.common.base.Optional;
@Component
public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmDeleteJobTask.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmDeleteJobTask.class);
- @Autowired
- public MonitorVnfmDeleteJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
- final ExceptionBuilder exceptionUtil) {
- super(vnfmAdapterServiceProvider, exceptionUtil);
- }
-
- /**
- * Get the current operation status of Delete job
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing getCurrentOperationStatus ...");
- final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
- LOGGER.debug("Finished executing getCurrentOperationStatus ...");
- }
+ @Autowired
+ public MonitorVnfmDeleteJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ super(vnfmAdapterServiceProvider, exceptionUtil);
+ }
- /**
- * Log and throw exception on timeout for job status
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void timeOutLogFailue(final BuildingBlockExecution execution) {
- final String message = "Delete operation time out";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1213, message);
- }
+ /**
+ * Get the current operation status of Delete job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
- /**
- * Check the final status of delete throw exception if not completed successfully
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
- if (operationStatusOption == null || !operationStatusOption.isPresent()) {
- final String message = "Unable to delete jobId: "
- + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + "Unable to retrieve OperationStatus";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
- } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
- final OperationStateEnum operationStatus = operationStatusOption.get();
- if (operationStatus != OperationStateEnum.COMPLETED) {
- final String message =
- "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
- + " OperationStatus: " + operationStatus;
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Delete operation time out";
LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
- }
- LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1213, message);
+ }
+
+ /**
+ * Check the final status of delete throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message =
+ "Unable to delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
+ + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
+ } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message =
+ "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
+ + " OperationStatus: " + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
+ }
+ LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
index e3992428cb..395018fb38 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
@@ -41,64 +41,65 @@ import com.google.common.base.Optional;
@Component
public class MonitorVnfmJobTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmJobTask.class);
- protected final ExceptionBuilder exceptionUtil;
- protected final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmJobTask.class);
+ protected final ExceptionBuilder exceptionUtil;
+ protected final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
- @Autowired
- public MonitorVnfmJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
- final ExceptionBuilder exceptionUtil) {
- this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
- this.exceptionUtil = exceptionUtil;
- }
+ @Autowired
+ public MonitorVnfmJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ this.exceptionUtil = exceptionUtil;
+ }
- /**
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- * @return boolean to indicate whether job has competed or not
- */
- public boolean hasOperationFinished(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing hasOperationFinished ...");
+ /**
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @return boolean to indicate whether job has competed or not
+ */
+ public boolean hasOperationFinished(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing hasOperationFinished ...");
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- if (operationStatusOption != null && operationStatusOption.isPresent()) {
- return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ }
+ LOGGER.debug("OperationStatus is not present yet... ");
+ LOGGER.debug("Finished executing hasOperationFinished ...");
+ return false;
}
- LOGGER.debug("OperationStatus is not present yet... ");
- LOGGER.debug("Finished executing hasOperationFinished ...");
- return false;
- }
- /**
- * This method calls the Vnfm adapter and gets the Operation status of the job
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- * @param jobId unique job id
- * @return Operation State
- */
- protected Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
- final String jobId) {
+ /**
+ * This method calls the Vnfm adapter and gets the Operation status of the job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @param jobId unique job id
+ * @return Operation State
+ */
+ protected Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
+ final String jobId) {
- final Optional<QueryJobResponse> instantiateOperationJobStatus =
- vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(jobId);
+ final Optional<QueryJobResponse> instantiateOperationJobStatus =
+ vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(jobId);
- if (instantiateOperationJobStatus.isPresent()) {
- final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
+ if (instantiateOperationJobStatus.isPresent()) {
+ final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
- if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
- final String message =
- "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
- }
- if (queryJobResponse.getOperationState() != null) {
- final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
- LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
- operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
- return Optional.of(queryJobResponse.getOperationState());
- }
+ if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
+ final String message = "Recevied invalid operation reterivel state: "
+ + queryJobResponse.getOperationStatusRetrievalStatus();
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
+ }
+ if (queryJobResponse.getOperationState() != null) {
+ final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
+ LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
+ operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
+ return Optional.of(queryJobResponse.getOperationState());
+ }
- LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
- queryJobResponse.getOperationStatusRetrievalStatus());
+ LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}",
+ queryJobResponse.getId(), queryJobResponse.getOperationStatusRetrievalStatus());
+ }
+ return Optional.absent();
}
- return Optional.absent();
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
index 22a5d28e52..65b05e21f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
@@ -42,44 +42,44 @@ import org.springframework.stereotype.Component;
@Component
public class MonitorVnfmNodeTask {
- private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class);
- private final ExtractPojosForBB extractPojosForBB;
- private final ExceptionBuilder exceptionUtil;
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionUtil;
- @Autowired
- public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) {
- this.exceptionUtil = exceptionUtil;
- this.extractPojosForBB = extractPojosForBB;
- }
+ @Autowired
+ public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) {
+ this.exceptionUtil = exceptionUtil;
+ this.extractPojosForBB = extractPojosForBB;
+ }
- /**
- * Check the final status of vnf in A&AI
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void getNodeStatus(final BuildingBlockExecution execution) {
- try {
- LOGGER.debug("Executing getNodeStatus ...");
- final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
- String orchestrationStatus = vnf.getOrchestrationStatus();
- LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus);
- execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus));
- execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus));
- } catch (final Exception exception) {
- LOGGER.error("Unable to get vnf from AAI", exception);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
+ /**
+ * Check the final status of vnf in A&AI
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getNodeStatus(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing getNodeStatus ...");
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ String orchestrationStatus = vnf.getOrchestrationStatus();
+ LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus);
+ execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus));
+ execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus));
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to get vnf from AAI", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
+ }
}
- }
- /**
- * Log and throw exception on timeout for job status
- *
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- */
- public void timeOutLogFailue(final BuildingBlockExecution execution) {
- final String message = "Node operation time out";
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1221, message);
- }
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Node operation time out";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1221, message);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
index 4e15474e46..9ff2835480 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
@@ -27,7 +27,6 @@ import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.SPACE;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.UNDERSCORE;
import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
@@ -44,12 +43,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.google.common.base.Optional;
/**
- * This class is executed from EtsiVnfInstantiateBB building block and it sends the create request
- * to the VNFM adapter
+ * This class is executed from EtsiVnfInstantiateBB building block and it sends the create request to the VNFM adapter
*
* @author waqas.ikram@est.tech
*/
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
index 1046b6bf26..f5bae2c82a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
index 1e785074f3..d1b270bc1e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
@@ -34,10 +34,10 @@ import com.google.common.base.Optional;
*/
public interface VnfmAdapterServiceProvider {
- Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request);
+ Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request);
- Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId);
+ Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId);
- Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId);
+ Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
index e8f4c08f38..f193967a32 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -41,111 +41,111 @@ import com.google.common.base.Optional;
@Service
public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
- private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
-
- private final VnfmAdapterUrlProvider urlProvider;
- private final HttpRestServiceProvider httpServiceProvider;
-
- @Autowired
- public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider,
- final HttpRestServiceProvider httpServiceProvider) {
- this.urlProvider = urlProvider;
- this.httpServiceProvider = httpServiceProvider;
- }
-
- @Override
- public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId,
- final CreateVnfRequest request) {
- try {
- final String url = urlProvider.getCreateInstantiateUrl(vnfId);
-
- final ResponseEntity<CreateVnfResponse> response =
- httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class);
-
- final HttpStatus httpStatus = response.getStatusCode();
- if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
- LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value());
- return Optional.absent();
- }
-
- if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
- return Optional.absent();
- }
-
- final CreateVnfResponse createVnfResponse = response.getBody();
-
- if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
- LOGGER.error("Received invalid instantiation response: {}", response);
- return Optional.absent();
- }
-
- return Optional.of(createVnfResponse);
- } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
- LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException);
- return Optional.absent();
+ private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+
+ private final VnfmAdapterUrlProvider urlProvider;
+ private final HttpRestServiceProvider httpServiceProvider;
+
+ @Autowired
+ public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider,
+ final HttpRestServiceProvider httpServiceProvider) {
+ this.urlProvider = urlProvider;
+ this.httpServiceProvider = httpServiceProvider;
}
- }
+ @Override
+ public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId,
+ final CreateVnfRequest request) {
+ try {
+ final String url = urlProvider.getCreateInstantiateUrl(vnfId);
- @Override
- public Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId) {
- try {
- final String url = urlProvider.getDeleteUrl(vnfId);
- LOGGER.debug("Will send request to vnfm adapter using url: {}", url);
+ final ResponseEntity<CreateVnfResponse> response =
+ httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class);
- final ResponseEntity<DeleteVnfResponse> response =
- httpServiceProvider.deleteHttpRequest(url, DeleteVnfResponse.class);
+ final HttpStatus httpStatus = response.getStatusCode();
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value());
+ return Optional.absent();
+ }
- LOGGER.debug("Response received: ", response);
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
- final HttpStatus httpStatus = response.getStatusCode();
+ final CreateVnfResponse createVnfResponse = response.getBody();
- if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
- LOGGER.error("Unable to invoke HTTP DELETE using URL: {}, Response Code: {}", url, httpStatus.value());
- return Optional.absent();
- }
+ if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
+ LOGGER.error("Received invalid instantiation response: {}", response);
+ return Optional.absent();
+ }
- if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
- return Optional.absent();
- }
- final DeleteVnfResponse deleteVnfResponse = response.getBody();
+ return Optional.of(createVnfResponse);
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException);
+ return Optional.absent();
+ }
- if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) {
- LOGGER.error("Received invalid delete response: {}", response);
- return Optional.absent();
- }
- return Optional.of(deleteVnfResponse);
- } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
- LOGGER.error("Unexpected error while processing delete request", httpInvocationException);
- return Optional.absent();
}
- }
-
- @Override
- public Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId) {
- try {
- final String url = urlProvider.getJobStatusUrl(jobId);
-
- final ResponseEntity<QueryJobResponse> response =
- httpServiceProvider.getHttpResponse(url, QueryJobResponse.class);
-
- final HttpStatus httpStatus = response.getStatusCode();
-
- if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
- LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: ", url, httpStatus.value());
- return Optional.absent();
- }
-
- if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
- return Optional.absent();
- }
- return Optional.of(response.getBody());
- } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
- LOGGER.error("Unexpected error while processing job request", httpInvocationException);
- return Optional.absent();
+
+ @Override
+ public Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId) {
+ try {
+ final String url = urlProvider.getDeleteUrl(vnfId);
+ LOGGER.debug("Will send request to vnfm adapter using url: {}", url);
+
+ final ResponseEntity<DeleteVnfResponse> response =
+ httpServiceProvider.deleteHttpRequest(url, DeleteVnfResponse.class);
+
+ LOGGER.debug("Response received: ", response);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP DELETE using URL: {}, Response Code: {}", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+ final DeleteVnfResponse deleteVnfResponse = response.getBody();
+
+ if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) {
+ LOGGER.error("Received invalid delete response: {}", response);
+ return Optional.absent();
+ }
+ return Optional.of(deleteVnfResponse);
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing delete request", httpInvocationException);
+ return Optional.absent();
+ }
+ }
+
+ @Override
+ public Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId) {
+ try {
+ final String url = urlProvider.getJobStatusUrl(jobId);
+
+ final ResponseEntity<QueryJobResponse> response =
+ httpServiceProvider.getHttpResponse(url, QueryJobResponse.class);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: ", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+ return Optional.of(response.getBody());
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing job request", httpInvocationException);
+ return Optional.absent();
+ }
}
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
index 97a7197373..cacba5c5fd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
@@ -35,34 +35,32 @@ import org.springframework.web.util.UriComponentsBuilder;
@Service
public class VnfmAdapterUrlProvider {
- private final URI baseUri;
+ private final URI baseUri;
- @Autowired
- public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
- this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri();
- }
+ @Autowired
+ public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri();
+ }
- /**
- * Get VNFM create and instantiate URL
- *
- * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in
- * AAI.
- * @return VNFM create and instantiate URL
- */
- public String getCreateInstantiateUrl(final String vnfId) {
- return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
- }
+ /**
+ * Get VNFM create and instantiate URL
+ *
+ * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.
+ * @return VNFM create and instantiate URL
+ */
+ public String getCreateInstantiateUrl(final String vnfId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
+ }
- /**
- * Get VNFM delete URL
- *
- * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in
- * AAI.
- * @return VNFM delete URL
- */
- public String getDeleteUrl(final String vnfId) {
- return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
- }
+ /**
+ * Get VNFM delete URL
+ *
+ * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.
+ * @return VNFM delete URL
+ */
+ public String getDeleteUrl(final String vnfId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
+ }
/**
* Get job status URL
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
index c9b1ad1ce1..8bb5302ce9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_AUTH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_URL;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
index 5ade3240a0..d01d494c58 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
index 6027e78d8b..bf4f16b355 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
@@ -21,14 +21,12 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
-
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.client.sdnc.SDNCClient;
@@ -37,12 +35,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
-
import net.minidev.json.JSONArray;
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
index 11e93e733d..0d45dad6fe 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
import java.util.Objects;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 75c66345a0..ef882b4694 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -46,139 +46,138 @@ import org.springframework.stereotype.Component;
@Component
public class AppcRunTasks {
- private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private ApplicationControllerAction appCClient;
-
- public void preProcessActivity(BuildingBlockExecution execution) {
- execution.setVariable("actionSnapshot", Action.Snapshot);
- execution.setVariable("actionLock", Action.Lock);
- execution.setVariable("actionUnlock", Action.Unlock);
- execution.setVariable("actionUpgradePreCheck", Action.UpgradePreCheck);
- execution.setVariable("actionUpgradePostCheck", Action.UpgradePostCheck);
- execution.setVariable("actionQuiesceTraffic", Action.QuiesceTraffic);
- execution.setVariable("actionUpgradeBackup", Action.UpgradeBackup);
- execution.setVariable("actionUpgradeSoftware", Action.UpgradeSoftware);
- execution.setVariable("actionResumeTraffic", Action.ResumeTraffic);
- execution.setVariable("actionStop", Action.Stop);
- execution.setVariable("actionStart", Action.Start);
- execution.setVariable("actionHealthCheck", Action.HealthCheck);
- execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
- execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
- execution.setVariable("rollbackVnfStop", false);
- execution.setVariable("rollbackVnfLock", false);
- execution.setVariable("rollbackQuiesceTraffic", false);
- }
-
- public void runAppcCommand(BuildingBlockExecution execution, Action action) {
- logger.trace("Start runAppcCommand ");
- String appcCode = "1002";
- String appcMessage = "";
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- GenericVnf vnf = null;
- try {
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- } catch (BBObjectNotFoundException e) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
- }
- String vnfId = null;
- String vnfName = null;
- String vnfType = null;
- String vnfHostIpAddress = null;
+ private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
- if (vnf != null) {
- vnfId = vnf.getVnfId();
- vnfName = vnf.getVnfName();
- vnfType = vnf.getVnfType();
- vnfHostIpAddress = vnf.getIpv4OamAddress();
+ public void preProcessActivity(BuildingBlockExecution execution) {
+ execution.setVariable("actionSnapshot", Action.Snapshot);
+ execution.setVariable("actionLock", Action.Lock);
+ execution.setVariable("actionUnlock", Action.Unlock);
+ execution.setVariable("actionUpgradePreCheck", Action.UpgradePreCheck);
+ execution.setVariable("actionUpgradePostCheck", Action.UpgradePostCheck);
+ execution.setVariable("actionQuiesceTraffic", Action.QuiesceTraffic);
+ execution.setVariable("actionUpgradeBackup", Action.UpgradeBackup);
+ execution.setVariable("actionUpgradeSoftware", Action.UpgradeSoftware);
+ execution.setVariable("actionResumeTraffic", Action.ResumeTraffic);
+ execution.setVariable("actionStop", Action.Stop);
+ execution.setVariable("actionStart", Action.Start);
+ execution.setVariable("actionHealthCheck", Action.HealthCheck);
+ execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
+ execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
+ execution.setVariable("rollbackVnfStop", false);
+ execution.setVariable("rollbackVnfLock", false);
+ execution.setVariable("rollbackQuiesceTraffic", false);
+ }
+
+ public void runAppcCommand(BuildingBlockExecution execution, Action action) {
+ logger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ GenericVnf vnf = null;
+ try {
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
+ }
+ String vnfId = null;
+ String vnfName = null;
+ String vnfType = null;
+ String vnfHostIpAddress = null;
+
+ if (vnf != null) {
+ vnfId = vnf.getVnfId();
+ vnfName = vnf.getVnfName();
+ vnfType = vnf.getVnfType();
+ vnfHostIpAddress = vnf.getIpv4OamAddress();
+ }
+ String msoRequestId = gBBInput.getRequestContext().getMsoRequestId();
+
+ String aicIdentity = execution.getVariable("aicIdentity");
+ String vmIdList = execution.getVariable("vmIdList");
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String identityUrl = execution.getVariable("identityUrl");
+
+ ControllerSelectionReference controllerSelectionReference = catalogDbClient
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
+ String controllerType = controllerSelectionReference.getControllerName();
+
+ String vfModuleId = null;
+ VfModule vfModule = null;
+ try {
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ } catch (BBObjectNotFoundException e) {
+ }
+ if (vfModule != null) {
+ vfModuleId = vfModule.getVfModuleId();
+ }
+
+ HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList,
+ vserverIdList, identityUrl, vfModuleId);
+ Optional<String> payload = null;
+ RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
+ if (requestParameters != null) {
+ String pay = requestParameters.getPayload();
+ if (pay != null) {
+ payload = Optional.of(pay);
+ }
+ }
+ logger.debug("Running APP-C action: {}", action.toString());
+ logger.debug("VNFID: {}", vnfId);
+ appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
+ mapRollbackVariables(execution, action, appcCode);
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ appcMessage = e.getMessage();
+ }
+
+ logger.error("Error Message: {}", appcMessage);
+ logger.error("ERROR CODE: {}", appcCode);
+ logger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
+
+ protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
+ if (appcCode.equals("0") && action != null) {
+ if (action.equals(Action.Lock)) {
+ execution.setVariable("rollbackVnfLock", true);
+ } else if (action.equals(Action.Unlock)) {
+ execution.setVariable("rollbackVnfLock", false);
+ } else if (action.equals(Action.Start)) {
+ execution.setVariable("rollbackVnfStop", false);
+ } else if (action.equals(Action.Stop)) {
+ execution.setVariable("rollbackVnfStop", true);
+ } else if (action.equals(Action.QuiesceTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", true);
+ } else if (action.equals(Action.ResumeTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", false);
+ }
}
- String msoRequestId = gBBInput.getRequestContext().getMsoRequestId();
+ }
- String aicIdentity = execution.getVariable("aicIdentity");
- String vmIdList = execution.getVariable("vmIdList");
- String vserverIdList = execution.getVariable("vserverIdList");
- String identityUrl = execution.getVariable("identityUrl");
-
- ControllerSelectionReference controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = controllerSelectionReference.getControllerName();
-
- String vfModuleId = null;
- VfModule vfModule = null;
- try {
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- } catch (BBObjectNotFoundException e) {
- }
- if (vfModule != null) {
- vfModuleId = vfModule.getVfModuleId();
- }
-
- HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList,
- identityUrl, vfModuleId);
- Optional<String> payload = null;
- RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
- if(requestParameters != null){
- String pay = requestParameters.getPayload();
- if (pay != null) {
- payload = Optional.of(pay);
- }
- }
- logger.debug("Running APP-C action: {}", action.toString());
- logger.debug("VNFID: {}", vnfId);
- appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
- appcCode = appCClient.getErrorCode();
- appcMessage = appCClient.getErrorMessage();
- mapRollbackVariables(execution, action, appcCode);
- }
- catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- appcMessage = e.getMessage();
- }
-
- logger.error("Error Message: {}", appcMessage);
- logger.error("ERROR CODE: {}", appcCode);
- logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
-
- protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
- if (appcCode.equals("0") && action != null) {
- if (action.equals(Action.Lock)) {
- execution.setVariable("rollbackVnfLock", true);
- } else if (action.equals(Action.Unlock)) {
- execution.setVariable("rollbackVnfLock", false);
- } else if (action.equals(Action.Start)) {
- execution.setVariable("rollbackVnfStop", false);
- } else if (action.equals(Action.Stop)) {
- execution.setVariable("rollbackVnfStop", true);
- } else if (action.equals(Action.QuiesceTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", true);
- } else if (action.equals(Action.ResumeTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", false);
- }
- }
- }
-
- private HashMap<String,String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
- String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", vnfName);
- payloadInfo.put("aicIdentity", aicIdentity);
- payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress);
- payloadInfo.put("vmIdList", vmIdList);
- payloadInfo.put("vserverIdList", vserverIdList);
- payloadInfo.put("identityUrl", identityUrl);
- payloadInfo.put("vfModuleId",vfModuleId);
- return payloadInfo;
- }
+ private HashMap<String, String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
+ String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", vnfName);
+ payloadInfo.put("aicIdentity", aicIdentity);
+ payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress);
+ payloadInfo.put("vmIdList", vmIdList);
+ payloadInfo.put("vserverIdList", vserverIdList);
+ payloadInfo.put("identityUrl", identityUrl);
+ payloadInfo.put("vfModuleId", vfModuleId);
+ return payloadInfo;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
index f6e07c8303..a223259d4d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
@@ -39,45 +39,46 @@ import org.springframework.stereotype.Component;
@Component
public class AuditTasks {
- private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private Environment env;
+ @Autowired
+ private Environment env;
- public void isAuditNeeded(BuildingBlockExecution execution) {
- try {
- logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory"));
- execution.setVariable("auditInventoryNeeded", Boolean.parseBoolean(env.getProperty("mso.infra.auditInventory")));
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void isAuditNeeded(BuildingBlockExecution execution) {
+ try {
+ logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory"));
+ execution.setVariable("auditInventoryNeeded",
+ Boolean.parseBoolean(env.getProperty("mso.infra.auditInventory")));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- public void setupAuditVariable(BuildingBlockExecution execution) {
- try {
- execution.setVariable("auditInventory",createAuditInventory(execution));
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void setupAuditVariable(BuildingBlockExecution execution) {
+ try {
+ execution.setVariable("auditInventory", createAuditInventory(execution));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException {
- AuditInventory auditInventory = new AuditInventory();
+ private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ AuditInventory auditInventory = new AuditInventory();
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
- auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
- auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
- auditInventory.setTenantId(cloudRegion.getTenantId());
- auditInventory.setHeatStackName(vfModule.getVfModuleName());
- return auditInventory;
- }
+ auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
+ auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
+ auditInventory.setTenantId(cloudRegion.getTenantId());
+ auditInventory.setHeatStackName(vfModule.getVfModuleName());
+ return auditInventory;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
index f2fb37e182..9ed77d47ea 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
@@ -32,24 +32,24 @@ import org.springframework.stereotype.Component;
public class ActivateVfModule {
private static final Logger logger = LoggerFactory.getLogger(ActivateVfModule.class);
-
- protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration";
- protected static final String DEFAULT_TIMER_DURATION = "PT180S";
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- @Autowired
+
+ protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration";
+ protected static final String DEFAULT_TIMER_DURATION = "PT180S";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
private Environment environment;
- public void setTimerDuration(BuildingBlockExecution execution) {
- try {
- String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION);
- logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration);
- execution.setVariable("vfModuleActivateTimerDuration", waitDuration);
- } catch (Exception e) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
- }
- }
+ public void setTimerDuration(BuildingBlockExecution execution) {
+ try {
+ String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION);
+ logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration);
+ execution.setVariable("vfModuleActivateTimerDuration", waitDuration);
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, 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
index c3106d6e49..164480d7c7 100644
--- 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
@@ -34,28 +34,29 @@ import org.springframework.stereotype.Component;
@Component
public class AssignNetwork {
- private static final Logger logger = LoggerFactory.getLogger(AssignNetwork.class);
+ private static final Logger logger = LoggerFactory.getLogger(AssignNetwork.class);
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- /**
- * 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);
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
- if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){
- networkFound = true;
- logger.debug("network found in NOT PRECREATED status");
- }
- } catch (Exception ex) {
- // return false if no network present
- }
- return networkFound;
- }
+ /**
+ * 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);
+
+ if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())) {
+ networkFound = true;
+ logger.debug("network found in NOT PRECREATED status");
+ }
+ } catch (Exception ex) {
+ // return false if no network present
+ }
+ return networkFound;
+ }
}
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
index df3f5465e6..ab8818f682 100644
--- 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
@@ -37,65 +37,69 @@ import org.springframework.stereotype.Component;
@Component
public class AssignNetworkBBUtils {
- private static final Logger logger = LoggerFactory.getLogger(AssignNetworkBBUtils.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private AAINetworkResources aaiNetworkResources;
- @Autowired
- private SDNCNetworkResources sdncNetworkResources;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ private static final Logger logger = LoggerFactory.getLogger(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";
- logger.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);
- }
+ /**
+ * 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";
+ logger.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
index 0aa3142996..1b06fe114f 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -37,35 +36,36 @@ 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);
- 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, AAIEdgeLabel.BELONGS_TO);
- }
- else if(ModelInfoInstanceGroup.TYPE_L3_NETWORK.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
- aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES);
- }
- }
- }
- catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+
+ @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);
+ 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, AAIEdgeLabel.BELONGS_TO);
+ } else if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
+ .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES);
+ }
+ }
+ } 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/CloudSiteCatalogUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
index 752c39a0a6..c1482d1463 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
@@ -22,7 +22,6 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -35,45 +34,49 @@ import org.springframework.stereotype.Component;
@Component
public class CloudSiteCatalogUtils {
- private static final Logger logger = LoggerFactory.getLogger(CloudSiteCatalogUtils.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- @Autowired
- private CatalogDbClient catalogDbClient;
-
-
- public void getIdentityUrlFromCloudSite(DelegateExecution execution) {
- String cloudRegionId = (String) execution.getVariable("lcpCloudRegionId");
-
- if (cloudRegionId != null) {
- Optional<CloudSite> cloudSite = getCloudSite(cloudRegionId);
- if (!cloudSite.isPresent()) {
- logger.debug("Cloud Region with cloudRegionId {} not found in Catalog DB", cloudRegionId);
- exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB");
- }
-
- if (cloudSite.get().getIdentityService() == null) {
- logger.debug("No identityService found for Cloud Region with cloudRegionId {} in Catalog DB", cloudRegionId);
- exceptionUtil.buildAndThrowWorkflowException(execution, 404, "No identityService found for Cloud Region with cloudRegionId " + cloudRegionId + " in Catalog DB");
- }
- String identityUrl = cloudSite.get().getIdentityService().getIdentityUrl();
-
- logger.debug("identityUrl from Catalog DB is: {}", identityUrl);
- execution.setVariable("identityUrl", identityUrl);
- }
- }
-
- protected Optional<CloudSite> getCloudSite(String id) {
- if (id == null) {
- return Optional.empty();
- }
- CloudSite cloudSite = catalogDbClient.getCloudSite(id);
+ private static final Logger logger = LoggerFactory.getLogger(CloudSiteCatalogUtils.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+
+ public void getIdentityUrlFromCloudSite(DelegateExecution execution) {
+ String cloudRegionId = (String) execution.getVariable("lcpCloudRegionId");
+
+ if (cloudRegionId != null) {
+ Optional<CloudSite> cloudSite = getCloudSite(cloudRegionId);
+ if (!cloudSite.isPresent()) {
+ logger.debug("Cloud Region with cloudRegionId {} not found in Catalog DB", cloudRegionId);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 404,
+ "Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB");
+ }
+
+ if (cloudSite.get().getIdentityService() == null) {
+ logger.debug("No identityService found for Cloud Region with cloudRegionId {} in Catalog DB",
+ cloudRegionId);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 404,
+ "No identityService found for Cloud Region with cloudRegionId " + cloudRegionId
+ + " in Catalog DB");
+ }
+ String identityUrl = cloudSite.get().getIdentityService().getIdentityUrl();
+
+ logger.debug("identityUrl from Catalog DB is: {}", identityUrl);
+ execution.setVariable("identityUrl", identityUrl);
+ }
+ }
+
+ protected Optional<CloudSite> getCloudSite(String id) {
+ if (id == null) {
+ return Optional.empty();
+ }
+ CloudSite cloudSite = catalogDbClient.getCloudSite(id);
- if (cloudSite != null) {
- return Optional.of(cloudSite);
- } else {
- return(Optional.of(catalogDbClient.getCloudSiteByClliAndAicVersion(id,"2.5")));
- }
- }
+ if (cloudSite != null) {
+ return Optional.of(cloudSite);
+ } else {
+ return (Optional.of(catalogDbClient.getCloudSiteByClliAndAicVersion(id, "2.5")));
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
index 242135adb8..8a24330093 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Map;
import java.util.UUID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -57,8 +56,8 @@ public class ConfigAssignVnf {
private ExtractPojosForBB extractPojosForBB;
/**
- * Getting the vnf data, blueprint name, blueprint version etc and setting them
- * in execution object and calling the subprocess.
+ * Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the
+ * subprocess.
*
* @param execution
*/
@@ -66,7 +65,8 @@ public class ConfigAssignVnf {
logger.info("Start preProcessAbstractCDSProcessing ");
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Map<String, Object> userParams = execution.getGeneralBuildingBlock().getRequestContext().getUserParams();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index 1bc7c0f574..359f19285f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -1,27 +1,21 @@
/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2019 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright 2019 TechMahindra
+ * ================================================================================= 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.UUID;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,86 +39,90 @@ import org.springframework.stereotype.Component;
*/
@Component
public class ConfigDeployVnf {
- private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class);
- private final static String ORIGINATOR_ID = "SO";
- private final static String ACTION_NAME = "config-deploy";
- private final static String MODE = "async";
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private AAIUpdateTasks aaiUpdateTask;
-
- /**
- * Update vnf orch status to configure in AAI
- *
- * @param execution
- */
- public void updateAAIConfigure(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
-
- }
- /**
- * Getting the vnf object and set in execution object
- *
- * @param execution
- *
- *
- */
- public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
-
-
- logger.info("Start preProcessAbstractCDSProcessing");
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
- configDeployPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
- configDeployPropertiesForVnf.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
- configDeployPropertiesForVnf.setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
- configDeployPropertiesForVnf.setVnfId(vnf.getVnfId());
- configDeployPropertiesForVnf.setVnfName(vnf.getVnfName());
-
- ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
-
- configDeployRequestVnf.setResolutionKey(vnf.getVnfName());
- configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
-
- String blueprintName = vnf.getBlueprintName();
- String blueprintVersion = vnf.getBlueprintVersion();
- AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
-
- abstractCDSPropertiesBean.setBlueprintName(blueprintName);
- abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
- abstractCDSPropertiesBean.setRequestObject(configDeployRequestVnf.toString());
-
-
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- abstractCDSPropertiesBean.setOriginatorId( ORIGINATOR_ID);
- abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
- abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
- abstractCDSPropertiesBean.setActionName(ACTION_NAME);
- abstractCDSPropertiesBean.setMode(MODE);
-
- execution.setVariable("executionObject", abstractCDSPropertiesBean);
-
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * Update vnf orch status to configured in AAI
- *
- * @param execution
- */
- public void updateAAIConfigured(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
-
- }
-} \ No newline at end of file
+ private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class);
+ private final static String ORIGINATOR_ID = "SO";
+ private final static String ACTION_NAME = "config-deploy";
+ private final static String MODE = "async";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIUpdateTasks aaiUpdateTask;
+
+ /**
+ * Update vnf orch status to configure in AAI
+ *
+ * @param execution
+ */
+ public void updateAAIConfigure(BuildingBlockExecution execution) {
+ aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+
+ }
+
+ /**
+ * Getting the vnf object and set in execution object
+ *
+ * @param execution
+ *
+ *
+ */
+ public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
+
+
+ logger.info("Start preProcessAbstractCDSProcessing");
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+ configDeployPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ configDeployPropertiesForVnf
+ .setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ configDeployPropertiesForVnf
+ .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configDeployPropertiesForVnf.setVnfId(vnf.getVnfId());
+ configDeployPropertiesForVnf.setVnfName(vnf.getVnfName());
+
+ ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
+
+ configDeployRequestVnf.setResolutionKey(vnf.getVnfName());
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+
+ String blueprintName = vnf.getBlueprintName();
+ String blueprintVersion = vnf.getBlueprintVersion();
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setRequestObject(configDeployRequestVnf.toString());
+
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(ACTION_NAME);
+ abstractCDSPropertiesBean.setMode(MODE);
+
+ execution.setVariable("executionObject", abstractCDSPropertiesBean);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Update vnf orch status to configured in AAI
+ *
+ * @param execution
+ */
+ public void updateAAIConfigured(BuildingBlockExecution execution) {
+ aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index 4cd0321578..1925d8b69f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload;
import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut;
@@ -45,124 +44,124 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
@Component
public class ConfigurationScaleOut {
- private static final Logger logger = LoggerFactory.getLogger(ConfigurationScaleOut.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private ApplicationControllerAction appCClient;
- private static final String ACTION = "action";
- private static final String MSO_REQUEST_ID = "msoRequestId";
- private static final String VNF_ID = "vnfId";
- private static final String VNF_NAME = "vnfName";
- private static final String VFMODULE_ID = "vfModuleId";
- private static final String CONTROLLER_TYPE = "controllerType";
- private static final String PAYLOAD = "payload";
-
- public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) {
-
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- try {
- List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters();
- String key = null;
- String paramValue = null;
- ObjectMapper mapper = new ObjectMapper();
- String configScaleOutPayloadString = null;
- ControllerSelectionReference controllerSelectionReference;
- ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- String vnfName = vnf.getVnfName();
- String vnfType = vnf.getVnfType();
- String actionCategory = Action.ConfigScaleOut.toString();
- controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
- String controllerName = controllerSelectionReference.getControllerName();
-
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
-
- Map<String, String> paramsMap = new HashMap<>();
- RequestParametersConfigScaleOut requestParameters = new RequestParametersConfigScaleOut();
- String configScaleOutParam = null;
- if (jsonPathForCfgParams != null) {
- for (Map<String, String> param : jsonPathForCfgParams) {
- for (Map.Entry<String,String> entry : param.entrySet()) {
- key = entry.getKey();
- paramValue = entry.getValue();
- try{
- configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue);
- }catch(ClassCastException e){
- configScaleOutParam = null;
- logger.warn("Incorrect JSON path. Path points to object rather than value causing: ", e);
- }
- paramsMap.put(key, configScaleOutParam);
- }
- }
- }
- requestParameters.setVfModuleId(vfModule.getVfModuleId());
- requestParameters.setVnfHostIpAddress(vnf.getIpv4OamAddress());
- configPayload.setConfigurationParameters(paramsMap);
- configPayload.setRequestParameters(requestParameters);
- configScaleOutPayloadString = mapper.writeValueAsString(configPayload);
-
- execution.setVariable(ACTION, actionCategory);
- execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId());
- execution.setVariable(VNF_ID, vnfId);
- execution.setVariable(VNF_NAME, vnfName);
- execution.setVariable(VFMODULE_ID, vfModule.getVfModuleId());
- execution.setVariable(CONTROLLER_TYPE, controllerName);
- execution.setVariable(PAYLOAD, configScaleOutPayloadString);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void callAppcClient(BuildingBlockExecution execution) {
- logger.trace("Start runAppcCommand ");
- String appcCode = "1002";
- String appcMessage = "";
- try{
- Action commandAction = Action.valueOf(execution.getVariable(ACTION));
- String msoRequestId = execution.getVariable(MSO_REQUEST_ID);
- String vnfId = execution.getVariable(VNF_ID);
- Optional<String> payloadString = null;
- if(execution.getVariable(PAYLOAD) != null){
- String pay = execution.getVariable(PAYLOAD);
- payloadString = Optional.of(pay);
- }
- String controllerType = execution.getVariable(CONTROLLER_TYPE);
- HashMap<String, String> payloadInfo = new HashMap<>();
- payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
- payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID));
- logger.debug("Running APP-C action: {}", commandAction.toString());
- logger.debug("VNFID: {}", vnfId);
- //PayloadInfo contains extra information that adds on to payload before making request to appc
- appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType);
- appcCode = appCClient.getErrorCode();
- appcMessage = appCClient.getErrorMessage();
-
- } catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- appcMessage = e.getMessage();
- }
- logger.error("Error Message: " + appcMessage);
- logger.error("ERROR CODE: " + appcCode);
- logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(ConfigurationScaleOut.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
+ private static final String ACTION = "action";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VNF_NAME = "vnfName";
+ private static final String VFMODULE_ID = "vfModuleId";
+ private static final String CONTROLLER_TYPE = "controllerType";
+ private static final String PAYLOAD = "payload";
+
+ public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ try {
+ List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters();
+ String key = null;
+ String paramValue = null;
+ ObjectMapper mapper = new ObjectMapper();
+ String configScaleOutPayloadString = null;
+ ControllerSelectionReference controllerSelectionReference;
+ ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+ String actionCategory = Action.ConfigScaleOut.toString();
+ controllerSelectionReference =
+ catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ String controllerName = controllerSelectionReference.getControllerName();
+
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+
+ Map<String, String> paramsMap = new HashMap<>();
+ RequestParametersConfigScaleOut requestParameters = new RequestParametersConfigScaleOut();
+ String configScaleOutParam = null;
+ if (jsonPathForCfgParams != null) {
+ for (Map<String, String> param : jsonPathForCfgParams) {
+ for (Map.Entry<String, String> entry : param.entrySet()) {
+ key = entry.getKey();
+ paramValue = entry.getValue();
+ try {
+ configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue);
+ } catch (ClassCastException e) {
+ configScaleOutParam = null;
+ logger.warn("Incorrect JSON path. Path points to object rather than value causing: ", e);
+ }
+ paramsMap.put(key, configScaleOutParam);
+ }
+ }
+ }
+ requestParameters.setVfModuleId(vfModule.getVfModuleId());
+ requestParameters.setVnfHostIpAddress(vnf.getIpv4OamAddress());
+ configPayload.setConfigurationParameters(paramsMap);
+ configPayload.setRequestParameters(requestParameters);
+ configScaleOutPayloadString = mapper.writeValueAsString(configPayload);
+
+ execution.setVariable(ACTION, actionCategory);
+ execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable(VNF_ID, vnfId);
+ execution.setVariable(VNF_NAME, vnfName);
+ execution.setVariable(VFMODULE_ID, vfModule.getVfModuleId());
+ execution.setVariable(CONTROLLER_TYPE, controllerName);
+ execution.setVariable(PAYLOAD, configScaleOutPayloadString);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void callAppcClient(BuildingBlockExecution execution) {
+ logger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ Action commandAction = Action.valueOf(execution.getVariable(ACTION));
+ String msoRequestId = execution.getVariable(MSO_REQUEST_ID);
+ String vnfId = execution.getVariable(VNF_ID);
+ Optional<String> payloadString = null;
+ if (execution.getVariable(PAYLOAD) != null) {
+ String pay = execution.getVariable(PAYLOAD);
+ payloadString = Optional.of(pay);
+ }
+ String controllerType = execution.getVariable(CONTROLLER_TYPE);
+ HashMap<String, String> payloadInfo = new HashMap<>();
+ payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
+ payloadInfo.put(VFMODULE_ID, execution.getVariable(VFMODULE_ID));
+ logger.debug("Running APP-C action: {}", commandAction.toString());
+ logger.debug("VNFID: {}", vnfId);
+ // PayloadInfo contains extra information that adds on to payload before making request to appc
+ appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
+
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ appcMessage = e.getMessage();
+ }
+ logger.error("Error Message: " + appcMessage);
+ logger.error("ERROR CODE: " + appcCode);
+ logger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
}
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
index 8cad8f93ec..c2d9c6e7bb 100644
--- 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
@@ -22,7 +22,6 @@
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;
@@ -40,32 +39,35 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetwork {
- private static final Logger logger = LoggerFactory.getLogger(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);
- L3Network l3Network = extractPojosForBB.extractByKey(execution, 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);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(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);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, 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
index 5665302b2a..4eaec381e9 100644
--- 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
@@ -36,94 +36,107 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetworkCollection {
- private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private AAINetworkResources aaiNetworkResources;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- 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);
- 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 Instance Group to Cloud Region
- * @param execution
- * @throws Exception
- */
- public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception {
- execution.setVariable("connectInstanceGroupToCloudRegionRollback", false);
- try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Collection networkCollection = serviceInstance.getCollection();
- aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(), execution.getGeneralBuildingBlock().getCloudRegion());
- execution.setVariable("connectInstanceGroupToCloudRegionRollback", 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);
- Collection networkCollection = serviceInstance.getCollection();
- aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance);
- execution.setVariable("connectCollectionToServiceInstanceRollback", true);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ 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);
+ 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);
+ 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 Instance Group to Cloud Region
+ *
+ * @param execution
+ * @throws Exception
+ */
+ public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("connectInstanceGroupToCloudRegionRollback", false);
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Collection networkCollection = serviceInstance.getCollection();
+ aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(),
+ execution.getGeneralBuildingBlock().getCloudRegion());
+ execution.setVariable("connectInstanceGroupToCloudRegionRollback", 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);
+ 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/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index f0db5eda2e..98b602eca1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -44,98 +44,97 @@ import org.springframework.stereotype.Component;
@Component
public class GenericVnfHealthCheck {
- private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private ApplicationControllerAction appCClient;
-
- public void setParamsForGenericVnfHealthCheck(BuildingBlockExecution execution) {
-
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
- try {
- ControllerSelectionReference controllerSelectionReference;
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String vnfId = vnf.getVnfId();
- String vnfName = vnf.getVnfName();
- String vnfType = vnf.getVnfType();
- String oamIpAddress = vnf.getIpv4OamAddress();
- String actionCategory = Action.HealthCheck.toString();
- controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
- String controllerName = controllerSelectionReference.getControllerName();
-
- execution.setVariable("vnfId", vnfId);
- execution.setVariable("vnfName", vnfName);
- execution.setVariable("oamIpAddress", oamIpAddress);
- execution.setVariable("vnfHostIpAddress", oamIpAddress);
- execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
- execution.setVariable("action", actionCategory);
- execution.setVariable("controllerType", controllerName);
-
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void callAppcClient(BuildingBlockExecution execution) {
- logger.trace("Start runAppcCommand ");
- String appcCode = "1002";
- String appcMessage = "";
- try {
- Action action = null;
- action = Action.valueOf(execution.getVariable("action"));
- String msoRequestId = execution.getVariable("msoRequestId");
- String vnfId = execution.getVariable("vnfId");
- Optional<String> payload = null;
- if(execution.getVariable("payload") != null){
- String pay = execution.getVariable("payload");
- payload = Optional.of(pay);
- }
- String controllerType = execution.getVariable("controllerType");
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", execution.getVariable("vnfName"));
- payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId"));
- payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress"));
- payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress"));
-
- logger.debug("Running APP-C action: {}", action.toString());
- logger.debug("VNFID: {}", vnfId);
- //PayloadInfo contains extra information that adds on to payload before making request to appc
- appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
- appcCode = appCClient.getErrorCode();
- appcMessage = appCClient.getErrorMessage();
+ public void setParamsForGenericVnfHealthCheck(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ try {
+ ControllerSelectionReference controllerSelectionReference;
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+ String oamIpAddress = vnf.getIpv4OamAddress();
+ String actionCategory = Action.HealthCheck.toString();
+ controllerSelectionReference =
+ catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ String controllerName = controllerSelectionReference.getControllerName();
+
+ execution.setVariable("vnfId", vnfId);
+ execution.setVariable("vnfName", vnfName);
+ execution.setVariable("oamIpAddress", oamIpAddress);
+ execution.setVariable("vnfHostIpAddress", oamIpAddress);
+ execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable("action", actionCategory);
+ execution.setVariable("controllerType", controllerName);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void callAppcClient(BuildingBlockExecution execution) {
+ logger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ Action action = null;
+ action = Action.valueOf(execution.getVariable("action"));
+ String msoRequestId = execution.getVariable("msoRequestId");
+ String vnfId = execution.getVariable("vnfId");
+ Optional<String> payload = null;
+ if (execution.getVariable("payload") != null) {
+ String pay = execution.getVariable("payload");
+ payload = Optional.of(pay);
+ }
+ String controllerType = execution.getVariable("controllerType");
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", execution.getVariable("vnfName"));
+ payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId"));
+ payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress"));
+ payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress"));
+
+ logger.debug("Running APP-C action: {}", action.toString());
+ logger.debug("VNFID: {}", vnfId);
+ // PayloadInfo contains extra information that adds on to payload before making request to appc
+ appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
} catch (BpmnError ex) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
- appcMessage = ex.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ appcMessage = ex.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ } catch (Exception e) {
+ if (e instanceof java.util.concurrent.TimeoutException) {
+ appcMessage = "Request to APPC timed out. ";
+ logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
+ "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ throw e;
+ } else {
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ appcMessage = e.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
+ logger.error("Error Message: " + appcMessage);
+ logger.error("ERROR CODE: " + appcCode);
+ logger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- } catch (Exception e) {
- if (e instanceof java.util.concurrent.TimeoutException )
- {
- appcMessage = "Request to APPC timed out. ";
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
- "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- throw e;
- }
- else {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- ErrorCode.UnknownError.getValue(), "APPC Error", e);
- appcMessage = e.getMessage();
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
- logger.error("Error Message: " + appcMessage);
- logger.error("ERROR CODE: " + appcCode);
- logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
- }
- }
+ }
+ }
}
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
index 217a60b60a..7ab53cb506 100644
--- 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
@@ -22,53 +22,56 @@ 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.springframework.stereotype.Component;
@Component
-public class NetworkBBUtils {
-
- 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;
- }
-
-
+public class NetworkBBUtils {
+
+ 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
index 596b280916..0f545b9145 100644
--- 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
@@ -21,6 +21,5 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
public enum SourceSystem {
- PO,
- SDNC
+ 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
index 9a7d695c01..27415190cc 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -39,80 +38,83 @@ import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
- private static final Logger logger = LoggerFactory.getLogger(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;
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private AAINetworkResources aaiNetworkResources;
-
- /**
- * 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 {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
- if (networkBBUtils.isRelationshipRelatedToExists(network, 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);
- }
-
-
+ private static final Logger logger = LoggerFactory.getLogger(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;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
+
+ /**
+ * 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 {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<org.onap.aai.domain.yang.L3Network> network =
+ aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+ if (networkBBUtils.isRelationshipRelatedToExists(network, 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
index afa9b439db..e51774c12c 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -37,27 +36,27 @@ 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);
- 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);
- }
- }
+ @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);
+ 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/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index 9214635602..b906b8a662 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -2,7 +2,6 @@ package org.onap.so.bpmn.infrastructure.manualhandling.tasks;
import java.util.Map;
import java.util.HashMap;
-
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateTask;
@@ -20,185 +19,188 @@ import org.springframework.stereotype.Component;
@Component
public class ManualHandlingTasks {
- private static final Logger logger = LoggerFactory.getLogger(ManualHandlingTasks.class);
-
- private static final String TASK_TYPE_PAUSE = "pause";
- private static final String TASK_TYPE_FALLOUT = "fallout";
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
-
- @Autowired
- private RequestsDbClient requestDbclient;
-
- public void setFalloutTaskVariables (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution();
- try {
- String taskId = task.getId();
- logger.debug("taskId is: " + taskId);
- String type = TASK_TYPE_FALLOUT;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
- String description = "";
- String timeout = "";
- String errorSource = (String) execution.getVariable("failedActivity");
- String errorCode = (String) execution.getVariable("errorCode");
- String errorMessage = (String) execution.getVariable("errorText");
- String buildingBlockName = (String) execution.getVariable("currentActivity");
- String buildingBlockStep = (String) execution.getVariable("workStep");
- String validResponses = (String) execution.getVariable("validResponses");
-
- Map<String, String> taskVariables = new HashMap<String, String>();
- taskVariables.put("type", type);
- taskVariables.put("nfRole", nfRole);
- taskVariables.put("subscriptionServiceType", subscriptionServiceType);
- taskVariables.put("originalRequestId", originalRequestId);
- taskVariables.put("originalRequestorId", originalRequestorId);
- taskVariables.put("errorSource", errorSource);
- taskVariables.put("errorCode", errorCode);
- taskVariables.put("errorMessage", errorMessage);
- taskVariables.put("buildingBlockName", buildingBlockName);
- taskVariables.put("buildingBlockStep", buildingBlockStep);
- taskVariables.put("validResponses", validResponses);
- taskVariables.put("tmeout", timeout);
- taskVariables.put("description", description);
- TaskService taskService = execution.getProcessEngineServices().getTaskService();
-
- taskService.setVariables(taskId, taskVariables);
- logger.debug("successfully created fallout task: "+ taskId);
- } catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
- throw e;
- } catch (Exception ex){
- String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
- logger.debug(msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
- }
-
- public void setPauseTaskVariables (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution();
-
- try {
- String taskId = task.getId();
- logger.debug("taskId is: " + taskId);
- String type = TASK_TYPE_PAUSE;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
- String description = (String) execution.getVariable("description");
- String timeout = (String) execution.getVariable("taskTimeout");
- String errorSource = "";
- String errorCode = "";
- String errorMessage = "";
- String buildingBlockName = "";
- String buildingBlockStep = "";
- String validResponses = (String) execution.getVariable("validResponses");
-
- Map<String, String> taskVariables = new HashMap<String, String>();
- taskVariables.put("type", type);
- taskVariables.put("nfRole", nfRole);
- taskVariables.put("description", description);
- taskVariables.put("timeout", timeout);
- taskVariables.put("subscriptionServiceType", subscriptionServiceType);
- taskVariables.put("originalRequestId", originalRequestId);
- taskVariables.put("originalRequestorId", originalRequestorId);
- taskVariables.put("errorSource", errorSource);
- taskVariables.put("errorCode", errorCode);
- taskVariables.put("errorMessage", errorMessage);
- taskVariables.put("buildingBlockName", buildingBlockName);
- taskVariables.put("buildingBlockStep", buildingBlockStep);
- taskVariables.put("validResponses", validResponses);
- TaskService taskService = execution.getProcessEngineServices().getTaskService();
-
- taskService.setVariables(taskId, taskVariables);
- logger.debug("successfully created pause task: "+ taskId);
- } catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
- throw e;
- } catch (Exception ex){
- String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
- logger.debug(msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- }
-
- public void completeTask (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution();
-
- try {
-
- String taskId = task.getId();
- logger.debug("taskId is: " + taskId);
- TaskService taskService = execution.getProcessEngineServices().getTaskService();
-
- Map<String, Object> taskVariables = taskService.getVariables(taskId);
- String responseValue = (String) taskVariables.get("responseValue");
-
- logger.debug("Received responseValue on completion: "+ responseValue);
- // Have to set the first letter of the response to upper case
- String responseValueUppercaseStart = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1);
- logger.debug("ResponseValue to taskListener: "+ responseValueUppercaseStart);
- execution.setVariable("responseValueTask", responseValueUppercaseStart);
-
- } catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
- throw e;
- } catch (Exception ex){
- String msg = "Exception in completeManualTask " + ex.getMessage();
- logger.debug(msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- }
-
- public void createExternalTicket (DelegateExecution execution) {
-
- try {
- ExternalTicket ticket = new ExternalTicket();
-
- ticket.setRequestId((String) execution.getVariable("msoRequestId"));
- ticket.setCurrentActivity((String) execution.getVariable("currentActivity"));
- ticket.setNfRole((String) execution.getVariable("vnfType"));
- ticket.setDescription((String) execution.getVariable("description"));
- ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
- ticket.setRequestorId((String) execution.getVariable("requestorId"));
- ticket.setTimeout((String) execution.getVariable("taskTimeout"));
- ticket.setErrorSource((String) execution.getVariable("failedActivity"));
- ticket.setErrorCode((String) execution.getVariable("errorCode"));
- ticket.setErrorMessage((String) execution.getVariable("errorText"));
- ticket.setWorkStep((String) execution.getVariable("workStep"));
-
- ticket.createTicket();
- } catch (BpmnError e) {
- String msg = "BPMN error in createAOTSTicket " + e.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue());
- } catch (Exception ex){
- String msg = "Exception in createExternalTicket " + ex.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue());
- }
-
- }
-
- public void updateRequestDbStatus(DelegateExecution execution, String status) {
- try {
- String requestId = (String) execution.getVariable("msoRequestId");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
-
- request.setRequestStatus(status);
- request.setLastModifiedBy("ManualHandling");
-
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Unable to save the updated request status to the DB",e);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(ManualHandlingTasks.class);
+
+ private static final String TASK_TYPE_PAUSE = "pause";
+ private static final String TASK_TYPE_FALLOUT = "fallout";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+
+ public void setFalloutTaskVariables(DelegateTask task) {
+
+ DelegateExecution execution = task.getExecution();
+ try {
+ String taskId = task.getId();
+ logger.debug("taskId is: " + taskId);
+ String type = TASK_TYPE_FALLOUT;
+ String nfRole = (String) execution.getVariable("vnfType");
+ String subscriptionServiceType = (String) execution.getVariable("serviceType");
+ String originalRequestId = (String) execution.getVariable("msoRequestId");
+ String originalRequestorId = (String) execution.getVariable("requestorId");
+ String description = "";
+ String timeout = "";
+ String errorSource = (String) execution.getVariable("failedActivity");
+ String errorCode = (String) execution.getVariable("errorCode");
+ String errorMessage = (String) execution.getVariable("errorText");
+ String buildingBlockName = (String) execution.getVariable("currentActivity");
+ String buildingBlockStep = (String) execution.getVariable("workStep");
+ String validResponses = (String) execution.getVariable("validResponses");
+
+ Map<String, String> taskVariables = new HashMap<String, String>();
+ taskVariables.put("type", type);
+ taskVariables.put("nfRole", nfRole);
+ taskVariables.put("subscriptionServiceType", subscriptionServiceType);
+ taskVariables.put("originalRequestId", originalRequestId);
+ taskVariables.put("originalRequestorId", originalRequestorId);
+ taskVariables.put("errorSource", errorSource);
+ taskVariables.put("errorCode", errorCode);
+ taskVariables.put("errorMessage", errorMessage);
+ taskVariables.put("buildingBlockName", buildingBlockName);
+ taskVariables.put("buildingBlockStep", buildingBlockStep);
+ taskVariables.put("validResponses", validResponses);
+ taskVariables.put("tmeout", timeout);
+ taskVariables.put("description", description);
+ TaskService taskService = execution.getProcessEngineServices().getTaskService();
+
+ taskService.setVariables(taskId, taskVariables);
+ logger.debug("successfully created fallout task: " + taskId);
+ } catch (BpmnError e) {
+ logger.debug("BPMN exception: " + e.getMessage());
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
+ logger.debug(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+ public void setPauseTaskVariables(DelegateTask task) {
+
+ DelegateExecution execution = task.getExecution();
+
+ try {
+ String taskId = task.getId();
+ logger.debug("taskId is: " + taskId);
+ String type = TASK_TYPE_PAUSE;
+ String nfRole = (String) execution.getVariable("vnfType");
+ String subscriptionServiceType = (String) execution.getVariable("serviceType");
+ String originalRequestId = (String) execution.getVariable("msoRequestId");
+ String originalRequestorId = (String) execution.getVariable("requestorId");
+ String description = (String) execution.getVariable("description");
+ String timeout = (String) execution.getVariable("taskTimeout");
+ String errorSource = "";
+ String errorCode = "";
+ String errorMessage = "";
+ String buildingBlockName = "";
+ String buildingBlockStep = "";
+ String validResponses = (String) execution.getVariable("validResponses");
+
+ Map<String, String> taskVariables = new HashMap<String, String>();
+ taskVariables.put("type", type);
+ taskVariables.put("nfRole", nfRole);
+ taskVariables.put("description", description);
+ taskVariables.put("timeout", timeout);
+ taskVariables.put("subscriptionServiceType", subscriptionServiceType);
+ taskVariables.put("originalRequestId", originalRequestId);
+ taskVariables.put("originalRequestorId", originalRequestorId);
+ taskVariables.put("errorSource", errorSource);
+ taskVariables.put("errorCode", errorCode);
+ taskVariables.put("errorMessage", errorMessage);
+ taskVariables.put("buildingBlockName", buildingBlockName);
+ taskVariables.put("buildingBlockStep", buildingBlockStep);
+ taskVariables.put("validResponses", validResponses);
+ TaskService taskService = execution.getProcessEngineServices().getTaskService();
+
+ taskService.setVariables(taskId, taskVariables);
+ logger.debug("successfully created pause task: " + taskId);
+ } catch (BpmnError e) {
+ logger.debug("BPMN exception: " + e.getMessage());
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
+ logger.debug(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
+
+ public void completeTask(DelegateTask task) {
+
+ DelegateExecution execution = task.getExecution();
+
+ try {
+
+ String taskId = task.getId();
+ logger.debug("taskId is: " + taskId);
+ TaskService taskService = execution.getProcessEngineServices().getTaskService();
+
+ Map<String, Object> taskVariables = taskService.getVariables(taskId);
+ String responseValue = (String) taskVariables.get("responseValue");
+
+ logger.debug("Received responseValue on completion: " + responseValue);
+ // Have to set the first letter of the response to upper case
+ String responseValueUppercaseStart =
+ responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1);
+ logger.debug("ResponseValue to taskListener: " + responseValueUppercaseStart);
+ execution.setVariable("responseValueTask", responseValueUppercaseStart);
+
+ } catch (BpmnError e) {
+ logger.debug("BPMN exception: " + e.getMessage());
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in completeManualTask " + ex.getMessage();
+ logger.debug(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
+
+ public void createExternalTicket(DelegateExecution execution) {
+
+ try {
+ ExternalTicket ticket = new ExternalTicket();
+
+ ticket.setRequestId((String) execution.getVariable("msoRequestId"));
+ ticket.setCurrentActivity((String) execution.getVariable("currentActivity"));
+ ticket.setNfRole((String) execution.getVariable("vnfType"));
+ ticket.setDescription((String) execution.getVariable("description"));
+ ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
+ ticket.setRequestorId((String) execution.getVariable("requestorId"));
+ ticket.setTimeout((String) execution.getVariable("taskTimeout"));
+ ticket.setErrorSource((String) execution.getVariable("failedActivity"));
+ ticket.setErrorCode((String) execution.getVariable("errorCode"));
+ ticket.setErrorMessage((String) execution.getVariable("errorText"));
+ ticket.setWorkStep((String) execution.getVariable("workStep"));
+
+ ticket.createTicket();
+ } catch (BpmnError e) {
+ String msg = "BPMN error in createAOTSTicket " + e.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ } catch (Exception ex) {
+ String msg = "Exception in createExternalTicket " + ex.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ }
+
+ }
+
+ public void updateRequestDbStatus(DelegateExecution execution, String status) {
+ try {
+ String requestId = (String) execution.getVariable("msoRequestId");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+
+ request.setRequestStatus(status);
+ request.setLastModifiedBy("ManualHandling");
+
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Unable to save the updated request status to the DB", e);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
index 119716a58d..d248ad5443 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -32,25 +32,26 @@ import org.springframework.stereotype.Component;
@Component
public class NamingServiceCreateTasks {
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private NamingServiceResources namingServiceResources;
-
- public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- String policyInstanceName = execution.getVariable("policyInstanceName");
- String nfNamingCode = execution.getVariable("nfNamingCode");
- String generatedInstanceGroupName = "";
- try {
- generatedInstanceGroupName = namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
- }
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private NamingServiceResources namingServiceResources;
+
+ public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ String policyInstanceName = execution.getVariable("policyInstanceName");
+ String nfNamingCode = execution.getVariable("nfNamingCode");
+ String generatedInstanceGroupName = "";
+ try {
+ generatedInstanceGroupName =
+ namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
index c998e4aa75..9a8c9df8b5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
@@ -32,22 +32,22 @@ import org.springframework.stereotype.Component;
@Component
public class NamingServiceDeleteTasks {
-
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
-
- @Autowired
- private NamingServiceResources namingServiceResources;
-
- public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
-
- try {
- namingServiceResources.deleteInstanceGroupName(instanceGroup);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private NamingServiceResources namingServiceResources;
+
+ public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+
+ try {
+ namingServiceResources.deleteInstanceGroupName(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/exceptions/SDNCErrorResponseException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
index e0f88a20a5..d76d860b3b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
@@ -2,12 +2,12 @@ package org.onap.so.bpmn.infrastructure.sdnc.exceptions;
public class SDNCErrorResponseException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 7807799223298140702L;
-
- public SDNCErrorResponseException(String message) {
- super(message);
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7807799223298140702L;
+
+ public SDNCErrorResponseException(String message) {
+ super(message);
+ }
}
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
index 31f4b33e0c..7a0008d5a2 100644
--- 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
@@ -50,80 +50,85 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCActivateTasks {
- private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class);
- @Autowired
- private SDNCVnfResources sdncVnfResources;
- @Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private SDNCNetworkResources sdncNetworkResources;
- @Autowired
- private SDNCVfModuleResources sdncVfModuleResources;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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 {
- try{
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer,
- cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void activateVnf(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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 {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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
index cbb1f34ae5..d3878f06b7 100644
--- 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
@@ -53,99 +53,108 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCAssignTasks {
- private static final Logger logger = LoggerFactory.getLogger(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;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiServiceOperationInformation req = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void assignServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiServiceOperationInformation req =
+ sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer,
+ cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- VolumeGroup volumeGroup = null;
- try{
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- } catch (BBObjectNotFoundException e){
- logger.info("No volume group was found.");
- }
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ } catch (BBObjectNotFoundException e) {
+ logger.info("No volume group was found.");
+ }
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule,
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.assignNetwork(l3network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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
index 59e46e1667..50cf0fb074 100644
--- 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
@@ -47,79 +47,87 @@ 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);
- GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ @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);
+ GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources
+ .changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance,
+ gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network,
+ serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule,
+ vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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
index 8202a14fa3..3a1528946d 100644
--- 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
@@ -51,106 +51,115 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCDeactivateTasks {
- private static final Logger logger = LoggerFactory.getLogger(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;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer,
- cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void deactivateVfModule(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiServiceOperationInformation req = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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);
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiServiceOperationInformation req =
+ sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer,
- requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } 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) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 941eb7a004..7ae6117c61 100644
--- 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
@@ -39,77 +39,79 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCQueryTasks {
- private static final Logger logger = LoggerFactory.getLogger(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 {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
- + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
- + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
- try {
- if(genericVnf.getSelflink() == null) {
- genericVnf.setSelflink(selfLink);
- }
- String response = sdncVnfResources.queryVnf(genericVnf);
- execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
+ @Autowired
+ private SDNCVnfResources sdncVnfResources;
+ @Autowired
+ private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
-
- public void queryVfModule(BuildingBlockExecution execution) throws Exception {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
- + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
- + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/"
- + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
- try {
- if(vfModule.getSelflink() == null || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
- vfModule.setSelflink(selfLink);
- }
- 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);
- 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);
- }
- }
+ public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ String selfLink =
+ "restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstance.getServiceInstanceId()
+ + "/service-data/vnfs/vnf/" + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
+ try {
+ if (genericVnf.getSelflink() == null) {
+ genericVnf.setSelflink(selfLink);
+ }
+ 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 {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
+ + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" + genericVnf.getVnfId()
+ + "/vnf-data/vf-modules/vf-module/" + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
+ try {
+ if (vfModule.getSelflink() == null
+ || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
+ vfModule.setSelflink(selfLink);
+ }
+ 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);
+ 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/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 24f642ae72..f32ffd72c3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -21,12 +21,10 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import java.io.StringReader;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.sdnc.exceptions.SDNCErrorResponseException;
import org.onap.so.client.exception.BadResponseException;
@@ -41,93 +39,95 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathNotFoundException;
-
+
@Component
public class SDNCRequestTasks {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCRequestTasks.class);
-
- private static final String SDNC_REQUEST = "SDNCRequest";
- private static final String MESSAGE = "_MESSAGE";
- private static final String CORRELATOR = "_CORRELATOR";
- protected static final String IS_CALLBACK_COMPLETED = "isCallbackCompleted";
- protected static final String SDNC_SUCCESS = "200";
-
- @Autowired
- private ExceptionBuilder exceptionBuilder;
-
- @Autowired
- private SDNCClient sdncClient;
-
- public void createCorrelationVariables (DelegateExecution execution) {
- SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
- execution.setVariable(request.getCorrelationName()+CORRELATOR, request.getCorrelationValue());
- execution.setVariable("sdncTimeout", request.getTimeOut());
- }
-
- public void callSDNC (DelegateExecution execution) {
- SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
- try {
- String response = sdncClient.post(request.getSDNCPayload(),request.getTopology());
- String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
- execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
- } catch(PathNotFoundException e) {
- logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Recieved invalid response from SDNC, unable to read message content.");
- } catch (MapperException e) {
- logger.error("Failed to map SDNC object to JSON prior to POST.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Failed to map SDNC object to JSON prior to POST.");
- } catch (BadResponseException e) {
- logger.error("Did not receive a successful response from SDNC.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
- } catch (HttpClientErrorException e){
- logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
- }
- }
-
- public void processCallback (DelegateExecution execution) {
- try {
- SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
- String asyncRequest = (String) execution.getVariable(request.getCorrelationName()+MESSAGE);
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(new InputSource(new StringReader(asyncRequest)));
-
- String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
- boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
- execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
- if(isCallbackCompleted) {
- String responseCode = getXmlElement(doc, "/input/response-code");
- String responseMessage = getXmlElement(doc, "/input/response-message");
- if(!SDNC_SUCCESS.equalsIgnoreCase(responseCode)) {
- throw new SDNCErrorResponseException(responseMessage);
- }
- }
- } catch (SDNCErrorResponseException e) {
- logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
- } catch (Exception e) {
- logger.error("Error procesing SDNC callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
- }
- }
-
- public void handleTimeOutException (DelegateExecution execution) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on SDNC Async-Response");
- }
-
- protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
- return "Y".equals(finalMessageIndicator);
- }
-
- protected String getXmlElement(Document doc, String exp) throws Exception {
- XPath xPath = XPathFactory.newInstance().newXPath();
- return xPath.evaluate(exp, doc);
- }
-
+
+ private static final Logger logger = LoggerFactory.getLogger(SDNCRequestTasks.class);
+
+ private static final String SDNC_REQUEST = "SDNCRequest";
+ private static final String MESSAGE = "_MESSAGE";
+ private static final String CORRELATOR = "_CORRELATOR";
+ protected static final String IS_CALLBACK_COMPLETED = "isCallbackCompleted";
+ protected static final String SDNC_SUCCESS = "200";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ public void createCorrelationVariables(DelegateExecution execution) {
+ SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
+ execution.setVariable(request.getCorrelationName() + CORRELATOR, request.getCorrelationValue());
+ execution.setVariable("sdncTimeout", request.getTimeOut());
+ }
+
+ public void callSDNC(DelegateExecution execution) {
+ SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
+ try {
+ String response = sdncClient.post(request.getSDNCPayload(), request.getTopology());
+ String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
+ execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
+ } catch (PathNotFoundException e) {
+ logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Recieved invalid response from SDNC, unable to read message content.");
+ } catch (MapperException e) {
+ logger.error("Failed to map SDNC object to JSON prior to POST.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Failed to map SDNC object to JSON prior to POST.");
+ } catch (BadResponseException e) {
+ logger.error("Did not receive a successful response from SDNC.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ } catch (HttpClientErrorException e) {
+ logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ }
+ }
+
+ public void processCallback(DelegateExecution execution) {
+ try {
+ SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
+ String asyncRequest = (String) execution.getVariable(request.getCorrelationName() + MESSAGE);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(new InputSource(new StringReader(asyncRequest)));
+
+ String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
+ boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
+ execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
+ if (isCallbackCompleted) {
+ String responseCode = getXmlElement(doc, "/input/response-code");
+ String responseMessage = getXmlElement(doc, "/input/response-message");
+ if (!SDNC_SUCCESS.equalsIgnoreCase(responseCode)) {
+ throw new SDNCErrorResponseException(responseMessage);
+ }
+ }
+ } catch (SDNCErrorResponseException e) {
+ logger.error("SDNC error response - " + e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ } catch (Exception e) {
+ logger.error("Error procesing SDNC callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
+ }
+ }
+
+ public void handleTimeOutException(DelegateExecution execution) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
+ "Error timed out waiting on SDNC Async-Response");
+ }
+
+ protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
+ return "Y".equals(finalMessageIndicator);
+ }
+
+ protected String getXmlElement(Document doc, String exp) throws Exception {
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ return xPath.evaluate(exp, doc);
+ }
+
}
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
index 340872593f..e9848d1646 100644
--- 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
@@ -51,85 +51,94 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCUnassignTasks {
- private static final Logger logger = LoggerFactory.getLogger(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;
+ private static final Logger logger = LoggerFactory.getLogger(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);
- RequestContext requestContext = gBBInput.getRequestContext();
- Customer customer = gBBInput.getCustomer();
- GenericResourceApiServiceOperationInformation req = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- public void unassignVfModule(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest); } 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- RequestContext requestContext = gBBInput.getRequestContext();
- Customer customer = gBBInput.getCustomer();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void unassignServiceInstance(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ RequestContext requestContext = gBBInput.getRequestContext();
+ Customer customer = gBBInput.getCustomer();
+ GenericResourceApiServiceOperationInformation req =
+ sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
- cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
- GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- SDNCRequest sdncRequest = new SDNCRequest();
- sdncRequest.setSDNCPayload(req);
- sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
+ public void unassignVfModule(BuildingBlockExecution execution) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericResourceApiVfModuleOperationInformation req =
+ sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } 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);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ RequestContext requestContext = gBBInput.getRequestContext();
+ Customer customer = gBBInput.getCustomer();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
+ cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network,
+ serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
index 3763fca34f..47855eaa6e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.validations;
import java.util.Optional;
import java.util.regex.Pattern;
-
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.validation.PreBuildingBlockValidator;
import org.onap.so.bpmn.common.validation.Skip;
@@ -37,34 +36,35 @@ import org.springframework.stereotype.Component;
@Skip
public class CloudRegionOrchestrationValidator implements PreBuildingBlockValidator {
- private static Logger logger = LoggerFactory.getLogger(CloudRegionOrchestrationValidator.class);
- private final Pattern pattern = Pattern.compile("(?:Activate|Assign|Create|Deactivate|Delete|Unassign|Update)(?:Network|Vnf|VfModule|VolumeGroup|FabricConfiguration)BB");
-
- @Autowired
- private ExceptionBuilder exceptionBuilder;
+ private static Logger logger = LoggerFactory.getLogger(CloudRegionOrchestrationValidator.class);
+ private final Pattern pattern = Pattern.compile(
+ "(?:Activate|Assign|Create|Deactivate|Delete|Unassign|Update)(?:Network|Vnf|VfModule|VolumeGroup|FabricConfiguration)BB");
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Override
+ public boolean shouldRunFor(String bbName) {
+ return pattern.matcher(bbName).find();
+ }
- @Override
- public boolean shouldRunFor(String bbName) {
- return pattern.matcher(bbName).find();
- }
-
- @Override
- public Optional<String> validate(BuildingBlockExecution execution) {
- String msg = null;
- try {
- CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
- if (Boolean.TRUE.equals(cloudRegion.getOrchestrationDisabled())) {
- msg = String.format("Error: The request has failed due to orchestration currently disabled for the target cloud region %s for cloud owner %s",
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getCloudOwner());
- logger.error(msg);
- return Optional.ofNullable(msg);
- }
- }
- catch(Exception e) {
- logger.error("failed to validate", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
- }
- return Optional.empty();
- }
+ @Override
+ public Optional<String> validate(BuildingBlockExecution execution) {
+ String msg = null;
+ try {
+ CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
+ if (Boolean.TRUE.equals(cloudRegion.getOrchestrationDisabled())) {
+ msg = String.format(
+ "Error: The request has failed due to orchestration currently disabled for the target cloud region %s for cloud owner %s",
+ cloudRegion.getLcpCloudRegionId(), cloudRegion.getCloudOwner());
+ logger.error(msg);
+ return Optional.ofNullable(msg);
+ }
+ } catch (Exception e) {
+ logger.error("failed to validate", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ return Optional.empty();
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
index ec2ccdf202..e809ecd0ae 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
@@ -22,7 +22,6 @@ 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.BuildingBlockExecution;
@@ -40,41 +39,39 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class FlowCompletionTasks {
- private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class);
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+
+ public void updateRequestDbStatus(BuildingBlockExecution execution) {
+ try {
+ String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ if (workflowException == null) {
+ request.setStatusMessage("RequestCompletedSuccessfully");
+ request.setRequestStatus("COMPLETE");
+
+ } else {
+ request.setStatusMessage(workflowException.getErrorMessage());
+ request.setRequestStatus("FAILED");
+ }
+ request.setProgress(100L);
+ request.setLastModifiedBy("CamundaBPMN");
+
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Unable to save the updated request status to the DB", e);
+ }
+ }
+
- @Autowired
- private RequestsDbClient requestDbclient;
-
- public void updateRequestDbStatus(BuildingBlockExecution execution) {
- try {
- String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
-
- WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- if (workflowException == null) {
- request.setStatusMessage("RequestCompletedSuccessfully");
- request.setRequestStatus("COMPLETE");
-
- }
- else {
- request.setStatusMessage(workflowException.getErrorMessage());
- request.setRequestStatus("FAILED");
- }
- request.setProgress(100L);
- request.setLastModifiedBy("CamundaBPMN");
-
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Unable to save the updated request status to the DB",e);
- }
- }
-
-
}
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
index bbfc01921c..4fcacb3c42 100644
--- 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
@@ -42,124 +42,158 @@ import org.springframework.stereotype.Component;
@Component
public class OrchestrationStatusValidator {
- private static final Logger logger = LoggerFactory.getLogger(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";
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
-
-
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
- @Autowired
- private ExceptionBuilder exceptionBuilder;
- @Autowired
- private CatalogDbClient catalogDbClient;
-
- public void validateOrchestrationStatus(BuildingBlockExecution execution) {
- try {
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult = execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
-
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
-
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
-
- String buildingBlockFlowName = execution.getFlowToBeCalled();
-
- 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);
- orchestrationStatus = serviceInstance.getOrchestrationStatus();
- break;
- case VNF:
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, 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);
- orchestrationStatus = vfModule.getOrchestrationStatus();
- break;
- case VOLUME_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- orchestrationStatus = volumeGroup.getOrchestrationStatus();
- break;
- case NETWORK:
- org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, 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);
- 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);
- orchestrationStatus = configuration.getOrchestrationStatus();
- break;
- case INSTANCE_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- orchestrationStatus = instanceGroup.getOrchestrationStatus();
- break;
- case NO_VALIDATE:
- //short circuit and exit method
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
- return;
- 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(aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) &&
- OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, previousOrchestrationStatusValidationResult,
- genericVnf, orchestrationStatusStateTransitionDirective);
- }
-
- 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(BBObjectNotFoundException ex){
- if(execution.getFlowToBeCalled().contains("Unassign")){
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- }else{
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }catch (Exception e) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
- }
- }
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(BuildingBlockExecution execution, OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf, OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult.equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
+ private static final Logger logger = LoggerFactory.getLogger(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";
+ private static final String ALACARTE = "aLaCarte";
+ private static final String MULTI_STAGE_DESIGN_OFF = "false";
+ private static final String MULTI_STAGE_DESIGN_ON = "true";
+
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ public void validateOrchestrationStatus(BuildingBlockExecution execution) {
+ try {
+ OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
+ execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
+
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
+
+ boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
+
+ String buildingBlockFlowName = execution.getFlowToBeCalled();
+
+ 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);
+ orchestrationStatus = serviceInstance.getOrchestrationStatus();
+ break;
+ case VNF:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
+ extractPojosForBB.extractByKey(execution, 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);
+ orchestrationStatus = vfModule.getOrchestrationStatus();
+ break;
+ case VOLUME_GROUP:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
+ extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ orchestrationStatus = volumeGroup.getOrchestrationStatus();
+ break;
+ case NETWORK:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network =
+ extractPojosForBB.extractByKey(execution, 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);
+ 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);
+ orchestrationStatus = configuration.getOrchestrationStatus();
+ break;
+ case INSTANCE_GROUP:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup =
+ extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ orchestrationStatus = instanceGroup.getOrchestrationStatus();
+ break;
+ case NO_VALIDATE:
+ // short circuit and exit method
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
+ return;
+ 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 (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
+ && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
+ && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
+ extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
+ previousOrchestrationStatusValidationResult, genericVnf,
+ orchestrationStatusStateTransitionDirective);
+ }
+
+ 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 (BBObjectNotFoundException ex) {
+ if (execution.getFlowToBeCalled().contains("Unassign")) {
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ } catch (Exception e) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ }
+
+ private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
+ BuildingBlockExecution execution,
+ OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
+ if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
+ .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
+ String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
+ if (genericVnf.getModelInfoGenericVnf() != null) {
+ multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
+ }
+ if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ }
+ }
+ return orchestrationStatusStateTransitionDirective;
+ }
}
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
index 03559afb33..447f8994db 100644
--- 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
@@ -22,67 +22,82 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
public class Resource {
- private String resourceId;
- private WorkflowType resourceType;
- private boolean generated;
- private boolean baseVfModule;
- private String virtualLinkKey;
- private String vnfCustomizationId;
- private String vfModuleCustomizationId;
- private String cvnfModuleCustomizationId;
-
- 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;
- }
- public String getVirtualLinkKey() {
- return virtualLinkKey;
- }
- public void setVirtualLinkKey(String virtualLinkKey) {
- this.virtualLinkKey = virtualLinkKey;
- }
- public String getVnfCustomizationId() {
- return vnfCustomizationId;
- }
- public void setVnfCustomizationId(String vnfCustomizationId) {
- this.vnfCustomizationId = vnfCustomizationId;
- }
- public String getVfModuleCustomizationId() {
- return vfModuleCustomizationId;
- }
- public void setVfModuleCustomizationId(String vfModuleCustomizationId) {
- this.vfModuleCustomizationId = vfModuleCustomizationId;
- }
- public String getCvnfModuleCustomizationId() {
- return cvnfModuleCustomizationId;
- }
- public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
- this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
- }
+ private String resourceId;
+ private WorkflowType resourceType;
+ private boolean generated;
+ private boolean baseVfModule;
+ private String virtualLinkKey;
+ private String vnfCustomizationId;
+ private String vfModuleCustomizationId;
+ private String cvnfModuleCustomizationId;
+
+ 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;
+ }
+
+ public String getVirtualLinkKey() {
+ return virtualLinkKey;
+ }
+
+ public void setVirtualLinkKey(String virtualLinkKey) {
+ this.virtualLinkKey = virtualLinkKey;
+ }
+
+ public String getVnfCustomizationId() {
+ return vnfCustomizationId;
+ }
+
+ public void setVnfCustomizationId(String vnfCustomizationId) {
+ this.vnfCustomizationId = vnfCustomizationId;
+ }
+
+ public String getVfModuleCustomizationId() {
+ return vfModuleCustomizationId;
+ }
+
+ public void setVfModuleCustomizationId(String vfModuleCustomizationId) {
+ this.vfModuleCustomizationId = vfModuleCustomizationId;
+ }
+
+ public String getCvnfModuleCustomizationId() {
+ return cvnfModuleCustomizationId;
+ }
+
+ public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
+ this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
+ }
}
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
index 7562bd964e..2fc301f9d7 100644
--- 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
@@ -33,7 +33,6 @@ 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.slf4j.LoggerFactory;
@@ -82,1184 +81,1306 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowAction {
- private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
- private static final String SERVICE_INSTANCES = "serviceInstances";
- private static final String VF_MODULES = "vfModules";
- private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI.";
- 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 CONFIGURATION = "Configuration";
- 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|instanceGroups";
- private static final String HOMINGSOLUTION = "Homing_Solution";
- private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
- private static final String G_SERVICE_TYPE = "serviceType";
- private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
- private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
-
- @Autowired
- protected BBInputSetup bbInputSetup;
- @Autowired
- protected BBInputSetupUtils bbInputSetupUtils;
- @Autowired
- private ExceptionBuilder exceptionBuilder;
- @Autowired
- private CatalogDbClient catalogDbClient;
- @Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private WorkflowActionExtractResourcesAAI workflowActionUtils;
+ private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
+ private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String VF_MODULES = "vfModules";
+ private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI =
+ "WorkflowAction was unable to verify if the instance name already exist in AAI.";
+ 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 CONFIGURATION = "Configuration";
+ 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|instanceGroups";
+ private static final String HOMINGSOLUTION = "Homing_Solution";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String G_SERVICE_TYPE = "serviceType";
+ private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
+
+ @Autowired
+ protected BBInputSetup bbInputSetup;
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private WorkflowActionExtractResourcesAAI workflowActionUtils;
+
+ @Autowired
+ private Environment environment;
+ private String defaultCloudOwner = "org.onap.so.cloud-owner";
+
+ 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);
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+
+ 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();
+ String cloudOwner = "";
+ try {
+ cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
+ } catch (Exception ex) {
+ cloudOwner = environment.getProperty(defaultCloudOwner);
+ }
+ boolean suppressRollback = false;
+ try {
+ suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
+ } catch (Exception ex) {
+ suppressRollback = false;
+ }
+ execution.setVariable("suppressRollback", suppressRollback);
+ Resource resource = extractResourceIdAndTypeFromUri(uri);
+ WorkflowType resourceType = resource.getResourceType();
+ execution.setVariable("resourceName", resourceType.toString());
+ String resourceId = "";
+ if (resource.isGenerated()) {
+ resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
+ sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
+ workflowResourceIds);
+ } else {
+ resourceId = resource.getResourceId();
+ }
+ if ((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE) {
+ serviceInstanceId = resourceId;
+ }
+ execution.setVariable("resourceId", resourceId);
+ execution.setVariable("resourceType", resourceType);
+
+ if (aLaCarte) {
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ cloudOwner, serviceType);
+ }
+ String key = "";
+ ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
+ if (modelInfo != null) {
+ if (modelInfo.getModelType().equals(ModelType.service)) {
+ key = modelInfo.getModelVersionId();
+ } else {
+ key = modelInfo.getModelCustomizationId();
+ }
+ }
+ boolean isConfiguration = isConfiguration(orchFlows);
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows,
+ requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
+ workflowResourceIds, requestDetails, execution);
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+ orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
+ resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
+ null, 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")
+ || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
+ // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
+ // SERVICE-MACRO-DELETE
+ // Will never get user params with service, macro will have
+ // to query the SI in AAI to find related instances.
+ traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ } else if (resourceType == WorkflowType.SERVICE
+ && requestAction.equalsIgnoreCase("deactivateInstance")) {
+ resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
+ } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance")
+ || (requestAction.equalsIgnoreCase("recreateInstance")))) {
+ traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
+ workflowResourceIds.getVnfId(), aaiResourceIds);
+ } 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() + " ";
+ }
+ logger.info("Found {}", foundObjects);
+
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ cloudOwner, serviceType);
+ }
+ 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()) {
+ logger.info("Sorting for Vlan Tagging");
+ flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
+ }
+ // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
+ if (resourceType == WorkflowType.SERVICE
+ && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
+ && !resourceCounter.stream().filter(x -> WorkflowType.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, serviceInstanceId);
+ } else {
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds,
+ serviceInstanceId);
+ }
+ }
+
+ // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified,
+ // enable it.
+ if (sIRequest.getRequestDetails().getRequestParameters() != null
+ && sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams =
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(HOMINGSOLUTION)) {
+ if (params.get(HOMINGSOLUTION).equals("none")) {
+ execution.setVariable("homing", false);
+ } else {
+ execution.setVariable("homing", true);
+ }
+ }
+ }
+ }
+
+ if (flowsToExecute.isEmpty()) {
+ throw new IllegalStateException("Macro did not come up with a valid execution path.");
+ }
+ List<String> flowNames = new ArrayList<>();
+ logger.info("List of BuildingBlocks to execute:");
+ for (ExecuteBuildingBlock ebb : flowsToExecute) {
+ logger.info(ebb.getBuildingBlock().getBpmnFlowName());
+ flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
+ }
+ execution.setVariable("flowNames", flowNames);
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable("retryCount", 0);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("isRollbackComplete", false);
+
+ } catch (Exception ex) {
+ buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
+ }
+ }
+
+ protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
+ AAIObjectType type) {
+ List<T> vnfcs = new ArrayList<>();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
+ Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for vfModule in AAI");
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
+ for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
+ Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
+ if (vnfcOp.isPresent()) {
+ vnfcs.add(vnfcOp.get());
+ }
+ }
+ }
+ return vnfcs;
+ }
+
+ protected <T> List<T> getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) {
+
+ List<T> configurations = new ArrayList<>();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+ AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
+ Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for VNFC in AAI");
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> configurationResultWrappers =
+ this.getResultWrappersFromRelationships(relationships, type);
+ for (AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
+ Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
+ if (configurationOp.isPresent()) {
+ configurations.add(configurationOp.get());
+ }
+ }
+ }
+ return configurations;
+ }
+
+ protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships,
+ AAIObjectType type) {
+ return relationships.getByType(type);
+ }
- @Autowired
- private Environment environment;
- private String defaultCloudOwner = "org.onap.so.cloud-owner";
+ protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
+ for (OrchestrationFlow flow : orchFlows) {
+ if (flow.getFlowName().contains("Configuration")) {
+ return true;
+ }
+ }
+ return false;
+ }
- public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
- this.bbInputSetupUtils = bbInputSetupUtils;
- }
+ protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest,
+ List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey, String apiVersion,
+ String resourceId, String requestAction, boolean aLaCarte, String vnfType,
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
- public void setBbInputSetup(BBInputSetup bbInputSetup) {
- this.bbInputSetup = bbInputSetup;
- }
+ List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
+ List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
+ result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+ String vnfId = workflowResourceIds.getVnfId();
+ String vfModuleId = workflowResourceIds.getVfModuleId();
- 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);
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID =
+ bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
- 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);
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
+ org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
+ for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
+ List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVnfc(vnfc,
+ org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ if (configurations.size() > 1) {
+ String multipleRelationshipsError =
+ "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
+ buildAndThrowException(execution, multipleRelationshipsError,
+ new Exception(multipleRelationshipsError));
+ }
+ for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
+ workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
+ for (OrchestrationFlow orchFlow : result) {
+ resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ resourceKey.setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
+ resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
+ resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
+ null, true);
+ String vnfcName = getVnfcNameForConfiguration(configuration);
+ if (vnfcName == null || vnfcName.isEmpty()) {
+ buildAndThrowException(execution, "Exception in create execution list "
+ + ": VnfcName does not exist or is null while there is a configuration for the vfModule",
+ new Exception("Vnfc and Configuration do not match"));
+ }
+ ebb.getConfigurationResourceKeys().setVnfcName(vnfcName);
+ flowsToExecuteConfigs.add(ebb);
+ }
+ }
+ }
+ return flowsToExecuteConfigs;
+ }
- try {
- ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(G_ISTOPLEVELFLOW, true);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
- String cloudOwner = "";
- try{
- cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
- } catch (Exception ex) {
- cloudOwner = environment.getProperty(defaultCloudOwner);
- }
- boolean suppressRollback = false;
- try{
- suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
- } catch (Exception ex) {
- suppressRollback = false;
- }
- execution.setVariable("suppressRollback", suppressRollback);
- Resource resource = extractResourceIdAndTypeFromUri(uri);
- WorkflowType resourceType = resource.getResourceType();
- execution.setVariable("resourceName", resourceType.toString());
- String resourceId = "";
- if (resource.isGenerated()) {
- resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
- sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
- workflowResourceIds);
- } else {
- resourceId = resource.getResourceId();
- }
- if((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE){
- serviceInstanceId = resourceId;
- }
- execution.setVariable("resourceId", resourceId);
- execution.setVariable("resourceType", resourceType);
+ protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
+ Optional<Relationships> relationshipsOp = wrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for Configuration in AAI");
+ return null;
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
+ if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
+ }
+ Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
+ if (vnfcOp.isPresent()) {
+ return vnfcOp.get().getVnfcName();
+ } else {
+ return null;
+ }
+ }
+ }
- if (aLaCarte) {
- if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
- }
- String key = "";
- ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
- if(modelInfo != null) {
- if(modelInfo.getModelType().equals(ModelType.service)) {
- key = modelInfo.getModelVersionId();
- } else {
- key = modelInfo.getModelCustomizationId();
- }
- }
- boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
- if(isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows, requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
- workflowResourceIds, requestDetails, execution);
- flowsToExecute.addAll(configBuildingBlocks);
- }
- orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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.
+ 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;
+ }
- 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")
- || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
- // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
- // SERVICE-MACRO-DELETE
- // Will never get user params with service, macro will have
- // to query the SI in AAI to find related instances.
- traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
- } else if (resourceType == WorkflowType.SERVICE
- && requestAction.equalsIgnoreCase("deactivateInstance")) {
- resourceCounter.add(new Resource(WorkflowType.SERVICE,"",false));
- } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance") || (requestAction.equalsIgnoreCase("recreateInstance")))) {
- traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds);
- } 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() + " ";
- }
- logger.info("Found {}", foundObjects);
+ protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
+ int count = 0;
+ for (Resource resource : vfModuleResources) {
+ if (resource.isBaseVfModule()) {
+ Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count);
+ break;
+ }
+ count++;
+ }
+ return vfModuleResources;
+ }
- if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
- }
- 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()) {
- logger.info("Sorting for Vlan Tagging");
- flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
- }
- // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
- if (resourceType == WorkflowType.SERVICE
- && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> WorkflowType.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, serviceInstanceId);
- }else{
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds, serviceInstanceId);
- }
- }
+ private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
+ for (Pair<WorkflowType, String> pair : aaiResourceIds) {
+ logger.debug(pair.getValue0() + ", " + pair.getValue1());
+ }
- // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it.
- if (sIRequest.getRequestDetails().getRequestParameters() != null &&
- sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> params : userParams) {
- if (params.containsKey(HOMINGSOLUTION)) {
- if (params.get(HOMINGSOLUTION).equals("none")) {
- execution.setVariable("homing", false);
- } else {
- execution.setVariable("homing", true);
- }
- }
- }
- }
+ 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), null, serviceInstanceId);
+ }
+ });
+ }
- if (flowsToExecute.isEmpty()) {
- throw new IllegalStateException("Macro did not come up with a valid execution path.");
- }
- List<String> flowNames = new ArrayList<>();
- logger.info("List of BuildingBlocks to execute:");
- for (ExecuteBuildingBlock ebb : flowsToExecute) {
- logger.info(ebb.getBuildingBlock().getBpmnFlowName());
- flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
- }
- execution.setVariable("flowNames", flowNames);
- execution.setVariable(G_CURRENT_SEQUENCE, 0);
- execution.setVariable("retryCount", 0);
- execution.setVariable("isRollback", false);
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("isRollbackComplete", false);
+ 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;
+ }
- } catch (Exception ex) {
- buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
- }
- }
-
- protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) {
- List<T> vnfcs = new ArrayList<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
- Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for vfModule in AAI");
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
- for(AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
- Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
- if(vnfcOp.isPresent()) {
- vnfcs.add(vnfcOp.get());
- }
- }
- }
- return vnfcs;
- }
-
- protected <T> List<T> getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) {
-
- List<T> configurations = new ArrayList<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
- AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
- Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for VNFC in AAI");
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> configurationResultWrappers = this.getResultWrappersFromRelationships(relationships, type);
- for(AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
- Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
- if(configurationOp.isPresent()) {
- configurations.add(configurationOp.get());
- }
- }
- }
- return configurations;
- }
-
- protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships, AAIObjectType type){
- return relationships.getByType(type);
- }
-
- protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
- for(OrchestrationFlow flow : orchFlows) {
- if(flow.getFlowName().contains("Configuration")) {
- return true;
- }
- }
- return false;
- }
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter,
+ String serviceInstanceId) {
+ 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++) {
+ Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
+ .collect(Collectors.toList()).get(i);
+ updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
+ resource.getVirtualLinkKey(), serviceInstanceId);
+ }
+ });
+ }
- protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey,
- String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
-
- List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
- List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
- result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- String vnfId = workflowResourceIds.getVnfId();
- String vfModuleId = workflowResourceIds.getVfModuleId();
-
- String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
- String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource,
+ String key, String id, String virtualLinkKey, String serviceInstanceId) {
+ 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();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ 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);
+ } else if (resource == WorkflowType.CONFIGURATION) {
+ workflowResourceIds.setConfigurationId(resourceId);
+ }
+ ebb.setWorkflowResourceIds(workflowResourceIds);
+ }
+ if (virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
+ && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ workflowResourceIds.setNetworkId(resourceId);
+ ebb.setWorkflowResourceIds(workflowResourceIds);
+ }
+ }
+ }
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
- for(org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
- List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- if (configurations.size() > 1){
- String multipleRelationshipsError = "Multiple relationships exist from VNFC "+vnfc.getVnfcName()+" to Configurations";
- buildAndThrowException(execution, multipleRelationshipsError, new Exception(multipleRelationshipsError));
- }
- for(org.onap.aai.domain.yang.Configuration configuration : configurations) {
- workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
- for(OrchestrationFlow orchFlow : result) {
- resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
- resourceKey.setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
- resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true);
- String vnfcName = getVnfcNameForConfiguration(configuration);
- if(vnfcName == null || vnfcName.isEmpty()) {
- buildAndThrowException(execution, "Exception in create execution list " + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match"));
- }
- ebb.getConfigurationResourceKeys().setVnfcName(vnfcName);
- flowsToExecuteConfigs.add(ebb);
- }
- }
- }
- return flowsToExecuteConfigs;
- }
-
- protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
- AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
- Optional<Relationships> relationshipsOp = wrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for Configuration in AAI");
- return null;
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if(vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
- logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
- }
- Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
- if(vnfcOp.isPresent()) {
- return vnfcOp.get().getVnfcName();
- } else {
- return null;
- }
- }
- }
+ 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()) != null) {
+ 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 List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
- int count = 0;
- for(Resource resource : vfModuleResources){
- if(resource.isBaseVfModule()){
- Collections.swap(vfModuleResources, 0, count);
- break;
- }
- count++;
- }
- return vfModuleResources;
- }
-
- protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
- int count = 0;
- for(Resource resource : vfModuleResources){
- if(resource.isBaseVfModule()){
- Collections.swap(vfModuleResources, vfModuleResources.size()-1, count);
- break;
- }
- count++;
- }
- return vfModuleResources;
- }
+ 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()) {
+ logger.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));
+ logger.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;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization
+ .getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
+ break;
+ }
+ }
+ if (collectionInstCust != null
+ && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization()
+ .getModelCustomizationUUID().equalsIgnoreCase(
+ collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null && collectionInstCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceCounter.add(resource);
+ }
+ }
+ } else {
+ logger.debug(
+ "Instance Group tosca node type does not contain NetworkCollection: {}",
+ toscaNodeType);
+ }
+ } else {
+ logger.debug("No Instance Group found for network collection.");
+ }
+ } else {
+ logger.debug("No Network Collection found. collectionResource is null");
+ }
+ } else {
+ logger.debug("No Network Collection Customization found");
+ }
+ }
+ if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ .collect(Collectors.toList()).isEmpty()) {
+ if (service.getNetworkCustomizations() == null) {
+ logger.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");
+ }
+ }
+ }
- private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
- for(Pair<WorkflowType,String> pair : aaiResourceIds){
- logger.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), null, serviceInstanceId);
- }
- });
- }
+ 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) {
+ logger.debug("found networkcollection");
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION,
+ serviceInstanceMSO.getCollection().getId()));
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ serviceInstanceMSO.getCollection().getId(), false));
+ }
+ if (serviceInstanceMSO.getConfigurations() != null) {
+ for (Configuration config : serviceInstanceMSO.getConfigurations()) {
+ Optional<org.onap.aai.domain.yang.Configuration> aaiConfig =
+ aaiConfigurationResources.getConfiguration(config.getConfigurationId());
+ if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
+ for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
+ if (relationship.getRelatedTo().contains("vnfc")) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
+ config.getConfigurationId()));
+ resourceCounter.add(
+ new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
+ break;
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution,
+ "Could not find existing Service Instance or related Instances to execute the request on.");
+ }
+ }
- 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, String serviceInstanceId) {
- 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++){
- Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
- .collect(Collectors.toList()).get(i);
- updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey(),serviceInstanceId);
- }
- });
- }
-
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey, String serviceInstanceId){
- 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();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- 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);
- }else if(resource == WorkflowType.CONFIGURATION){
- workflowResourceIds.setConfigurationId(resourceId);
- }
- ebb.setWorkflowResourceIds(workflowResourceIds);
- }
- if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
- && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- workflowResourceIds.setNetworkId(resourceId);
- ebb.setWorkflowResourceIds(workflowResourceIds);
- }
- }
- }
+ private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId,
+ String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try {
+ ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
+ 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()) {
+ if (vnf.getVnfId().equals(vnfId)) {
+ 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));
+ findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(),
+ resourceCounter, aaiResourceIds);
+ }
+ }
+ 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));
+ }
+ }
+ break;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution,
+ "Could not find existing Vnf or related Instances to execute the request on.");
+ }
+ }
- 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()) != null) {
- 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()) {
- logger.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));
- logger.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;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) {
- if(collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if(collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}" , minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) {
- if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
- break;
- }
- }
- for (int i = 0; i < minNetworks; i++) {
- if(collectionNetworkResourceCust != null && collectionInstCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,collectionNetworkResourceCust.getModelCustomizationUUID(),false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceCounter.add(resource);
- }
- }
- } else {
- logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}" , toscaNodeType);
- }
- }else{
- logger.debug("No Instance Group found for network collection.");
- }
- }else{
- logger.debug("No Network Collection found. collectionResource is null");
- }
- } else {
- logger.debug("No Network Collection Customization found");
- }
- }
- if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) {
- if (service.getNetworkCustomizations() == null) {
- logger.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");
- }
- }
- }
+ private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId,
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try {
+ org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
+ AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule));
+ Optional<Relationships> relationshipsOp;
+ relationshipsOp = vfModuleWrapper.getRelationships();
+ if (relationshipsOp.isPresent()) {
+ relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get());
+ if (relationshipsOp.isPresent()) {
+ Optional<Configuration> config =
+ workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
+ if (config.isPresent()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
+ config.get().getConfigurationId()));
+ resourceCounter.add(
+ new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution, "Failed to find Configuration object from the vfModule.");
+ }
+ }
- 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) {
- logger.debug("found networkcollection");
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false));
- }
- if (serviceInstanceMSO.getConfigurations() !=null) {
- for(Configuration config : serviceInstanceMSO.getConfigurations()){
- Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId());
- if(aaiConfig.isPresent() && aaiConfig.get().getRelationshipList()!=null){
- for(Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()){
- if(relationship.getRelatedTo().contains("vnfc")){
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config.getConfigurationId(),false));
- break;
- }
- }
- }
- }
- }
- } 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;
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = "";
+ 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.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) {
+ vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid();
+ }
+ if (vnf.getVfModules() != null) {
+ for (VfModules vfModule : vnf.getVfModules()) {
+ VfModuleCustomization vfModuleCustomization =
+ catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(
+ vfModule.getModelInfo().getModelCustomizationUuid());
+ if (vfModuleCustomization != null) {
- private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId, String vnfId,
- List<Pair<WorkflowType, String>> aaiResourceIds) {
- try{
- ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
- 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()) {
- if(vnf.getVnfId().equals(vnfId)){
- 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));
- findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceCounter, aaiResourceIds);
- }
- }
- 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));
- }
- }
- break;
- }
- }
- }
- } catch (Exception ex) {
- buildAndThrowException(execution,
- "Could not find existing Vnf or related Instances to execute the request on.");
- }
- }
+ if (vfModuleCustomization.getVfModule() != null
+ && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null
+ && vfModuleCustomization.getVolumeHeatEnv() != null) {
+ resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,
+ vfModuleCustomization.getModelCustomizationUUID(), false));
+ foundRelated = true;
+ foundVfModuleOrVG = true;
+ }
- private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, List<Resource> resourceCounter,
- List<Pair<WorkflowType, String>> aaiResourceIds) {
- try{
- org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
- AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule));
- Optional<Relationships> relationshipsOp;
- relationshipsOp = vfModuleWrapper.getRelationships();
- if(relationshipsOp.isPresent()) {
- relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get());
- if(relationshipsOp.isPresent()){
- Optional<Configuration> config = workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
- if(config.isPresent()){
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
- }
- }
- }
- }catch (Exception ex){
- buildAndThrowException(execution,
- "Failed to find Configuration object from the vfModule.");
- }
- }
-
- protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter,
- ServiceInstancesRequest sIRequest, String requestAction)
- throws IOException {
- boolean foundRelated = false;
- boolean foundVfModuleOrVG = false;
- String vnfCustomizationUUID = "";
- String vfModuleCustomizationUUID = "";
- 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.getModelInfo()!=null && vnf.getModelInfo().getModelCustomizationUuid()!=null){
- vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid();
- }
- 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().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 (vfModule.getModelInfo() != null
+ && vfModule.getModelInfo().getModelCustomizationUuid() != null) {
+ vfModuleCustomizationUUID =
+ vfModule.getModelInfo().getModelCustomizationUuid();
+ }
+ if (!vnfCustomizationUUID.equals("")
+ && !vfModuleCustomizationUUID.equals("")) {
+ List<CvnfcConfigurationCustomization> configs =
+ traverseCatalogDbForConfiguration(
+ validate.getModelInfo().getModelVersionId(),
+ vnfCustomizationUUID, vfModuleCustomizationUUID);
+ for (CvnfcConfigurationCustomization config : configs) {
+ Resource configResource = new Resource(WorkflowType.CONFIGURATION,
+ config.getConfigurationResource().getModelUUID(), false);
+ resource.setVnfCustomizationId(
+ vnf.getModelInfo().getModelCustomizationId());
+ resource.setVfModuleCustomizationId(
+ vfModule.getModelInfo().getModelCustomizationId());
+ resourceCounter.add(configResource);
+ }
+ }
+ }
+ 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;
+ }
- if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) {
- resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false));
- foundRelated = true;
- foundVfModuleOrVG = true;
- }
+ protected List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID,
+ String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+ List<CvnfcConfigurationCustomization> configurations = new ArrayList<>();
+ try {
+ List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID,
+ vnfCustomizationUUID, vfModuleCustomizationUUID);
+ for (CvnfcCustomization cvnfc : cvnfcCustomizations) {
+ for (CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()) {
+ if (customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
+ configurations.add(customization);
+ }
+ }
+ }
+ logger.debug("found {} fabric configuration(s)", configurations.size());
+ return configurations;
+ } catch (Exception ex) {
+ logger.error("Error in finding configurations", ex);
+ return configurations;
+ }
+ }
- 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(vfModule.getModelInfo()!=null && vfModule.getModelInfo().getModelCustomizationUuid()!=null){
- vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid();
- }
- if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
- List<CvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration(validate.getModelInfo().getModelVersionId(),vnfCustomizationUUID,vfModuleCustomizationUUID);
- for(CvnfcConfigurationCustomization config : configs){
- Resource configResource = new Resource(WorkflowType.CONFIGURATION,config.getConfigurationResource().getModelUUID(),false);
- resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
- resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
- resourceCounter.add(configResource);
- }
- }
- }
- 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 List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID, String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
- List<CvnfcConfigurationCustomization> configurations = new ArrayList<>();
- try{
- List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID,vnfCustomizationUUID, vfModuleCustomizationUUID);
- for(CvnfcCustomization cvnfc : cvnfcCustomizations){
- for(CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()){
- if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){
- configurations.add(customization);
- }
- }
- }
- logger.debug("found {} fabric configuration(s)" , configurations.size() );
- return configurations;
- } catch (Exception ex){
- logger.error("Error in finding configurations", ex);
- return configurations;
- }
- }
+ 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"));
+ workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
+ return workflowResourceIds;
+ }
- 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 Resource extractResourceIdAndTypeFromUri(String uri) {
+ Pattern patt = Pattern.compile(
+ "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ Matcher m = patt.matcher(uri);
+ Boolean generated = false;
- 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"));
- workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
- return workflowResourceIds;
- }
+ if (m.find()) {
+ logger.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(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ } else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
+ 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 Resource extractResourceIdAndTypeFromUri(String uri) {
- Pattern patt = Pattern.compile(
- "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
- Matcher m = patt.matcher(uri);
- Boolean generated = false;
+ 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(vnf.getVnfId(),
+ vfModule.getVfModuleId(), instanceName);
+ if (volumeGroupFromVfModule.isPresent()) {
+ return volumeGroupFromVfModule.get().getVolumeGroupId();
+ }
+ }
+ }
+ }
+ return generatedResourceId;
+ } catch (Exception ex) {
+ logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex);
+ throw new IllegalStateException(
+ WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI);
+ }
+ }
- if (m.find()) {
- logger.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(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
- id = UUID.randomUUID().toString();
- generated = true;
- }else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
- 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 convertTypeFromPlural(String type) {
+ if (!type.matches(supportedTypes)) {
+ return type;
+ } else {
+ if (type.equals(SERVICE_INSTANCES)) {
+ return SERVICE;
+ } else {
+ return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1);
+ }
+ }
+ }
- 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(vnf.getVnfId(), vfModule.getVfModuleId(), instanceName);
- if (volumeGroupFromVfModule.isPresent()) {
- return volumeGroupFromVfModule.get().getVolumeGroupId();
- }
- }
- }
- }
- return generatedResourceId;
- } catch (Exception ex) {
- logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex);
- throw new IllegalStateException(
- WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI);
- }
- }
+ 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();
+ boolean isVirtualLink = Boolean.TRUE.equals(ebb.getBuildingBlock().getIsVirtualLink());
+ String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
+ sortedOrchFlows.add(ebb);
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ }
+ for (ExecuteBuildingBlock ebb2 : orchFlows) {
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
+ 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 String convertTypeFromPlural(String type) {
- if (!type.matches(supportedTypes)) {
- return type;
- } else {
- if (type.equals(SERVICE_INSTANCES)) {
- return SERVICE;
- } else {
- return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1);
- }
- }
- }
+ 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, false));
+ }
+ for (int i = 0; i < resourceCounter.stream()
+ .filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList())
+ .size(); i++) {
+ Resource resource =
+ resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
+ .collect(Collectors.toList()).get(i);
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true,
+ resource.getVirtualLinkKey(), false));
+ }
+ } else if (orchFlow.getFlowName().contains(VFMODULE)) {
+ List<Resource> vfModuleResourcesSorted = null;
+ if (requestAction.equals("createInstance") || requestAction.equals("assignInstance")
+ || requestAction.equals("activateInstance")) {
+ vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream()
+ .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
+ } else {
+ vfModuleResourcesSorted = sortVfModulesByBaseLast(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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, 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),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, false));
+ }
+ } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ for (int i = 0; i < resourceCounter.stream()
+ .filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList())
+ .size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId,
+ resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
+ .collect(Collectors.toList()).get(i),
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, true));
+ }
+ } else {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
+ }
+ }
+ return flowsToExecute;
+ }
- 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();
- boolean isVirtualLink = Boolean.TRUE.equals(ebb.getBuildingBlock().getIsVirtualLink());
- String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
- sortedOrchFlows.add(ebb);
- for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
- sortedOrchFlows.add(ebb2);
- break;
- }
- if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
- sortedOrchFlows.add(ebb2);
- break;
- }
- }
- for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
- && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
- sortedOrchFlows.add(ebb2);
- break;
- }
- if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
- && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
- 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 ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId,
+ Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte,
+ String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
+ boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ if (resource == null) {
+ buildingBlock.setKey("");
+ } else {
+ buildingBlock.setKey(resource.getResourceId());
+ }
+ buildingBlock.setIsVirtualLink(isVirtualLink);
+ buildingBlock.setVirtualLinkKey(virtualLinkKey);
+ 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);
+ if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ if (resource != null) {
+ configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
+ configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
+ configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ }
+ executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
+ }
+ return executeBuildingBlock;
+ }
- 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
- }
- for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
- Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
- .collect(Collectors.toList()).get(i);
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false));
- }
- } else if (orchFlow.getFlowName().contains(VFMODULE)) {
- List<Resource> vfModuleResourcesSorted = null;
- if(requestAction.equals("createInstance")||requestAction.equals("assignInstance")||requestAction.equals("activateInstance")){
- vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
- .collect(Collectors.toList()));
- }else{
- vfModuleResourcesSorted = sortVfModulesByBaseLast(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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, 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), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
- }
- } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
- for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
- .collect(Collectors.toList()).get(i), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true));
- }
- }else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
- }
- }
- return flowsToExecute;
- }
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
+ return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
+ }
- protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource,
- String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) {
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
- buildingBlock.setMsoId(UUID.randomUUID().toString());
- if(resource == null){
- buildingBlock.setKey("");
- }else{
- buildingBlock.setKey(resource.getResourceId());
- }
- buildingBlock.setIsVirtualLink(isVirtualLink);
- buildingBlock.setVirtualLinkKey(virtualLinkKey);
- 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);
- if(resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))){
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- if (resource != null){
- configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
- configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
- configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
- }
- executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
- }
- return executeBuildingBlock;
- }
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
+ List<OrchestrationFlow> listToExecute = new ArrayList<>();
+ NorthBoundRequest northBoundRequest = null;
+ if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
+ northBoundRequest =
+ catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
+ requestAction, resourceName.toString(), aLaCarte, cloudOwner, serviceType);
+ } else {
+ northBoundRequest = catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(
+ requestAction, resourceName.toString(), aLaCarte, cloudOwner);
+ }
+ 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 List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
- WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
- return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
- }
-
- protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
- WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
- List<OrchestrationFlow> listToExecute = new ArrayList<>();
- NorthBoundRequest northBoundRequest = null;
- if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
- northBoundRequest = catalogDbClient
- .getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(requestAction,
- resourceName.toString(), aLaCarte, cloudOwner, serviceType);
- } else {
- northBoundRequest = catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(
- requestAction, resourceName.toString(), aLaCarte, cloudOwner);
- }
- 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) {
+ logger.error(msg, ex);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
- protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error(msg, ex);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ logger.error(msg);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
- protected void buildAndThrowException(DelegateExecution execution, String msg) {
- logger.error(msg);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- public void handleRuntimeException (DelegateExecution execution){
- StringBuilder wfeExpMsg = new StringBuilder("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();
- logger.error(runtimeErrorMessage);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage);
- } catch (Exception e){
- logger.error("Runtime error", e);
- //if runtime message was mulformed
- runtimeErrorMessage = "Runtime error";
- }
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, runtimeErrorMessage);
- }
+ public void handleRuntimeException(DelegateExecution execution) {
+ StringBuilder wfeExpMsg = new StringBuilder("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();
+ logger.error(runtimeErrorMessage);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage);
+ } catch (Exception e) {
+ logger.error("Runtime error", 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/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 1812e50328..4fc4d85b97 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException;
@@ -36,113 +35,115 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionBBFailure {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
- @Autowired
- private RequestsDbClient requestDbclient;
- @Autowired
- private WorkflowAction workflowAction;
-
- protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
- try {
- String requestId = (String) execution.getVariable("mso-request-id");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- String errorMsg = "";
- Optional<String> errorMsgOp = retrieveErrorMessage(execution);
- if(errorMsgOp.isPresent()){
- errorMsg = errorMsgOp.get();
- }else{
- errorMsg = "Failed to determine error message";
- }
- request.setStatusMessage(errorMsg);
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e);
- }
- }
-
- public void updateRequestStatusToFailed(DelegateExecution execution) {
- try {
- String requestId = (String) execution.getVariable("mso-request-id");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- String rollbackErrorMsg = "";
- String errorMsg = "";
- Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete");
- Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
- ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
- if(rollbackCompletedSuccessfully==null)
- rollbackCompletedSuccessfully = false;
-
- if(isRollbackFailure==null)
- isRollbackFailure = false;
-
- if(rollbackCompletedSuccessfully){
- rollbackErrorMsg = "Rollback has been completed successfully.";
- request.setRollbackStatusMessage(rollbackErrorMsg);
- execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
- }else if(isRollbackFailure){
- Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
- if(rollbackErrorMsgOp.isPresent()){
- rollbackErrorMsg = rollbackErrorMsgOp.get();
- }else{
- rollbackErrorMsg = "Failed to determine rollback error message.";
- }
- request.setRollbackStatusMessage(rollbackErrorMsg);
- execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
- }else{
- Optional<String> errorMsgOp = retrieveErrorMessage(execution);
- if(errorMsgOp.isPresent()){
- errorMsg = errorMsgOp.get();
- }else{
- errorMsg = "Failed to determine error message";
- }
- request.setStatusMessage(errorMsg);
- execution.setVariable("ErrorMessage", errorMsg);
- }
- if(ebb!=null && ebb.getBuildingBlock()!=null){
- String flowStatus = "";
- if(rollbackCompletedSuccessfully){
- flowStatus = "All Rollback flows have completed successfully";
- }else{
- flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
- }
- request.setFlowStatus(flowStatus);
- execution.setVariable("flowStatus", flowStatus);
- }
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ @Autowired
+ private WorkflowAction workflowAction;
+
+ protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = "";
+ Optional<String> errorMsgOp = retrieveErrorMessage(execution);
+ if (errorMsgOp.isPresent()) {
+ errorMsg = errorMsgOp.get();
+ } else {
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error(
+ "Failed to update Request db with the status message after retry or rollback has been initialized.",
+ e);
+ }
+ }
+
+ public void updateRequestStatusToFailed(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String rollbackErrorMsg = "";
+ String errorMsg = "";
+ Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete");
+ Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+ if (rollbackCompletedSuccessfully == null)
+ rollbackCompletedSuccessfully = false;
+
+ if (isRollbackFailure == null)
+ isRollbackFailure = false;
+
+ if (rollbackCompletedSuccessfully) {
+ rollbackErrorMsg = "Rollback has been completed successfully.";
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ } else if (isRollbackFailure) {
+ Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
+ if (rollbackErrorMsgOp.isPresent()) {
+ rollbackErrorMsg = rollbackErrorMsgOp.get();
+ } else {
+ rollbackErrorMsg = "Failed to determine rollback error message.";
+ }
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ } else {
+ Optional<String> errorMsgOp = retrieveErrorMessage(execution);
+ if (errorMsgOp.isPresent()) {
+ errorMsg = errorMsgOp.get();
+ } else {
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ execution.setVariable("ErrorMessage", errorMsg);
+ }
+ if (ebb != null && ebb.getBuildingBlock() != null) {
+ String flowStatus = "";
+ if (rollbackCompletedSuccessfully) {
+ flowStatus = "All Rollback flows have completed successfully";
+ } else {
+ flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
+ }
+ request.setFlowStatus(flowStatus);
+ execution.setVariable("flowStatus", flowStatus);
+ }
+
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("FAILED");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
+ }
+ }
+
+ private Optional<String> retrieveErrorMessage(DelegateExecution execution) {
+ String errorMsg = "";
+ try {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ if (exception != null && (exception.getErrorMessage() != null || !exception.getErrorMessage().equals(""))) {
+ errorMsg = exception.getErrorMessage();
+ }
+ if (errorMsg == null || errorMsg.equals("")) {
+ errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
+ }
+ return Optional.of(errorMsg);
+ } catch (Exception ex) {
+ logger.error("Failed to extract workflow exception from execution.", ex);
+ }
+ return Optional.empty();
+ }
- request.setProgress(Long.valueOf(100));
- request.setRequestStatus("FAILED");
- request.setLastModifiedBy("CamundaBPMN");
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
- }
- }
-
- private Optional<String> retrieveErrorMessage (DelegateExecution execution){
- String errorMsg = "";
- try {
- WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
- errorMsg = exception.getErrorMessage();
- }
- if(errorMsg == null || errorMsg.equals("")){
- errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
- }
- return Optional.of(errorMsg);
- } catch (Exception ex) {
- logger.error("Failed to extract workflow exception from execution.",ex);
- }
- return Optional.empty();
- }
-
- public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
- execution.setVariable("isRollbackComplete", true);
- updateRequestStatusToFailed(execution);
- }
+ public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
+ execution.setVariable("isRollbackComplete", true);
+ updateRequestStatusToFailed(execution);
+ }
- public void abortCallErrorHandling(DelegateExecution execution) {
- String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
- logger.error(msg);
- throw new BpmnError(msg);
- }
+ public void abortCallErrorHandling(DelegateExecution execution) {
+ String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
+ logger.error(msg);
+ throw new BpmnError(msg);
+ }
}
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
index a327f0670a..4514d24c54 100644
--- 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
@@ -24,9 +24,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-
import javax.persistence.EntityNotFoundException;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.Vnfc;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
@@ -49,382 +47,394 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
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 String RETRY_COUNT = "retryCount";
- private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
- private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
- private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
- protected String maxRetries = "mso.rainyDay.maxRetries";
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
+ 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 String RETRY_COUNT = "retryCount";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
+ private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ @Autowired
+ private WorkflowAction workflowAction;
+ @Autowired
+ private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
+ private Environment environment;
+ @Autowired
+ private BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ 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 updateFlowStatistics(DelegateExecution execution) {
+ try {
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ if (currentSequence > 1) {
+ InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
+ requestDbclient.updateInfraActiveRequests(request);
+ }
+ } catch (Exception ex) {
+ logger.warn(
+ "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
+ }
+ }
+
+ protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
+ ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
+ int completedBBs = currentSequence - 1;
+ int totalBBs = flowsToExecute.size();
+ int remainingBBs = totalBBs - completedBBs;
+ String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
+ nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
+ Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
+ request.setFlowStatus(statusMessage);
+ request.setProgress(percentProgress);
+ request.setLastModifiedBy("CamundaBPMN");
+ return request;
+ }
+
+ protected Long getPercentProgress(int completedBBs, int totalBBs) {
+ double ratio = (completedBBs / (totalBBs * 1.0));
+ int percentProgress = (int) (ratio * 95);
+ return new Long(percentProgress + 5);
+ }
+
+ protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
+ return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
+ + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
+ + ").";
+ }
+
+ 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);
+ logger.info("Successfully sent sync ack.");
+ updateInstanceId(execution);
+ }
+
+ 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) {
+ logger.error(" Sending Sync Error Activity Failed. {}", ex.getMessage(), ex);
+ }
+ }
+
+ public void updateRequestStatusToComplete(DelegateExecution execution) {
+ try {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ final String action = (String) execution.getVariable(G_ACTION);
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String resourceName = (String) execution.getVariable("resourceName");
+ String macroAction = "";
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ }
+ execution.setVariable("finalStatusMessage", macroAction);
+ Timestamp endTime = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTime);
+ request.setFlowStatus("Successfully completed all Building Blocks");
+ request.setStatusMessage(macroAction);
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("COMPLETE");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
+ }
+ }
+
+ public void checkRetryStatus(DelegateExecution execution) {
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String retryDuration = (String) execution.getVariable("RetryDuration");
+ int retryCount = (int) execution.getVariable(RETRY_COUNT);
+ int envMaxRetries;
+ try {
+ envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ } catch (Exception ex) {
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ envMaxRetries = 5;
+ }
+ int nextCount = retryCount + 1;
+ if (handlingCode.equals("Retry")) {
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+ try {
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ request.setRetryStatusMessage(
+ "Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
+ }
+ if (retryCount < envMaxRetries) {
+ int currSequence = (int) execution.getVariable("gCurrentSequence");
+ execution.setVariable("gCurrentSequence", currSequence - 1);
+ execution.setVariable(RETRY_COUNT, nextCount);
+ } else {
+ workflowAction.buildAndThrowException(execution,
+ "Exceeded maximum retries. Ending flow with status Abort");
+ }
+ } else {
+ execution.setVariable(RETRY_COUNT, 0);
+ }
+ }
+
+ /**
+ * Rollback will only handle Create/Activate/Assign Macro flows. Execute layer will rollback the flow its currently
+ * working on.
+ */
+ public void rollbackExecutionPath(DelegateExecution execution) {
+ if (!(boolean) execution.getVariable("isRollback")) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int listSize = flowsToExecute.size();
+ for (int i = listSize - 1; i >= 0; i--) {
+ if (i > currentSequence - 1) {
+ flowsToExecute.remove(i);
+ } else {
+ String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
+ if (flowName.contains("Assign")) {
+ flowName = "Unassign" + flowName.substring(6, 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());
+ } else {
+ continue;
+ }
+ flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
+ rollbackFlows.add(flowsToExecute.get(i));
+ }
+ }
- @Autowired
- private RequestsDbClient requestDbclient;
- @Autowired
- private WorkflowAction workflowAction;
- @Autowired
- private WorkflowActionBBFailure workflowActionBBFailure;
- @Autowired
- private Environment environment;
- @Autowired
- private BBInputSetupUtils bbInputSetupUtils;
- @Autowired
- private CatalogDbClient catalogDbClient;
-
- 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 updateFlowStatistics(DelegateExecution execution) {
- try{
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- if(currentSequence > 1) {
- InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
- requestDbclient.updateInfraActiveRequests(request);
- }
- }catch (Exception ex){
- logger.warn("Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
- }
- }
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
+ rollbackFlowsFiltered.addAll(rollbackFlows);
+ if (handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")) {
+ for (int i = 0; i < rollbackFlows.size(); i++) {
+ if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
+ rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ } else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
+ && handlingCode.equals("RollbackToCreated")) {
+ rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ }
+ }
+ }
- protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
- .getVariable("flowsToExecute");
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
- ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
- int completedBBs = currentSequence - 1;
- int totalBBs = flowsToExecute.size();
- int remainingBBs = totalBBs - completedBBs;
- String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
- nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
- Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
- request.setFlowStatus(statusMessage);
- request.setProgress(percentProgress);
- request.setLastModifiedBy("CamundaBPMN");
- return request;
- }
-
- protected Long getPercentProgress(int completedBBs, int totalBBs) {
- double ratio = (completedBBs / (totalBBs * 1.0));
- int percentProgress = (int) (ratio * 95);
- return new Long(percentProgress + 5);
- }
-
- protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
- return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
- + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
- + ").";
- }
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
- 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);
- logger.info("Successfully sent sync ack.");
- updateInstanceId(execution);
- }
+ if (rollbackFlows.isEmpty())
+ execution.setVariable("isRollbackNeeded", false);
+ else
+ execution.setVariable("isRollbackNeeded", true);
+ execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
+ execution.setVariable("handlingCode", "PreformingRollback");
+ execution.setVariable("isRollback", true);
+ execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable(RETRY_COUNT, 0);
+ } else {
+ workflowAction.buildAndThrowException(execution,
+ "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
+ }
+ }
- 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) {
- logger.error(" Sending Sync Error Activity Failed. {}" , ex.getMessage(), ex);
- }
- }
+ protected void updateInstanceId(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String resourceId = (String) execution.getVariable("resourceId");
+ WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ if (resourceType == WorkflowType.SERVICE) {
+ request.setServiceInstanceId(resourceId);
+ } else if (resourceType == WorkflowType.VNF) {
+ request.setVnfId(resourceId);
+ } else if (resourceType == WorkflowType.VFMODULE) {
+ request.setVfModuleId(resourceId);
+ } else if (resourceType == WorkflowType.VOLUMEGROUP) {
+ request.setVolumeGroupId(resourceId);
+ } else if (resourceType == WorkflowType.NETWORK) {
+ request.setNetworkId(resourceId);
+ } else if (resourceType == WorkflowType.CONFIGURATION) {
+ request.setConfigurationId(resourceId);
+ } else if (resourceType == WorkflowType.INSTANCE_GROUP) {
+ request.setInstanceGroupId(resourceId);
+ }
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception ex) {
+ workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
+ }
+ }
- public void updateRequestStatusToComplete(DelegateExecution execution) {
- try{
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- final String action = (String) execution.getVariable(G_ACTION);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- final String resourceName = (String) execution.getVariable("resourceName");
- String macroAction = "";
- if (aLaCarte) {
- macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
- } else {
- macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
- }
- execution.setVariable("finalStatusMessage", macroAction);
- Timestamp endTime = new Timestamp(System.currentTimeMillis());
- request.setEndTime(endTime);
- request.setFlowStatus("Successfully completed all Building Blocks");
- request.setStatusMessage(macroAction);
- request.setProgress(Long.valueOf(100));
- request.setRequestStatus("COMPLETE");
- request.setLastModifiedBy("CamundaBPMN");
- requestDbclient.updateInfraActiveRequests(request);
- }catch (Exception ex) {
- workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
- }
- }
+ public void postProcessingExecuteBB(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
+ String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if (bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
+ }
+ }
- public void checkRetryStatus(DelegateExecution execution) {
- String handlingCode = (String) execution.getVariable("handlingCode");
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- String retryDuration = (String) execution.getVariable("RetryDuration");
- int retryCount = (int) execution.getVariable(RETRY_COUNT);
- int envMaxRetries;
- try{
- envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
- } catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
- envMaxRetries = 5;
- }
- int nextCount = retryCount +1;
- if (handlingCode.equals("Retry")){
- workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
- try{
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- request.setRetryStatusMessage("Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration);
- requestDbclient.updateInfraActiveRequests(request);
- } catch(Exception ex){
- logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
- }
- if(retryCount<envMaxRetries){
- int currSequence = (int) execution.getVariable("gCurrentSequence");
- execution.setVariable("gCurrentSequence", currSequence-1);
- execution.setVariable(RETRY_COUNT, nextCount);
- }else{
- workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort");
- }
- }else{
- execution.setVariable(RETRY_COUNT, 0);
- }
- }
+ protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb,
+ List<ExecuteBuildingBlock> flowsToExecute) {
+ try {
+ String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
+ String vnfId = ebb.getWorkflowResourceIds().getVnfId();
+ String vfModuleId = ebb.getResourceId();
+ ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId);
+ String serviceModelUUID =
+ bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId();
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID =
+ bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ List<Vnfc> vnfcs =
+ workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
+ logger.debug("Vnfc Size: {}", vnfcs.size());
+ for (Vnfc vnfc : vnfcs) {
+ String modelCustomizationId = vnfc.getModelCustomizationId();
+ logger.debug("Processing Vnfc: {}", modelCustomizationId);
+ CvnfcConfigurationCustomization fabricConfig = catalogDbClient.getCvnfcCustomization(serviceModelUUID,
+ vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId);
+ if (fabricConfig != null && fabricConfig.getConfigurationResource() != null
+ && fabricConfig.getConfigurationResource().getToscaNodeType() != null
+ && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
+ String configurationId = UUID.randomUUID().toString();
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
+ configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
+ configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
+ configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
+ ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb,
+ configurationId, configurationResourceKeys);
+ ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb,
+ configurationId, configurationResourceKeys);
+ flowsToExecute.add(assignConfigBB);
+ flowsToExecute.add(activateConfigBB);
+ flowsToExecute.stream()
+ .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
+ executeBB.getBuildingBlock().getBpmnFlowName()));
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("completed", false);
+ } else {
+ logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ }
+ }
+ } catch (EntityNotFoundException e) {
+ logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
+ } catch (Exception e) {
+ String errorMessage = "Error occurred in post processing of Vf Module create";
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("WorkflowActionErrorMessage", errorMessage);
+ logger.error(errorMessage, e);
+ }
+ }
- /**
- * Rollback will only handle Create/Activate/Assign Macro flows. Execute
- * layer will rollback the flow its currently working on.
- */
- public void rollbackExecutionPath(DelegateExecution execution) {
- if(!(boolean)execution.getVariable("isRollback")){
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
- .getVariable("flowsToExecute");
- List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- int listSize = flowsToExecute.size();
- for (int i = listSize - 1; i >= 0; i--) {
- if (i > currentSequence - 1) {
- flowsToExecute.remove(i);
- } else {
- String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
- if (flowName.contains("Assign")) {
- flowName = "Unassign" + flowName.substring(6, 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());
- }else{
- continue;
- }
- flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
- rollbackFlows.add(flowsToExecute.get(i));
- }
- }
-
- String handlingCode = (String) execution.getVariable("handlingCode");
- List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
- rollbackFlowsFiltered.addAll(rollbackFlows);
- if(handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")){
- for(int i = 0; i<rollbackFlows.size(); i++){
- if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
- } else if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete") && handlingCode.equals("RollbackToCreated")) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
- }
- }
- }
-
- workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
-
- if (rollbackFlows.isEmpty())
- execution.setVariable("isRollbackNeeded", false);
- else
- execution.setVariable("isRollbackNeeded", true);
- execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
- execution.setVariable("handlingCode", "PreformingRollback");
- execution.setVariable("isRollback", true);
- execution.setVariable("gCurrentSequence", 0);
- execution.setVariable(RETRY_COUNT, 0);
- }else{
- workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
- }
- }
-
- protected void updateInstanceId(DelegateExecution execution){
- try{
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- String resourceId = (String) execution.getVariable("resourceId");
- WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- if(resourceType == WorkflowType.SERVICE){
- request.setServiceInstanceId(resourceId);
- }else if(resourceType == WorkflowType.VNF){
- request.setVnfId(resourceId);
- }else if(resourceType == WorkflowType.VFMODULE){
- request.setVfModuleId(resourceId);
- }else if(resourceType == WorkflowType.VOLUMEGROUP){
- request.setVolumeGroupId(resourceId);
- }else if(resourceType == WorkflowType.NETWORK){
- request.setNetworkId(resourceId);
- }else if(resourceType == WorkflowType.CONFIGURATION){
- request.setConfigurationId(resourceId);
- }else if(resourceType == WorkflowType.INSTANCE_GROUP){
- request.setInstanceGroupId(resourceId);
- }
- requestDbclient.updateInfraActiveRequests(request);
- }catch(Exception ex){
- workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
- }
- }
-
- public void postProcessingExecuteBB(DelegateExecution execution) {
- List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
- .getVariable("flowsToExecute");
- String handlingCode = (String) execution.getVariable("handlingCode");
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
- String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
- if(bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
- postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
- }
- }
-
- protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution,
- ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) {
- try {
- String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
- String vnfId = ebb.getWorkflowResourceIds().getVnfId();
- String vfModuleId = ebb.getResourceId();
- ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId);
- String serviceModelUUID = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId();
- String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
- String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
- List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
- logger.debug("Vnfc Size: {}", vnfcs.size());
- for(Vnfc vnfc : vnfcs) {
- String modelCustomizationId = vnfc.getModelCustomizationId();
- logger.debug("Processing Vnfc: {}", modelCustomizationId);
- CvnfcConfigurationCustomization fabricConfig =
- catalogDbClient.getCvnfcCustomization(serviceModelUUID,vnfCustomizationUUID,
- vfModuleCustomizationUUID, modelCustomizationId);
- if(fabricConfig != null && fabricConfig.getConfigurationResource() != null
- && fabricConfig.getConfigurationResource().getToscaNodeType() != null
- && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
- String configurationId = UUID.randomUUID().toString();
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
- configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
- configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
- configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
- ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
- ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
- flowsToExecute.add(assignConfigBB);
- flowsToExecute.add(activateConfigBB);
- flowsToExecute.stream().forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", executeBB.getBuildingBlock().getBpmnFlowName()));
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("completed", false);
- } else {
- logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
- }
- }
- } catch (EntityNotFoundException e) {
- logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
- } catch (Exception e) {
- String errorMessage = "Error occurred in post processing of Vf Module create";
- execution.setVariable("handlingCode", "RollbackToCreated");
- execution.setVariable("WorkflowActionErrorMessage", errorMessage);
- logger.error(errorMessage, e);
- }
- }
-
- protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb, String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
- ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName(bbName);
- buildingBlock.setMsoId(UUID.randomUUID().toString());
- configBB.setaLaCarte(ebb.isaLaCarte());
- configBB.setApiVersion(ebb.getApiVersion());
- configBB.setRequestAction(ebb.getRequestAction());
- configBB.setVnfType(ebb.getVnfType());
- configBB.setRequestId(ebb.getRequestId());
- configBB.setRequestDetails(ebb.getRequestDetails());
- configBB.setBuildingBlock(buildingBlock);
- WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
- workflowResourceIds.setConfigurationId(configurationId);
- configBB.setWorkflowResourceIds(workflowResourceIds);
- configBB.setConfigurationResourceKeys(configurationResourceKeys);
- return configBB;
- }
+ protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb,
+ String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
+ ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(bbName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ configBB.setaLaCarte(ebb.isaLaCarte());
+ configBB.setApiVersion(ebb.getApiVersion());
+ configBB.setRequestAction(ebb.getRequestAction());
+ configBB.setVnfType(ebb.getVnfType());
+ configBB.setRequestId(ebb.getRequestId());
+ configBB.setRequestDetails(ebb.getRequestDetails());
+ configBB.setBuildingBlock(buildingBlock);
+ WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
+ workflowResourceIds.setConfigurationId(configurationId);
+ configBB.setWorkflowResourceIds(workflowResourceIds);
+ configBB.setConfigurationResourceKeys(configurationResourceKeys);
+ return configBB;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
index 2b0f8bf946..99ae2e7495 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import java.util.Optional;
-
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -33,26 +32,26 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionExtractResourcesAAI {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
- public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
- List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
- for(AAIResultWrapper configWrapper : configurations) {
- Optional<Configuration> config = configWrapper.asBean(Configuration.class);
- if(config.isPresent()){
- return config;
- }
- }
- return Optional.empty();
- }
+ public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
+ List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
+ for (AAIResultWrapper configWrapper : configurations) {
+ Optional<Configuration> config = configWrapper.asBean(Configuration.class);
+ if (config.isPresent()) {
+ return config;
+ }
+ }
+ return Optional.empty();
+ }
- public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
- List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
- for(AAIResultWrapper vnfcWrapper : vnfcs){
- if(vnfcWrapper.getRelationships().isPresent()){
- return vnfcWrapper.getRelationships();
- }
- }
- return Optional.empty();
- }
+ public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
+ List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
+ for (AAIResultWrapper vnfcWrapper : vnfcs) {
+ if (vnfcWrapper.getRelationships().isPresent()) {
+ return vnfcWrapper.getRelationships();
+ }
+ }
+ return Optional.empty();
+ }
}
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
index 304b4000bd..af8f93b92b 100644
--- 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
@@ -22,33 +22,27 @@ 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"),
- INSTANCE_GROUP("InstanceGroup");
-
- 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;
- }
+ SERVICE("Service"), VNF("Vnf"), VFMODULE("VfModule"), VOLUMEGROUP("VolumeGroup"), NETWORK("Network"), VIRTUAL_LINK(
+ "VirtualLink"), NETWORKCOLLECTION(
+ "NetworkCollection"), CONFIGURATION("Configuration"), INSTANCE_GROUP("InstanceGroup");
+
+ 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
index c0f7b21a9e..adfeb5ac6a 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -39,38 +38,37 @@ import org.springframework.stereotype.Component;
@Component
public class SDNOHealthCheckTasks {
- private static final Logger logger = LoggerFactory.getLogger(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());
- }
- }
-
- response = sdnoHealthCheckResources.healthCheck(vnf, requestContext);
- }
- catch (Exception ex) {
- logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage());
- }
-
- if (!response) {
- logger.error("SDNO Health Check failed");
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SDNO Health Check failed");
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(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());
+ }
+ }
+
+ response = sdnoHealthCheckResources.healthCheck(vnf, requestContext);
+ } catch (Exception ex) {
+ logger.error("Exception occurred", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage());
+ }
+
+ if (!response) {
+ logger.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
index 518da1fa5f..06f6550d51 100644
--- 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
@@ -25,7 +25,6 @@ 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;
@@ -36,277 +35,287 @@ 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);
+ 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.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());
- map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
-
- }
- });
- }
-
- 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);
- }
-
- private 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 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());
+ map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
+
+ }
+ });
}
- };
- private 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());
+ 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);
+ }
- private 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.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());
+ }
+ });
}
- };
-
- 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());
- map().setConfigurationType(source.getModelInfoConfiguration().getConfigurationType());
- map().setConfigurationSubType(source.getModelInfoConfiguration().getConfigurationRole());
- map().setConfigPolicyName(source.getModelInfoConfiguration().getPolicyName());
- }
- });
- }
- 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().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID());
- map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction());
- map().setCollectionRole(source.getModelInfoCollection().getCollectionRole());
- map().setCollectionType(source.getModelInfoCollection().getCollectionType());
- map().setCollectionName(source.getName());
- }
- });
- }
- return modelMapper.map(networkCollection, org.onap.aai.domain.yang.Collection.class);
- }
+ 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);
+ }
+
+ private 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());
+ }
+ };
+
+ private 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());
+ }
+ };
+
+ private 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());
+ map().setConfigurationType(source.getModelInfoConfiguration().getConfigurationType());
+ map().setConfigurationSubType(source.getModelInfoConfiguration().getConfigurationRole());
+ map().setConfigPolicyName(source.getModelInfoConfiguration().getPolicyName());
+ }
+ });
+ }
+ 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().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID());
+ map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction());
+ map().setCollectionRole(source.getModelInfoCollection().getCollectionRole());
+ map().setCollectionType(source.getModelInfoCollection().getCollectionType());
+ 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);
- }
- }
-
- public org.onap.aai.domain.yang.Subnet mapSubnet (Subnet subnet){
- return modelMapper.map(subnet,org.onap.aai.domain.yang.Subnet.class);
- }
-
- public org.onap.aai.domain.yang.NetworkPolicy mapNetworkPolicy (NetworkPolicy networkPolicy){
- return modelMapper.map(networkPolicy,org.onap.aai.domain.yang.NetworkPolicy.class);
- }
+ 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);
+ }
+ }
+
+ public org.onap.aai.domain.yang.Subnet mapSubnet(Subnet subnet) {
+ return modelMapper.map(subnet, org.onap.aai.domain.yang.Subnet.class);
+ }
+
+ public org.onap.aai.domain.yang.NetworkPolicy mapNetworkPolicy(NetworkPolicy networkPolicy) {
+ return modelMapper.map(networkPolicy, org.onap.aai.domain.yang.NetworkPolicy.class);
+ }
}
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
index 350a6ae8d6..62d0c230fb 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.adapter.network;
import javax.ws.rs.core.Response;
-
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
@@ -33,25 +32,25 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
public interface NetworkAdapterClient {
- CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException;
+ CreateNetworkResponse createNetwork(CreateNetworkRequest req) throws NetworkAdapterClientException;
+
+ DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req)
+ throws NetworkAdapterClientException;
- DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req)
- throws NetworkAdapterClientException;
+ RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest 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;
- 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;
- UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req)
- throws NetworkAdapterClientException;
+ Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException;
- Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException;
+ Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException;
- Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException;
+ Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException;
- Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException;
-
- Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException;
+ Response updateNetworkAsync(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
index 0492477cf6..2712f1e6f7 100644
--- 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
@@ -23,13 +23,13 @@ package org.onap.so.client.adapter.network;
public class NetworkAdapterClientException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 8040736661096488110L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8040736661096488110L;
- public NetworkAdapterClientException(String message) {
- super(message);
- }
+ 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
index e8a5723e19..8668306f13 100644
--- 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
@@ -24,7 +24,6 @@ import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
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;
@@ -40,120 +39,126 @@ 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 Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException{
- try {
- return new AdapterRestClient(this.props, this.getUri("").build()).post(req);
- } 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 Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException {
- try {
- return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
- } 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 Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException {
- try {
- return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
- } 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());
- }
- }
-
- @Override
- public Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException{
- try {
- return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req);
- } catch (InternalServerErrorException e) {
- throw new NetworkAdapterClientException(e.getMessage());
- }
- }
-
- protected UriBuilder getUri(String path) {
- return UriBuilder.fromPath(path);
- }
+ 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 Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("").build()).post(req);
+ } 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 Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req)
+ throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
+ } 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 Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req)
+ throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
+ } 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());
+ }
+ }
+
+ @Override
+ public Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req)
+ throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req);
+ } 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
index 9888dd3be2..d35f810d2d 100644
--- 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
@@ -22,32 +22,32 @@ 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";
- }
+ 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
index 8c774d8677..4fee1f909b 100644
--- 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
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
-
import org.apache.commons.lang3.StringUtils;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
@@ -61,329 +60,353 @@ import org.springframework.web.util.UriUtils;
@Component
public class NetworkAdapterObjectMapper {
- private static final ModelMapper modelMapper = new ModelMapper();
- private static String FORWARD_SLASH = "/";
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class);
-
- 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);
- String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
- if(networkTechnology == null) {
- networkTechnology = l3Network.getNetworkTechnology();
- logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
- }
- if (networkTechnology != null) {
- createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase());
- if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) {
- createNetworkRequest.setContrailRequest(true);
- }
- }
-
- //build and set Contrail Network
- ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
- createNetworkRequest.setContrailNetwork(contrailNetwork);
-
- //set Network Parameters from VID request, add "shared" and "external" to this map
- createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
-
- createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
-
- createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
-
- String messageId = getRandomUuid();
- createNetworkRequest.setMessageId(messageId);
- 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());
- if (!StringUtils.isEmpty(l3Network.getHeatStackId())){
- deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
- }
- else {
- deleteNetworkRequest.setNetworkStackId(l3Network.getNetworkName());
- }
- deleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
- deleteNetworkRequest.setSkipAAI(true);
- deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
-
- deleteNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
-
- 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(addSharedAndExternal(userInput, l3Network));
- 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) throws UnsupportedEncodingException{
- request.setSkipAAI(true);
- String messageId = requestContext.getMsoRequestId();
- request.setMessageId(messageId);
- //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());
- map(source.getSubnetSequence(), destination.getSubnetSequence());
- }
- };
- 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);
- }
- if (subnet.getDhcpStart() != null && !subnet.getDhcpStart().equals("")) {
- org.onap.so.openstack.beans.Pool openstackAllocationPool = new org.onap.so.openstack.beans.Pool();
- openstackAllocationPool.setStart(subnet.getDhcpStart());
- openstackAllocationPool.setEnd(subnet.getDhcpEnd());
- List<org.onap.so.openstack.beans.Pool> allocationPools = new ArrayList<>();
- allocationPools.add(openstackAllocationPool);
- openstackSubnet.setAllocationPools(allocationPools);
- }
- 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(Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
- contrailNetwork.setShared(Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
- 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);
- createNetworkRequest.setBackout(Boolean.TRUE.equals(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);
- updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
- //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
- }
-
- private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
- if (userInput == null)
- userInput = new HashMap<String, String>();
- if (!userInput.containsKey("shared")) {
- userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
- }
- if (!userInput.containsKey("external")) {
- userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
- }
- return userInput;
- }
+ private static final ModelMapper modelMapper = new ModelMapper();
+ private static String FORWARD_SLASH = "/";
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class);
+
+ 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);
+ String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
+ if (networkTechnology == null) {
+ networkTechnology = l3Network.getNetworkTechnology();
+ logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
+ }
+ if (networkTechnology != null) {
+ createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase());
+ if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) {
+ createNetworkRequest.setContrailRequest(true);
+ }
+ }
+
+ // build and set Contrail Network
+ ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
+ createNetworkRequest.setContrailNetwork(contrailNetwork);
+
+ // set Network Parameters from VID request, add "shared" and "external" to this map
+ createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
+
+ createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
+
+ createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ createNetworkRequest.setMessageId(messageId);
+ 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());
+ if (!StringUtils.isEmpty(l3Network.getHeatStackId())) {
+ deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ } else {
+ deleteNetworkRequest.setNetworkStackId(l3Network.getNetworkName());
+ }
+ deleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
+ deleteNetworkRequest.setSkipAAI(true);
+ deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+
+ deleteNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+
+ 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(addSharedAndExternal(userInput, l3Network));
+ 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) throws UnsupportedEncodingException {
+ request.setSkipAAI(true);
+ String messageId = requestContext.getMsoRequestId();
+ request.setMessageId(messageId);
+ // 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());
+ map(source.getSubnetSequence(), destination.getSubnetSequence());
+ }
+ };
+ 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);
+ }
+ if (subnet.getDhcpStart() != null && !subnet.getDhcpStart().equals("")) {
+ org.onap.so.openstack.beans.Pool openstackAllocationPool = new org.onap.so.openstack.beans.Pool();
+ openstackAllocationPool.setStart(subnet.getDhcpStart());
+ openstackAllocationPool.setEnd(subnet.getDhcpEnd());
+ List<org.onap.so.openstack.beans.Pool> allocationPools = new ArrayList<>();
+ allocationPools.add(openstackAllocationPool);
+ openstackSubnet.setAllocationPools(allocationPools);
+ }
+ 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(Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
+ contrailNetwork.setShared(Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
+ 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);
+ createNetworkRequest.setBackout(Boolean.TRUE.equals(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);
+ updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
+ // NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
+ }
+
+ private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
+ if (userInput == null)
+ userInput = new HashMap<String, String>();
+ if (!userInput.containsKey("shared")) {
+ userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
+ }
+ if (!userInput.containsKey("external")) {
+ userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
+ }
+ return userInput;
+ }
}
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
index 13739faec2..2ab337037b 100644
--- 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
@@ -32,18 +32,18 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
public interface VnfAdapterClient {
- CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) throws VnfAdapterClientException;
+ CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) throws VnfAdapterClientException;
- RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req)
- throws VnfAdapterClientException;
+ RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req)
+ throws VnfAdapterClientException;
- DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req)
- throws VnfAdapterClientException;
+ DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req)
+ throws VnfAdapterClientException;
- UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest 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;
+ 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
index b4ad9ef055..9e58fa349b 100644
--- 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
@@ -22,13 +22,13 @@ package org.onap.so.client.adapter.vnf;
public class VnfAdapterClientException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = -7154784472485852602L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7154784472485852602L;
- public VnfAdapterClientException(String message) {
- super(message);
- }
+ 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
index 7b9a8c5312..e24e86285c 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -39,96 +38,96 @@ 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);
- }
+ 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
index 8302375c7e..51b1525a28 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,25 +29,26 @@ 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";
- }
+ 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
index 0626efbd03..f4e4ce8cb1 100644
--- 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
@@ -31,18 +31,18 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
public interface VnfVolumeAdapterClient {
- CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException;
+ CreateVolumeGroupResponse createVNFVolumes(CreateVolumeGroupRequest req) throws VnfAdapterClientException;
- DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req)
- throws VnfAdapterClientException;
+ DeleteVolumeGroupResponse deleteVNFVolumes(String aaiVolumeGroupId, DeleteVolumeGroupRequest req)
+ throws VnfAdapterClientException;
- RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req)
- throws VnfAdapterClientException;
+ RollbackVolumeGroupResponse rollbackVNFVolumes(String aaiVolumeGroupId, RollbackVolumeGroupRequest req)
+ throws VnfAdapterClientException;
- UpdateVolumeGroupResponse updateVNFVolumes(String aaiVolumeGroupId, UpdateVolumeGroupRequest 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;
+ 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
index 0e0fd3bb5d..2af4d5f1fa 100644
--- 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
@@ -23,7 +23,6 @@ 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;
@@ -40,81 +39,81 @@ import org.springframework.stereotype.Component;
@Component
public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
- private final VnfVolumeAdapterRestProperties props;
+ private final VnfVolumeAdapterRestProperties props;
- public VnfVolumeAdapterClientImpl() {
- this.props = new VnfVolumeAdapterRestProperties();
- }
+ 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 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 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 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 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());
- }
- }
+ @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 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 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);
- }
+ 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
index 80d064249b..1f774f5be7 100644
--- 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
@@ -22,36 +22,36 @@ 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";
- }
+ 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/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
index e93e216ea3..6daed56675 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
@@ -51,10 +51,7 @@ public class AttributeNameValue implements Serializable {
@Override
public String toString() {
- return new StringBuilder().append("{\"attribute_name\": \"")
- .append(attributeName.toString())
- .append("\", \"attribute_value\": \"")
- .append(attributeValue.toString())
- .append("\"}").toString();
+ return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName.toString())
+ .append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}").toString();
}
}
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
index 2559087619..a78870afc4 100644
--- 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
@@ -26,9 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import javax.annotation.PostConstruct;
-
import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -46,7 +44,6 @@ 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 com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -54,129 +51,143 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class VnfAdapterObjectMapper {
- private ObjectMapper mapper = new ObjectMapper();
-
- @PostConstruct
- public void init () {
- mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- }
-
- 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(Boolean.TRUE.equals(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());
- if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())){
- deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
- } else
- {
- deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
- }
-
- deleteVolumeGroupRequest.setSkipAAI(true);
- deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
-
- String messageId = getRandomUuid();
- deleteVolumeGroupRequest.setMessageId(messageId);
- deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
-
- return deleteVolumeGroupRequest;
- }
-
- public Map<String, Object> createVolumeGroupParams(RequestContext requestContext,GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
- Map<String, Object> volumeGroupParams = new HashMap<>();
- final String USER_PARAM_NAME_KEY = "name";
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @PostConstruct
+ public void init() {
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
+
+ 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(Boolean.TRUE.equals(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());
+ if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())) {
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ } else {
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
+ }
+
+ deleteVolumeGroupRequest.setSkipAAI(true);
+ deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
+
+ String messageId = getRandomUuid();
+ deleteVolumeGroupRequest.setMessageId(messageId);
+ deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
+
+ return deleteVolumeGroupRequest;
+ }
+
+ public Map<String, Object> createVolumeGroupParams(RequestContext requestContext, GenericVnf genericVnf,
+ VolumeGroup volumeGroup, String sdncVfModuleQueryResponse)
+ throws JsonParseException, JsonMappingException, IOException {
+ Map<String, Object> 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) {
- GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
- GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
- buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters());
- }
-
- if(null != requestContext.getRequestParameters() && null != requestContext.getRequestParameters().getUserParams()) {
+ // sdncVfModuleQueryResponse will not be available in aLaCarte case
+ if (sdncVfModuleQueryResponse != null) {
+ GenericResourceApiVfModuleTopology vfModuleTop =
+ mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
+ 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));
+ 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,Object> 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);
- }
-
-} \ No newline at end of file
+ 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, Object> 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
index 6b2d64f170..269484eadf 100644
--- 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
@@ -22,7 +22,6 @@ 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;
@@ -30,25 +29,25 @@ import org.springframework.web.util.UriUtils;
@Component("VnfAdapterObjectMapperUtils")
public class VnfAdapterObjectMapperUtils {
- public String getRandomUuid() {
- return UUID.randomUUID().toString();
- }
+ 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);
- }
- }
+ 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");
- }
+ return endpoint + "/" + UriUtils.encodePathSegment(messageType, "UTF-8") + "/"
+ + UriUtils.encodePathSegment(correlator, "UTF-8");
+ }
- protected String getProperty(String key) {
+ protected String getProperty(String key) {
- return UrnPropertiesReader.getVariable(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
index dc113e5abc..94e95687db 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.adapter.vnf.mapper;
import static java.util.Arrays.asList;
-
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@@ -33,9 +32,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import javax.annotation.PostConstruct;
-
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
@@ -82,7 +79,6 @@ import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -93,120 +89,128 @@ import 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 = "_";
-
- @PostConstruct
- public void init () {
- mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- }
-
- public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
- CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
-
- createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
- createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
- createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
- createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
- createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
- createVfModuleRequest.setVnfId(genericVnf.getVnfId());
- createVfModuleRequest.setVnfType(genericVnf.getVnfType());
- createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
- createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
- createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
- if (volumeGroup != null) {
- createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
- createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
- }
- VfModule baseVfModule = getBaseVfModule(genericVnf);
- if (baseVfModule != null) {
- createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId());
- createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId());
- }
- createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
-
- createVfModuleRequest.setSkipAAI(true);
- createVfModuleRequest.setBackout(Boolean.TRUE.equals(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,Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
-
-
- GenericResourceApiVnfTopology vnfTop= mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnfTopology.class);
- GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
- GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology();
- GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
- Map<String,Object> paramsMap = new HashMap<>();
-
- if( 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);
- }
-
- // build the sdnc_directives from paramsMap
- buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.SDNC_DIRECTIVES, paramsMap);
- buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.USER_DIRECTIVES, requestContext.getUserParams());
-
- buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule);
-
- // Parameters received from the request should overwrite any parameters received from SDNC
- paramsMap.putAll(requestContext.getUserParams());
-
- if (vfModule.getCloudParams() != null) {
- paramsMap.putAll(vfModule.getCloudParams());
- }
- return paramsMap;
- }
-
- private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive, Map<String, Object> srcMap) {
+ @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 = "_";
+
+ @PostConstruct
+ public void init() {
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
+
+ public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
+ throws JsonParseException, JsonMappingException, IOException {
+ CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
+
+ createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
+ createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+ createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
+ createVfModuleRequest.setVnfId(genericVnf.getVnfId());
+ createVfModuleRequest.setVnfType(genericVnf.getVnfType());
+ createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
+ createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ if (volumeGroup != null) {
+ createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ }
+ VfModule baseVfModule = getBaseVfModule(genericVnf);
+ if (baseVfModule != null) {
+ createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId());
+ createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId());
+ }
+ createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf,
+ vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
+
+ createVfModuleRequest.setSkipAAI(true);
+ createVfModuleRequest.setBackout(Boolean.TRUE.equals(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, Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance,
+ GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
+ throws JsonParseException, JsonMappingException, IOException {
+
+
+ GenericResourceApiVnfTopology vnfTop =
+ mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnfTopology.class);
+ GenericResourceApiVfModuleTopology vfModuleTop =
+ mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
+ GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology();
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
+ Map<String, Object> paramsMap = new HashMap<>();
+
+ if (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);
+ }
+
+ // build the sdnc_directives from paramsMap
+ buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.SDNC_DIRECTIVES, paramsMap);
+ buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.USER_DIRECTIVES, requestContext.getUserParams());
+
+ buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule);
+
+ // Parameters received from the request should overwrite any parameters received from SDNC
+ paramsMap.putAll(requestContext.getUserParams());
+
+ if (vfModule.getCloudParams() != null) {
+ paramsMap.putAll(vfModule.getCloudParams());
+ }
+ return paramsMap;
+ }
+
+ private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
+ Map<String, Object> srcMap) {
StringBuilder directives = new StringBuilder();
if (srcMap.size() > 0) {
directives.append("{ \"attributes\": [ ");
int i = 0;
for (String attributeName : srcMap.keySet()) {
directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
- if (i < (srcMap.size()-1))
+ if (i < (srcMap.size() - 1))
directives.append(", ");
i++;
}
@@ -217,636 +221,679 @@ public class VnfAdapterVfModuleObjectMapper {
paramsMap.put(directive, directives.toString());
}
- private void buildMandatoryParamsMap(Map<String,Object> 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.putIfAbsent("environment_context", "");
- paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
- paramsMap.putIfAbsent("workload_context", "");
- Integer vfModuleIndex = vfModule.getModuleIndex();
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", vfModuleIndex.toString());
- }
- }
-
- private void buildParamsMapFromVnfSdncResponse(Map<String,Object> 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,Object> 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,Object> 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,Object> 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,Object> 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);
-
- buildVlanInformation(paramsMap, network, key, networkKey);
-
- }
- }
- }
-
- buildParamsMapFromVfModuleForHeatTemplate(paramsMap, vm);
- }
- }
- }
- }
- }
- }
-
- protected void buildVlanInformation(Map<String, Object> paramsMap,
- GenericResourceApiVmNetworkData network, String key, String networkKey) {
-
- String networkString = convertToString(network);
- String vlanFilterKey = key + UNDERSCORE + networkKey + UNDERSCORE + "vlan_filter";
- String privateVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "private_vlans";
- String publicVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "public_vlans";
- String guestVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "guest_vlans";
-
- if (network.getSegmentationId() != null) {
- paramsMap.put(vlanFilterKey, network.getSegmentationId());
- }
-
- List<String> privateVlans = jsonPath.locateResultList(networkString, "$.related-networks.related-network[?(@.vlan-tags.is-private == true)].vlan-tags.upper-tag-id");
- List<String> publicVlans = jsonPath.locateResultList(networkString, "$.related-networks.related-network[?(@.vlan-tags.is-private == false)].vlan-tags.upper-tag-id");
- List<String> concat = new ArrayList<>(privateVlans);
- concat.addAll(publicVlans);
- Collection<String> guestVlans = new HashSet<>(concat);
-
- if (!privateVlans.isEmpty()) {
- paramsMap.put(privateVlansKey, Joiner.on(",").join(privateVlans));
- }
- if (!publicVlans.isEmpty()) {
- paramsMap.put(publicVlansKey, Joiner.on(",").join(publicVlans));
- }
- if (!guestVlans.isEmpty()) {
- paramsMap.put(guestVlansKey, Joiner.on(",").join(guestVlans));
- }
- }
-
- private void buildVfModuleVmNames(Map<String,Object> 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,Object> 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,Object> 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,Object> 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,Object> 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,Object> 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,Object> 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,Object> paramsMap, GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) {
-
- String vmTypeKey = vnfcNetworkdata.getVnfcType();
- GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
- if (vnfcPorts != null) {
- 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,Object> paramsMap, String keyPrefix, GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) {
+ private void buildMandatoryParamsMap(Map<String, Object> 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.putIfAbsent("environment_context", "");
+ paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ paramsMap.putIfAbsent("workload_context", "");
+ Integer vfModuleIndex = vfModule.getModuleIndex();
+ if (vfModuleIndex != null) {
+ paramsMap.put("vf_module_index", vfModuleIndex.toString());
+ }
+ }
+
+ private void buildParamsMapFromVnfSdncResponse(Map<String, Object> 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, Object> 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, Object> 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, Object> 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, Object> 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);
+
+ buildVlanInformation(paramsMap, network, key, networkKey);
+
+ }
+ }
+ }
+
+ buildParamsMapFromVfModuleForHeatTemplate(paramsMap, vm);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void buildVlanInformation(Map<String, Object> paramsMap, GenericResourceApiVmNetworkData network,
+ String key, String networkKey) {
+
+ String networkString = convertToString(network);
+ String vlanFilterKey = key + UNDERSCORE + networkKey + UNDERSCORE + "vlan_filter";
+ String privateVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "private_vlans";
+ String publicVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "public_vlans";
+ String guestVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "guest_vlans";
+
+ if (network.getSegmentationId() != null) {
+ paramsMap.put(vlanFilterKey, network.getSegmentationId());
+ }
+
+ List<String> privateVlans = jsonPath.locateResultList(networkString,
+ "$.related-networks.related-network[?(@.vlan-tags.is-private == true)].vlan-tags.upper-tag-id");
+ List<String> publicVlans = jsonPath.locateResultList(networkString,
+ "$.related-networks.related-network[?(@.vlan-tags.is-private == false)].vlan-tags.upper-tag-id");
+ List<String> concat = new ArrayList<>(privateVlans);
+ concat.addAll(publicVlans);
+ Collection<String> guestVlans = new HashSet<>(concat);
+
+ if (!privateVlans.isEmpty()) {
+ paramsMap.put(privateVlansKey, Joiner.on(",").join(privateVlans));
+ }
+ if (!publicVlans.isEmpty()) {
+ paramsMap.put(publicVlansKey, Joiner.on(",").join(publicVlans));
+ }
+ if (!guestVlans.isEmpty()) {
+ paramsMap.put(guestVlansKey, Joiner.on(",").join(guestVlans));
+ }
+ }
+
+ private void buildVfModuleVmNames(Map<String, Object> 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, Object> 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, Object> 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, Object> 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, Object> 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, Object> 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, Object> 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, Object> paramsMap,
+ GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) {
+
+ String vmTypeKey = vnfcNetworkdata.getVnfcType();
+ GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
+ if (vnfcPorts != null) {
+ 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, Object> 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, Object> 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, Object> 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, Object> 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, Object> 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, Object> 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[*]");
- List<GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData> subInterfaceNetworkDataList = vnicSubInterfaces.getSubInterfaceNetworkData();
+ addPairToMap(paramsMap, keyPrefix, V6_IP, ipv6Ips);
- if ( (subInterfaceNetworkDataList != null) && !subInterfaceNetworkDataList.isEmpty() ) {
- addPairToMap(paramsMap, keyPrefix, SUB_INT_COUNT, String.valueOf(subInterfaceNetworkDataList.size()));
- }
+ for (int i = 0; i < ipv6Ips.size(); i++) {
+ addPairToMap(paramsMap, keyPrefix, V6_IP + UNDERSCORE + i, ipv6Ips.get(i));
+ }
}
- protected String createVnfcSubInterfaceKey(String vmTypeKey, int networkDataIdx, String networkRoleKey, int portIdx) {
+ /*
+ * Build floatingip_address for Heat Template Building Criteria :
+ * {vm-type}_subint_{network-role}_port_{index}_floating_ip -- for ipV4
+ */
+ protected void buildVfModuleFloatingIpV4HeatTemplate(Map<String, Object> paramsMap, String keyPrefix,
+ String vnicSubInterfaces) {
- return Joiner.on(UNDERSCORE).join(Arrays.asList(vmTypeKey, networkDataIdx, SUB_INT, networkRoleKey, PORT, portIdx));
- }
+ List<String> floatingV4 = jsonPath.locateResultList(vnicSubInterfaces,
+ "$.sub-interface-network-data[*].floating-ips.floating-ip-v4[*]");
- protected String createGlobalVnfcSubInterfaceKey(String vmTypeKey,String networkRoleKey, int portIdx) {
+ if (!floatingV4.isEmpty()) {
+ floatingV4 = Collections.singletonList(floatingV4.get(0));
+ }
+ addPairToMap(paramsMap, keyPrefix, FLOATING_IP, floatingV4);
- 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,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+ /*
+ * 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, Object> paramsMap, String keyPrefix,
+ String vnicSubInterfaces) {
- List<String> vlanTagIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].vlan-tag-id");
+ List<String> floatingV6 = jsonPath.locateResultList(vnicSubInterfaces,
+ "$.sub-interface-network-data[*].floating-ips.floating-ip-v6[*]");
- 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,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+ if (!floatingV6.isEmpty()) {
+ floatingV6 = Collections.singletonList(floatingV6.get(0));
+ }
+ addPairToMap(paramsMap, keyPrefix, FLOATING_V6_IP, floatingV6);
+ }
- List<String> neworkNames = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-name");
+ protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, String value) {
- addPairToMap(paramsMap, keyPrefix, NET_NAMES, neworkNames);
- }
+ addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value));
+ }
- /*
- * 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,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) {
+ protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, List<String> value) {
- List<String> neworkIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-id");
+ if (!value.isEmpty()) {
+ paramsMap.put(keyPrefix + key, Joiner.on(",").join(value));
+ }
+ }
- 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,Object> 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,Object> 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,Object> 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,Object> 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, Object> paramsMap, String keyPrefix, String key, String value) {
-
- addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value));
- }
-
- protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, List<String> value) {
-
- if (!value.isEmpty()) {
- paramsMap.put(keyPrefix + key, Joiner.on(",").join(value));
- }
- }
-
- private void buildParamsMapFromSdncParams(Map<String,Object> 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.setCloudOwner(cloudRegion.getCloudOwner());
- deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
- deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
- deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
- if (!StringUtils.isEmpty(vfModule.getHeatStackId())){
- deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId
- } else
- {
- deleteVfModuleRequest.setVfModuleStackId(vfModule.getVfModuleName());
- }
-
- deleteVfModuleRequest.setSkipAAI(true);
- setIdAndUrl(deleteVfModuleRequest);
- MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
- deleteVfModuleRequest.setMsoRequest(msoRequest);
- return deleteVfModuleRequest;
- }
-
- protected void setIdAndUrl(DeleteVfModuleRequest deleteVfModuleRequest) throws UnsupportedEncodingException{
- String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
- deleteVfModuleRequest.setMessageId(messageId);
- deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
- }
-
- private String convertToString(Object obj) {
- String json;
- try {
- json = mapper.writeValueAsString(obj);
- } catch (JsonProcessingException e) {
- json = "{}";
- }
-
- return json;
- }
-
- private VfModule getBaseVfModule(GenericVnf genericVnf) {
- List<VfModule> vfModules = genericVnf.getVfModules();
- VfModule baseVfModule = null;
- if (vfModules != null) {
- for(int i = 0; i < vfModules.size(); i++) {
- if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) {
- baseVfModule = vfModules.get(i);
- break;
- }
- }
- }
- return baseVfModule;
- }
+ private void buildParamsMapFromSdncParams(Map<String, Object> 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.setCloudOwner(cloudRegion.getCloudOwner());
+ deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+ deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
+ deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ if (!StringUtils.isEmpty(vfModule.getHeatStackId())) {
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());// DoDVfMod_heatStackId
+ } else {
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getVfModuleName());
+ }
+
+ deleteVfModuleRequest.setSkipAAI(true);
+ setIdAndUrl(deleteVfModuleRequest);
+ MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
+ deleteVfModuleRequest.setMsoRequest(msoRequest);
+ return deleteVfModuleRequest;
+ }
+
+ protected void setIdAndUrl(DeleteVfModuleRequest deleteVfModuleRequest) throws UnsupportedEncodingException {
+ String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
+ deleteVfModuleRequest.setMessageId(messageId);
+ deleteVfModuleRequest
+ .setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
+ }
+
+ private String convertToString(Object obj) {
+ String json;
+ try {
+ json = mapper.writeValueAsString(obj);
+ } catch (JsonProcessingException e) {
+ json = "{}";
+ }
+
+ return json;
+ }
+
+ private VfModule getBaseVfModule(GenericVnf genericVnf) {
+ List<VfModule> vfModules = genericVnf.getVfModules();
+ VfModule baseVfModule = null;
+ if (vfModules != null) {
+ for (int i = 0; i < vfModules.size(); i++) {
+ if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) {
+ baseVfModule = vfModules.get(i);
+ break;
+ }
+ }
+ }
+ return baseVfModule;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
index 9613fbdcf1..593426a85f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
@@ -25,7 +25,6 @@ package org.onap.so.client.namingservice;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.namingservice.model.NameGenDeleteRequest;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenRequest;
@@ -47,53 +46,53 @@ import org.springframework.web.client.RestTemplate;
@Component
-public class NamingClient{
- private static final Logger logger = LoggerFactory.getLogger(NamingClient.class);
- private static final String ENDPOINT = "mso.naming.endpoint";
- private static final String AUTH = "mso.naming.auth";
-
- @Autowired
- private RestTemplate restTemplate;
- @Autowired
+public class NamingClient {
+ private static final Logger logger = LoggerFactory.getLogger(NamingClient.class);
+ private static final String ENDPOINT = "mso.naming.endpoint";
+ private static final String AUTH = "mso.naming.auth";
+
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
private Environment env;
- @Autowired
- private NamingClientResponseValidator namingClientResponseValidator;
-
- public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException {
- String targetUrl = env.getProperty(ENDPOINT);
- HttpHeaders headers = setHeaders(env.getProperty(AUTH));
- logger.info("Sending postNameGenRequest to url: {}", targetUrl);
- HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers);
- ResponseEntity<NameGenResponse> response;
- try{
- response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class);
- }catch(HttpStatusCodeException e){
- throw new BadResponseException(namingClientResponseValidator.formatError(e));
- }
- return namingClientResponseValidator.validateNameGenResponse(response);
- }
+ @Autowired
+ private NamingClientResponseValidator namingClientResponseValidator;
+
+ public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException {
+ String targetUrl = env.getProperty(ENDPOINT);
+ HttpHeaders headers = setHeaders(env.getProperty(AUTH));
+ logger.info("Sending postNameGenRequest to url: {}", targetUrl);
+ HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers);
+ ResponseEntity<NameGenResponse> response;
+ try {
+ response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class);
+ } catch (HttpStatusCodeException e) {
+ throw new BadResponseException(namingClientResponseValidator.formatError(e));
+ }
+ return namingClientResponseValidator.validateNameGenResponse(response);
+ }
- public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException {
- String targetUrl = env.getProperty(ENDPOINT);
- HttpHeaders headers = setHeaders(env.getProperty(AUTH));
- logger.info("Sending deleteNameGenRequest to url: {}", targetUrl);
- HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers);
- ResponseEntity<NameGenDeleteResponse> response;
- try{
- response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class);
- }catch(HttpStatusCodeException e){
- throw new BadResponseException(namingClientResponseValidator.formatError(e));
- }
- return namingClientResponseValidator.validateNameGenDeleteResponse(response);
- }
+ public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException {
+ String targetUrl = env.getProperty(ENDPOINT);
+ HttpHeaders headers = setHeaders(env.getProperty(AUTH));
+ logger.info("Sending deleteNameGenRequest to url: {}", targetUrl);
+ HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers);
+ ResponseEntity<NameGenDeleteResponse> response;
+ try {
+ response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class);
+ } catch (HttpStatusCodeException e) {
+ throw new BadResponseException(namingClientResponseValidator.formatError(e));
+ }
+ return namingClientResponseValidator.validateNameGenDeleteResponse(response);
+ }
- private HttpHeaders setHeaders(String auth) {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- List<MediaType> acceptableMediaTypes = new ArrayList<>();
- acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
- headers.setAccept(acceptableMediaTypes);
- headers.add(HttpHeaders.AUTHORIZATION, auth);
- return headers;
- }
+ private HttpHeaders setHeaders(String auth) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ List<MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
+ headers.setAccept(acceptableMediaTypes);
+ headers.add(HttpHeaders.AUTHORIZATION, auth);
+ return headers;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
index 8456f26239..717bb04099 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
@@ -24,7 +24,6 @@ package org.onap.so.client.namingservice;
import java.io.IOException;
import java.util.List;
-
import org.apache.http.HttpStatus;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenResponse;
@@ -38,113 +37,113 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpStatusCodeException;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class NamingClientResponseValidator {
- private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class);
- private static final String INSTANCE_GROUP_NAME = "instance-group-name";
- private static final String NO_RESPONSE_FROM_NAMING_SERVICE = "Error did not receive a response from Naming Service.";
- private static final String NULL_RESPONSE_FROM_NAMING_SERVICE = "Error received a null response from Naming Service.";
- private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s";
-
- public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
- if (response == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NO_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
- }
-
+ private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class);
+ private static final String INSTANCE_GROUP_NAME = "instance-group-name";
+ private static final String NO_RESPONSE_FROM_NAMING_SERVICE =
+ "Error did not receive a response from Naming Service.";
+ private static final String NULL_RESPONSE_FROM_NAMING_SERVICE =
+ "Error received a null response from Naming Service.";
+ private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s";
+
+ public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
+ if (response == null) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
int responseCode = response.getStatusCodeValue();
String generatedName = "";
NameGenResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NULL_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
- }
-
- if (isHttpCodeSuccess(responseCode)) {
- logger.info("Successful Response from Naming Service");
- List<Respelement> respList = responseBody.getElements();
-
- if (respList != null) {
- for (int i=0; i < respList.size(); i++) {
- Respelement respElement = respList.get(i);
- if (respElement != null) {
- String resourceName = respElement.getResourceName();
- if (INSTANCE_GROUP_NAME.equals(resourceName)) {
- generatedName = respElement.getResourceValue();
- break;
- }
- }
- }
- }
- return generatedName;
- } else {
- NameGenResponseError error = responseBody.getError();
- String errorMessageString = NAMING_SERVICE_ERROR;
- if (error != null) {
- errorMessageString = error.getMessage();
- }
- String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
- public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException {
- if (response == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NO_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
- }
-
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ if (isHttpCodeSuccess(responseCode)) {
+ logger.info("Successful Response from Naming Service");
+ List<Respelement> respList = responseBody.getElements();
+
+ if (respList != null) {
+ for (int i = 0; i < respList.size(); i++) {
+ Respelement respElement = respList.get(i);
+ if (respElement != null) {
+ String resourceName = respElement.getResourceName();
+ if (INSTANCE_GROUP_NAME.equals(resourceName)) {
+ generatedName = respElement.getResourceValue();
+ break;
+ }
+ }
+ }
+ }
+ return generatedName;
+ } else {
+ NameGenResponseError error = responseBody.getError();
+ String errorMessageString = NAMING_SERVICE_ERROR;
+ if (error != null) {
+ errorMessageString = error.getMessage();
+ }
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response)
+ throws BadResponseException {
+ if (response == null) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
int responseCode = response.getStatusCodeValue();
String responseMessage = "";
NameGenDeleteResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(),
- NULL_RESPONSE_FROM_NAMING_SERVICE);
- throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
- }
-
- if (isHttpCodeSuccess(responseCode)) {
- logger.info("Successful Response from Naming Service");
- return responseMessage;
- } else {
- String errorMessageString = NAMING_SERVICE_ERROR;
-
- String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
- private boolean isHttpCodeSuccess(int code) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NULL_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ if (isHttpCodeSuccess(responseCode)) {
+ logger.info("Successful Response from Naming Service");
+ return responseMessage;
+ } else {
+ String errorMessageString = NAMING_SERVICE_ERROR;
+
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ private boolean isHttpCodeSuccess(int code) {
return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0;
}
-
- protected String formatError(HttpStatusCodeException e) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class);
- NameGenResponseError error = errorResponse.getError();
-
- String errorMessageString = null;
- if (error != null) {
- errorMessageString = error.getMessage();
- }
- String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- return errorMessage;
- }
+
+ protected String formatError(HttpStatusCodeException e) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class);
+ NameGenResponseError error = errorResponse.getError();
+
+ String errorMessageString = null;
+ if (error != null) {
+ errorMessageString = error.getMessage();
+ }
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ return errorMessage;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
index ba9f170d71..a4e68f8100 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
@@ -21,7 +21,6 @@
package org.onap.so.client.namingservice;
import java.util.List;
-
import org.onap.namingservice.model.Deleteelement;
import org.onap.namingservice.model.Element;
import org.onap.namingservice.model.NameGenDeleteRequest;
@@ -29,30 +28,34 @@ import org.onap.namingservice.model.NameGenRequest;
import org.springframework.stereotype.Component;
@Component
-public class NamingRequestObjectBuilder{
-
- public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){
- Element element = new Element();
- element.put("external-key", instanceGroupId);
- element.put("policy-instance-name", policyInstanceName);
- element.put("naming-type", namingType);
- element.put("resource-name", instanceGroupName);
- element.put("nf-naming-code", nfNamingCode);
- return element;
- }
- public Deleteelement deleteElementMapper(String instanceGroupId){
- Deleteelement deleteElement = new Deleteelement();
- deleteElement.setExternalKey(instanceGroupId);
- return deleteElement;
- }
- public NameGenRequest nameGenRequestMapper(List<Element> elements){
- NameGenRequest nameGenRequest = new NameGenRequest();
- nameGenRequest.setElements(elements);
- return nameGenRequest;
- }
- public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements){
- NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
- nameGenDeleteRequest.setElements(deleteElements);
- return nameGenDeleteRequest;
- }
+public class NamingRequestObjectBuilder {
+
+ public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType,
+ String nfNamingCode, String instanceGroupName) {
+ Element element = new Element();
+ element.put("external-key", instanceGroupId);
+ element.put("policy-instance-name", policyInstanceName);
+ element.put("naming-type", namingType);
+ element.put("resource-name", instanceGroupName);
+ element.put("nf-naming-code", nfNamingCode);
+ return element;
+ }
+
+ public Deleteelement deleteElementMapper(String instanceGroupId) {
+ Deleteelement deleteElement = new Deleteelement();
+ deleteElement.setExternalKey(instanceGroupId);
+ return deleteElement;
+ }
+
+ public NameGenRequest nameGenRequestMapper(List<Element> elements) {
+ NameGenRequest nameGenRequest = new NameGenRequest();
+ nameGenRequest.setElements(elements);
+ return nameGenRequest;
+ }
+
+ public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements) {
+ NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
+ nameGenDeleteRequest.setElements(deleteElements);
+ return nameGenDeleteRequest;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
index fa039c235c..e31285f044 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
@@ -34,7 +34,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.LinkedHashMap;
@@ -54,15 +53,14 @@ public class OofClient {
/**
- * Makes a rest call to oof to perform homing and licensing for a
- * list of demands
+ * Makes a rest call to oof to perform homing and licensing for a list of demands
*
* @param homingRequest
* @return
* @throws JsonProcessingException
* @throws BpmnError
*/
- public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException{
+ public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException {
logger.trace("Started oof Client Post Demands");
String url = oofProperties.getHost() + oofProperties.getUri();
logger.debug("Post demands url: " + url);
@@ -79,7 +77,8 @@ public class OofClient {
baseClient.setTargetUrl(url);
baseClient.setHttpHeader(header);
- LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ LinkedHashMap<?, ?> response =
+ baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<?, ?>>() {});
validator.validateDemandsResponse(response);
logger.trace("Completed OOF Client Post Demands");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
index 252ff0d6a6..abbf52e38c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
@@ -26,9 +26,7 @@ import org.onap.so.client.exception.BadResponseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import java.util.LinkedHashMap;
-
import static org.apache.commons.lang.StringUtils.isNotBlank;
@@ -44,55 +42,54 @@ public class OofValidator {
*/
public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
logger.debug("Validating oofs synchronous response");
- if(!response.isEmpty()){
+ if (!response.isEmpty()) {
JSONObject jsonResponse = new JSONObject(response);
- if(jsonResponse.has("requestStatus")){
+ if (jsonResponse.has("requestStatus")) {
String status = jsonResponse.getString("requestStatus");
- if(status.equals("accepted")){
+ if (status.equals("accepted")) {
logger.debug("oofs synchronous response indicates accepted");
- }else{
+ } else {
String message = jsonResponse.getString("statusMessage");
- if(isNotBlank(message)){
+ if (isNotBlank(message)) {
logger.debug("oofs response indicates failed: " + message);
- }else{
+ } else {
logger.debug("oofs response indicates failed: no status message provided");
message = "error message not provided";
}
throw new BadResponseException("oofs synchronous response indicates failed: " + message);
}
- }else{
+ } else {
logger.debug("oofs synchronous response does not contain: request status");
throw new BadResponseException("oofs synchronous response does not contain: request status");
}
- }else{
+ } else {
logger.debug("oofs synchronous response is empty");
throw new BadResponseException("oofs synchronous response i is empty");
}
}
/**
- * Validates the asynchronous/callback response from oof which
- * contains the homing and licensing solutions
+ * Validates the asynchronous/callback response from oof which contains the homing and licensing solutions
*
* @throws BadResponseException
*/
- public void validateSolution(String response) throws BadResponseException{
+ public void validateSolution(String response) throws BadResponseException {
logger.debug("Validating oofs asynchronous callback response");
- if(isNotBlank(response)) {
+ if (isNotBlank(response)) {
JSONObject jsonResponse = new JSONObject(response);
- if(!jsonResponse.has("serviceException")){
+ if (!jsonResponse.has("serviceException")) {
logger.debug("oofs asynchronous response is valid");
- }else{
+ } else {
String message = jsonResponse.getJSONObject("serviceException").getString("text");
- if(isNotBlank(message)){
+ if (isNotBlank(message)) {
logger.debug("oofs response contains a service exception: " + message);
- }else{
+ } else {
logger.debug("oofs response contains a service exception: no service exception text provided");
message = "error message not provided";
}
throw new BadResponseException("oofs asynchronous response contains a service exception: " + message);
}
- }else{
+ } else {
logger.debug("oofs asynchronous response is empty");
throw new BadResponseException("oofs asynchronous response is empty");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
index f5fb87503a..433de22aba 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
@@ -24,18 +24,11 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "modelType",
- "modelInvariantId",
- "modelVersionId",
- "modelName",
- "modelVersion",
- "modelCustomizationName"
-})
+@JsonPropertyOrder({"modelType", "modelInvariantId", "modelVersionId", "modelName", "modelVersion",
+ "modelCustomizationName"})
@JsonRootName("modelInfo")
public class ModelInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
index 507eaeaf5e..84e29b6f2d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
@@ -22,7 +22,6 @@ package org.onap.so.client.oof.beans;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
-
import java.util.Map;
@Configuration
@@ -38,25 +37,27 @@ public class OofProperties {
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/oof/beans/OofRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
index 58f0bfc9cc..e3c29fe04d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
@@ -27,11 +27,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.io.Serializable;
-public class OofRequest implements Serializable{
+public class OofRequest implements Serializable {
private static final long serialVersionUID = -1541132882892163132L;
private static final Logger logger = LoggerFactory.getLogger(OofRequest.class);
@@ -53,38 +52,45 @@ public class OofRequest implements Serializable{
public RequestInfo getRequestInformation() {
return requestInformation;
}
+
public void setRequestInformation(RequestInfo requestInformation) {
this.requestInformation = requestInformation;
}
+
public ServiceInfo getServiceInformation() {
return serviceInformation;
}
+
public void setServiceInformation(ServiceInfo serviceInformation) {
this.serviceInformation = serviceInformation;
}
+
public PlacementInfo getPlacementInformation() {
return placementInformation;
}
+
public void setPlacementInformation(PlacementInfo placementInformation) {
this.placementInformation = placementInformation;
}
+
public String getLicenseInformation() {
return licenseInformation;
}
+
public void setLicenseInformation(String licenseInformation) {
this.licenseInformation = licenseInformation;
}
@JsonInclude(Include.NON_NULL)
- public String toJsonString(){
+ public String toJsonString() {
String json = "";
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
- try{
+ try {
json = ow.writeValueAsString(this);
- }catch (Exception e){
+ } catch (Exception e) {
logger.error("Unable to convert oofRequest to string", e);
}
return json.replaceAll("\\\\", "");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
index 621f5652a3..6c9e45c787 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
@@ -24,15 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "customerLatitude",
- "customerLongitude",
- "customerName"
-})
+@JsonPropertyOrder({"customerLatitude", "customerLongitude", "customerName"})
@JsonRootName("requestParameters")
public class OofRequestParameters implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
index 38728efcfb..73c100df6d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
@@ -24,16 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "resourceModuleName",
- "serviceResourceId",
- "tenantId",
- "resourceModelInfo"
-})
+@JsonPropertyOrder({"resourceModuleName", "serviceResourceId", "tenantId", "resourceModelInfo"})
@JsonRootName("placementDemand")
public class PlacementDemand implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
index 2a7dc9decb..0eb14d991a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
@@ -28,11 +28,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "requestParameters",
- "subscriberInfo",
- "placementDemands"
-})
+@JsonPropertyOrder({"requestParameters", "subscriberInfo", "placementDemands"})
@JsonRootName("placementInfo")
public class PlacementInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
index 6831fe54e9..0132ed56e9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
@@ -28,16 +28,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "transactionId",
- "requestId",
- "callbackUrl",
- "sourceId",
- "requestType",
- "numSolutions",
- "optimizers",
- "timeout"
-})
+@JsonPropertyOrder({"transactionId", "requestId", "callbackUrl", "sourceId", "requestType", "numSolutions",
+ "optimizers", "timeout"})
@JsonRootName("requestInfo")
public class RequestInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
index fea7437a93..8d44c63571 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
@@ -21,10 +21,9 @@
package org.onap.so.client.oof.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
-public class Resource implements Serializable{
+public class Resource implements Serializable {
private static final long serialVersionUID = 5949861520571440421L;
@@ -34,19 +33,19 @@ public class Resource implements Serializable{
private String status;
- public String getServiceResourceId(){
+ public String getServiceResourceId() {
return serviceResourceId;
}
- public void setServiceResourceId(String serviceResourceId){
+ public void setServiceResourceId(String serviceResourceId) {
this.serviceResourceId = serviceResourceId;
}
- public String getStatus(){
+ public String getStatus() {
return status;
}
- public void setStatus(String status){
+ public void setStatus(String status) {
this.status = status;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
index e9257bcb0c..9d0352525d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
@@ -23,7 +23,6 @@ package org.onap.so.client.oof.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
index 0cfffbbff6..db0e2acd60 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
@@ -24,15 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "serviceInstanceId",
- "serviceName",
- "modelInfo"
-})
+@JsonPropertyOrder({"serviceInstanceId", "serviceName", "modelInfo"})
@JsonRootName("serviceInfo")
public class ServiceInfo implements Serializable {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
index 3218975095..8fef4c45e7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
@@ -24,15 +24,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "globalSubscriberId",
- "subscriberName",
- "subscriberCommonSiteId"
-})
+@JsonPropertyOrder({"globalSubscriberId", "subscriberName", "subscriberCommonSiteId"})
@JsonRootName("subscriberInfo")
public class SubscriberInfo implements Serializable {
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
index 4a9f01fa53..5df7518698 100644
--- 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
@@ -32,27 +32,29 @@ 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);
- }
+ @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
index f412720af7..746f136e96 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -37,11 +35,11 @@ import org.springframework.stereotype.Component;
@Component
public class AAIConfigurationResources {
- @Autowired
- private InjectionHelper injectionHelper;
+ @Autowired
+ private InjectionHelper injectionHelper;
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
/**
* A&AI call to create configuration
@@ -49,14 +47,15 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void createConfiguration(Configuration configuration) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
}
/**
- * method to get Configuration details from A&AI
+ * method to get Configuration details from A&AI
*
* @param configurationId
* @return
@@ -72,21 +71,24 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void updateConfiguration(Configuration configuration) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ 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){
+ 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);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI);
}
/**
@@ -96,8 +98,10 @@ public class AAIConfigurationResources {
* @param vnrConfigurationId
*/
public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) {
- AAIResourceUri vnrConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
- AAIResourceUri vrfConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
+ AAIResourceUri vnrConfigurationUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
+ AAIResourceUri vrfConfigurationUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri);
}
@@ -121,11 +125,11 @@ public class AAIConfigurationResources {
*/
public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
}
-
+
/**
* A&AI call to add configuration relationship with service instance
*
@@ -133,10 +137,11 @@ public class AAIConfigurationResources {
* @param serviceInstanceId
* @param aaiLabel
*/
- public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, AAIEdgeLabel aaiLabel) {
+ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId,
+ AAIEdgeLabel aaiLabel) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
}
@@ -165,22 +170,22 @@ public class AAIConfigurationResources {
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
- public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId){
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
+ public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
}
- public void connectConfigurationToVnfc(String configurationId, String vnfcName){
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
- injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
+ public void connectConfigurationToVnfc(String configurationId, String vnfcName) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
}
- public void connectConfigurationToL3Network(String configurationId, String networkId){
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
- injectionHelper.getAaiClient().connect(configurationURI, networkURI);
+ public void connectConfigurationToL3Network(String configurationId, String networkId) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+ injectionHelper.getAaiClient().connect(configurationURI, networkURI);
}
/**
@@ -192,30 +197,35 @@ public class AAIConfigurationResources {
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
+
/**
* method to delete Configuration details in A&AI
*
* @param configuration
*/
public void deleteConfiguration(Configuration configuration) {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
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()));
+ 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()));
}
- public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
- configuration.setOrchestrationStatus(orchestrationStatus);
- org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
- injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
- }
+ public void updateOrchestrationStatusConfiguration(Configuration configuration,
+ OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ configuration.setOrchestrationStatus(orchestrationStatus);
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+ injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
+ }
}
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
index c325dd75ee..c48593037a 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -36,45 +35,53 @@ import org.springframework.stereotype.Component;
@Component
public class AAIInstanceGroupResources {
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ @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 void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) {
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel);
+ }
- 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 boolean exists(InstanceGroup instanceGroup) {
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ return injectionHelper.getAaiClient().exists(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 void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
- injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel);
- }
-
- public boolean exists(InstanceGroup instanceGroup) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- return injectionHelper.getAaiClient().exists(instanceGroupUri);
- }
-
- public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup, ServiceInstance serviceInstance) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstance.getServiceInstanceId());
- injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)).connect(instanceGroupUri, serviceInstanceURI);
- }
+ public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup,
+ ServiceInstance serviceInstance) {
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
+ .connect(instanceGroupUri, serviceInstanceURI);
+ }
}
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
index 7283c9967c..b936551549 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
-
import org.onap.aai.domain.yang.NetworkPolicies;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.aai.domain.yang.RouteTableReference;
@@ -46,147 +45,165 @@ 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 updateSubnet(L3Network network, Subnet subnet) {
- AAIResourceUri subnetURI = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
- org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
- injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
- }
-
- 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.depth(Depth.TWO)).asBean(VpnBinding.class);
- }
-
- public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
- return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
- }
-
- public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
- return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
- }
-
- public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
- return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.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(networkURI,cloudRegionURI);
- }
-
- 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 connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
- AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
- }
-
- 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);
- }
-
- public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
- NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
- String networkPolicyId = networkPolicy.getNetworkPolicyId();
- AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
- injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
- }
-
- public void deleteNetworkPolicy(String networkPolicyId) {
- AAIResourceUri networkPolicyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
- injectionHelper.getAaiClient().delete(networkPolicyURI);
- }
+
+ @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 updateSubnet(L3Network network, Subnet subnet) {
+ AAIResourceUri subnetURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
+ org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
+ injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
+ }
+
+ 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.depth(Depth.TWO)).asBean(VpnBinding.class);
+ }
+
+ public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
+ return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
+ }
+
+ public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
+ return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
+ }
+
+ public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
+ return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.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(networkURI, cloudRegionURI);
+ }
+
+ 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 connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri instanceGroupURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
+ }
+
+ 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);
+ }
+
+ public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
+ NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
+ String networkPolicyId = networkPolicy.getNetworkPolicyId();
+ AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
+ }
+
+ public void deleteNetworkPolicy(String networkPolicyId) {
+ AAIResourceUri networkPolicyURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ injectionHelper.getAaiClient().delete(networkPolicyURI);
+ }
}
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
index 3032b66e6d..e391349d2c 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -43,112 +42,120 @@ import org.springframework.stereotype.Component;
@Component
public class AAIServiceInstanceResources {
- private static final Logger logger = LoggerFactory.getLogger(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));
- }
+ private static final Logger logger = LoggerFactory.getLogger(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) {
+ 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));
+ 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_ENTITY)
+ .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);
}
- 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_ENTITY).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
index 5fa73c85ff..83fe31a116 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -41,62 +40,73 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class);
-
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ private static final Logger logger = LoggerFactory.getLogger(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 updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
+
+ copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
- 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 updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
- public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- VfModule copiedVfModule = vfModule.shallowCopyId();
+ copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
- vfModule.setOrchestrationStatus(orchestrationStatus);
- copiedVfModule.setOrchestrationStatus(orchestrationStatus);
- org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
- injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
- }
-
- public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- VfModule copiedVfModule = vfModule.shallowCopyId();
+ 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);
+ }
- copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
- org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
- injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
- }
-
- public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- VfModule copiedVfModule = vfModule.shallowCopyId();
-
- copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
- 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);
- }
+ 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
index 48a1c1e558..fc61d862aa 100644
--- 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
@@ -24,7 +24,6 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
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;
@@ -44,104 +43,114 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class);
-
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
-
- private AAIValidatorImpl aaiValidatorImpl= new AAIValidatorImpl();
-
- 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();
- }
-
- public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
- injectionHelper.getAaiClient().connect(vnfURI,cloudRegionURI);
- }
-
- public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
- AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
- injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
- }
-
- public boolean checkVnfClosedLoopDisabledFlag(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.isIsClosedLoopDisabled();
- }
-
- public boolean checkVnfPserversLockedFlag (String vnfId) throws IOException {
- 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 aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAIObjectMapper aaiObjectMapper;
+
+ private AAIValidatorImpl aaiValidatorImpl = new AAIValidatorImpl();
+
+ 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();
+ }
+
+ public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(vnfURI, cloudRegionURI);
+ }
+
+ public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
+ }
+
+ public boolean checkVnfClosedLoopDisabledFlag(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.isIsClosedLoopDisabled();
+ }
+
+ public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException {
+ 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 aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
+
+ }
}
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
index 7bb96ec2ed..c24d1483e2 100644
--- 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
@@ -38,51 +38,60 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class);
-
- @Autowired
- private InjectionHelper injectionHelper;
-
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class);
- 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();
+ @Autowired
+ private InjectionHelper injectionHelper;
- 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);
- }
-
- public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
- VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
-
- copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
- injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
- }
+ @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);
+ }
+
+ public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
+
+ copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
+ injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
+ }
}
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
index 092af30558..3ac61dff60 100644
--- 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
@@ -21,9 +21,7 @@
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;
@@ -38,65 +36,69 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVpnBindingResources {
- @Autowired
- private InjectionHelper injectionHelper;
+ @Autowired
+ private InjectionHelper injectionHelper;
- @Autowired
- private AAIObjectMapper aaiObjectMapper;
+ @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 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(AAIObjectPlurals.VPN_BINDING)
- .queryParam("customer-vpn-id",customerVpnId);
- return injectionHelper.getAaiClient().get(VpnBindings.class,aaiVpnBindingsResourceUri);
+ /**
+ * @param customerVpnId
+ * @return
+ */
+ public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) {
+ AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
+ .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 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));
- }
+ /**
+ * @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));
- }
+ /**
+ * 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);
- }
+ /**
+ * @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/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
index 2a25ec5ba1..06535bb765 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
@@ -25,7 +25,6 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.namingservice.model.Element;
import org.onap.namingservice.model.Deleteelement;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
@@ -39,26 +38,29 @@ import org.springframework.stereotype.Component;
@Component
public class NamingServiceResources {
- private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class);
- private static final String NAMING_TYPE = "instanceGroup";
-
- @Autowired
- private NamingClient namingClient;
-
- @Autowired
- private NamingRequestObjectBuilder namingRequestObjectBuilder;
-
- public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException {
- Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
- List<Element> elements = new ArrayList<Element>();
- elements.add(element);
- return(namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
- }
-
- public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
- Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
- List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
- deleteElements.add(deleteElement);
- return(namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
- }
+ private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class);
+ private static final String NAMING_TYPE = "instanceGroup";
+
+ @Autowired
+ private NamingClient namingClient;
+
+ @Autowired
+ private NamingRequestObjectBuilder namingRequestObjectBuilder;
+
+ public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode)
+ throws BadResponseException, IOException {
+ Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName,
+ NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
+ List<Element> elements = new ArrayList<Element>();
+ elements.add(element);
+ return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
+ }
+
+ public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
+ Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
+ List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
+ deleteElements.add(deleteElement);
+ return (namingClient
+ .deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
+ }
}
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
index 8f3445529e..b3efa71969 100644
--- 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
@@ -23,9 +23,7 @@ package org.onap.so.client.orchestration;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.Optional;
-
import javax.ws.rs.core.Response;
-
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
@@ -48,66 +46,95 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterResources {
-
- @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));
- }
-
- public Optional<Response> createNetworkAsync(CreateNetworkRequest createNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.createNetworkAsync(createNetworkRequest));
- }
-
- public Optional<Response> deleteNetworkAsync(DeleteNetworkRequest deleteNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.deleteNetworkAsync(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
- }
-
- public Optional<Response> updateNetworkAsync(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.updateNetworkAsync(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
- }
-
- public Optional<RollbackNetworkResponse> rollbackCreateNetwork(String networkId, RollbackNetworkRequest rollbackNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.rollbackNetwork(networkId, rollbackNetworkRequest));
- }
-
- public Optional<UpdateNetworkResponse> updateNetwork(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.updateNetwork(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
- }
-
- public Optional<DeleteNetworkResponse> deleteNetwork(DeleteNetworkRequest deleteNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
-
- return Optional.of(networkAdapterClient.deleteNetwork(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
- }
+
+ @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));
+ }
+
+ public Optional<Response> createNetworkAsync(CreateNetworkRequest createNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.createNetworkAsync(createNetworkRequest));
+ }
+
+ public Optional<Response> deleteNetworkAsync(DeleteNetworkRequest deleteNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.deleteNetworkAsync(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
+ }
+
+ public Optional<Response> updateNetworkAsync(UpdateNetworkRequest updateNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.updateNetworkAsync(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
+ }
+
+ public Optional<RollbackNetworkResponse> rollbackCreateNetwork(String networkId,
+ RollbackNetworkRequest rollbackNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.rollbackNetwork(networkId, rollbackNetworkRequest));
+ }
+
+ public Optional<UpdateNetworkResponse> updateNetwork(UpdateNetworkRequest updateNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.updateNetwork(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
+ }
+
+ public Optional<DeleteNetworkResponse> deleteNetwork(DeleteNetworkRequest deleteNetworkRequest)
+ throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional
+ .of(networkAdapterClient.deleteNetwork(deleteNetworkRequest.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
index 9dc03ecb88..ca32130c23 100644
--- 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
@@ -34,90 +34,83 @@ 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 java.net.URI;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@Component
public class SDNCConfigurationResources {
- @Autowired
- private GCTopologyOperationRequestMapper sdncRM;
+ @Autowired
+ private GCTopologyOperationRequestMapper sdncRM;
- /**
- * 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 GenericResourceApiGcTopologyOperationInformation assignVnrConfiguration(ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf, String sdncRequestId, URI callbackUri)
- throws MapperException, BadResponseException {
- return sdncRM.assignOrActivateVnrReqMapper(
- SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
- serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf,sdncRequestId,callbackUri);
- }
+ /**
+ * 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 GenericResourceApiGcTopologyOperationInformation assignVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf,
+ String sdncRequestId, URI callbackUri) throws MapperException, BadResponseException {
+ return sdncRM.assignOrActivateVnrReqMapper(SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE, serviceInstance,
+ requestContext, customer, vnrConfiguration, voiceVnf, sdncRequestId, callbackUri);
+ }
- /**
- * SDNC Call to Activate VNR Configuration
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @param voiceVnf
- * @return
- * @throws MapperException
- * @throws BadResponseException
- */
- public GenericResourceApiGcTopologyOperationInformation activateVnrConfiguration(ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf, String sdncRequestId, URI callbackUri)
- throws MapperException, BadResponseException {
- return sdncRM.assignOrActivateVnrReqMapper(
- SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE,
- serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf,sdncRequestId,callbackUri);
- }
+ /**
+ * SDNC Call to Activate VNR Configuration
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @param voiceVnf
+ * @return
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public GenericResourceApiGcTopologyOperationInformation activateVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf,
+ String sdncRequestId, URI callbackUri) throws MapperException, BadResponseException {
+ return sdncRM.assignOrActivateVnrReqMapper(SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE, serviceInstance,
+ requestContext, customer, vnrConfiguration, voiceVnf, sdncRequestId, callbackUri);
+ }
- /**
- * method to unAssign Vnr Configuration in SDNC
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @return
- * @throws BadResponseException
- * @throws MapperException
- */
- public GenericResourceApiGcTopologyOperationInformation unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext,
- Configuration vnrConfiguration, String sdncRequestId, URI callbackUri) throws BadResponseException, MapperException {
- return sdncRM.deactivateOrUnassignVnrReqMapper
- (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration,sdncRequestId,callbackUri);
- }
+ /**
+ * method to unAssign Vnr Configuration in SDNC
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @return
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public GenericResourceApiGcTopologyOperationInformation unAssignVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri)
+ throws BadResponseException, MapperException {
+ return sdncRM.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.UNASSIGN, serviceInstance, requestContext,
+ vnrConfiguration, sdncRequestId, callbackUri);
+ }
- /***
- * Deactivate VNR SDNC Call
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @throws BadResponseException
- * @throws MapperException
- */
- public GenericResourceApiGcTopologyOperationInformation deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri) throws BadResponseException, MapperException {
- return sdncRM.deactivateOrUnassignVnrReqMapper(
- SDNCSvcAction.DEACTIVATE,
- serviceInstance , requestContext, vnrConfiguration,sdncRequestId,callbackUri);
- }
+ /***
+ * Deactivate VNR SDNC Call
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public GenericResourceApiGcTopologyOperationInformation deactivateVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri)
+ throws BadResponseException, MapperException {
+ return sdncRM.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.DEACTIVATE, serviceInstance, requestContext,
+ vnrConfiguration, sdncRequestId, callbackUri);
+ }
}
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
index fb828c1981..54a9cabb57 100644
--- 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
@@ -39,64 +39,64 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCNetworkResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
- @Autowired
- private NetworkTopologyOperationRequestMapper sdncRM;
+ @Autowired
+ private NetworkTopologyOperationRequestMapper sdncRM;
- public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
- public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network,
- ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
- CloudRegion cloudRegion) {
- return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
- GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
- requestContext, cloudRegion);
- }
+ public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
}
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
index a4c9b8fe05..960efea2f0 100644
--- 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
@@ -36,82 +36,81 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCServiceInstanceResources {
- @Autowired
- private ServiceTopologyOperationMapper sdncRM;
+ @Autowired
+ private ServiceTopologyOperationMapper sdncRM;
- /**
- * 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 GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- /**
- * 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 GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
- GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- /**
- * 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 GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
- GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
- /**
- * 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 GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance,
- Customer customer, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
- requestContext);
- }
+ /**
+ * 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 GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
+ }
}
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
index 1e3d655298..60cad78f5d 100644
--- 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
@@ -43,50 +43,50 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
- @Autowired
- private VfModuleTopologyOperationRequestMapper sdncRM;
+ @Autowired
+ private VfModuleTopologyOperationRequestMapper sdncRM;
- @Autowired
- private SDNCClient sdncClient;
+ @Autowired
+ private SDNCClient sdncClient;
- public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
- GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
- RequestContext requestContext) throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
+ GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
+ RequestContext requestContext) throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
- public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance) throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, null, null);
- }
+ public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance) throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
+ vnf, serviceInstance, null, null, null, null);
+ }
- public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
- public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
- String objectPath = vfModule.getSelflink();
- return sdncClient.get(objectPath);
- }
+ public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
+ String objectPath = vfModule.getSelflink();
+ return sdncClient.get(objectPath);
+ }
- public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
- public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
- return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
- null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- }
+ public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
+ null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ }
}
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
index d8f2e47224..954cbc1b1d 100644
--- 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
@@ -42,54 +42,60 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class);
- @Autowired
- private VnfTopologyOperationRequestMapper sdncRM;
-
- @Autowired
- private SDNCClient sdncClient;
-
- public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing);
- }
+ @Autowired
+ private VnfTopologyOperationRequestMapper sdncRM;
- public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.ACTIVATE,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
- }
+ @Autowired
+ private SDNCClient sdncClient;
-
- public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.DEACTIVATE,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
- }
+ public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, homing);
+ }
-
- public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- }
-
- public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE,vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- }
-
- public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext) {
- return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- }
-
- public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
- String queryPath = vnf.getSelflink();
- return sdncClient.get(queryPath);
- }
+ public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+
+ public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+
+ public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+ public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+ public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance,
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, false);
+ }
+
+ 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
index dac89a495d..e93b80c562 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -30,24 +29,23 @@ import org.springframework.stereotype.Component;
@Component
public class SDNOHealthCheckResources {
- @Autowired
- private InjectionHelper injectionHelper;
-
+ @Autowired
+ private InjectionHelper injectionHelper;
+
/**
* SDNO Call to Check Health Status
*
* @param vnf
- * @param requestContext *
+ * @param requestContext *
* @return healthCheckResult
- * @throws
- * @throws Exception
+ * @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);
+ String requestId = requestContext.getMsoRequestId();
+ String requestorId = requestContext.getRequestorId();
+ String vnfId = vnf.getVnfId();
+ UUID uuid = UUID.fromString(requestId);
- return injectionHelper.getSdnoValidator().healthDiagnostic(vnfId, uuid, requestorId);
- }
+ 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
index de59e6835e..939f53727d 100644
--- 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
@@ -23,7 +23,6 @@
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;
@@ -41,19 +40,23 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class);
-
- @Autowired
- private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
-
- public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException {
- return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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);
- }
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class);
+
+ @Autowired
+ private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
+
+ public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
+ OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
+ VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
+ throws IOException {
+ return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion,
+ orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, 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
index 737e9eeb37..c97ca8e0ea 100644
--- 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
@@ -39,19 +39,24 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class);
+ private static final Logger logger = LoggerFactory.getLogger(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 DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
- return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- }
+ @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 DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion,
+ ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance,
+ volumeGroup);
+ }
}
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
index cae4a19f20..732bba8489 100644
--- 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
@@ -23,9 +23,7 @@
package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
-
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
@@ -41,65 +39,63 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCClient {
- private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
+
+ @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() + "/";
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output =
+ STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
+ }
+
- @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() + "/";
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+ public String post(Object request, String url) throws MapperException, BadResponseException {
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+ STOClient.setTargetUrl(url);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output =
+ STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
+ }
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNResponse(output);
- }
-
-
- public String post(Object request, String url) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
- STOClient.setTargetUrl(url);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- 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();
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNGetResponse(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();
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output =
+ STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ 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
index 418e70a09e..e21f64accd 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.client.sdnc;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.client.exception.BadResponseException;
@@ -38,7 +37,6 @@ 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;
@@ -52,7 +50,8 @@ public class SdnCommonTasks {
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.";
+ private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON =
+ "ERROR: Could not convert SDNC pojo to json string.";
/***
*
@@ -67,8 +66,7 @@ public class SdnCommonTasks {
try {
jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
} catch (JsonProcessingException e) {
- logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(),
- COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
+ logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
"BPMN", ErrorCode.DataError.getValue(), e.getMessage());
throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
}
@@ -98,41 +96,41 @@ public class SdnCommonTasks {
* @return
* @throws BadResponseException
*/
- public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
- if (CollectionUtils.isEmpty(output)) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
- throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
- }
- LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output");
+ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
+ if (CollectionUtils.isEmpty(output)) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
+ ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
+ throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
+ }
+ LinkedHashMap<String, Object> embeddedResponse = (LinkedHashMap<String, Object>) output.get("output");
String responseCode = "";
String responseMessage = "";
if (embeddedResponse != null) {
- responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
+ responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE);
}
ObjectMapper objMapper = new ObjectMapper();
String jsonResponse;
- try {
- jsonResponse = objMapper.writeValueAsString(output);
- logger.debug(jsonResponse);
- } catch (JsonProcessingException e) {
- logger.warn("Could not convert SDNC Response to String", e);
- jsonResponse = "";
- }
- logger.info("ResponseCode: {} ResponseMessage: {}", responseCode, responseMessage);
- int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
- if (isHttpCodeSuccess(code)) {
- logger.info("Successful Response from SDNC");
- return jsonResponse;
- } else {
- String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
+ try {
+ jsonResponse = objMapper.writeValueAsString(output);
+ logger.debug(jsonResponse);
+ } catch (JsonProcessingException e) {
+ logger.warn("Could not convert SDNC Response to String", e);
+ jsonResponse = "";
+ }
+ logger.info("ResponseCode: {} ResponseMessage: {}", responseCode, responseMessage);
+ int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
+ if (isHttpCodeSuccess(code)) {
+ logger.info("Successful Response from SDNC");
+ return jsonResponse;
+ } else {
+ String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
+ ErrorCode.DataError.getValue(), errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
/***
*
* @param output
@@ -149,18 +147,16 @@ public class SdnCommonTasks {
logger.debug("Using object mapper");
String stringOutput = "";
try {
- stringOutput = objMapper.writeValueAsString(output);
- }
- catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC,
- "BPMN", ErrorCode.UnknownError.getValue(),
- BAD_RESPONSE_FROM_SDNC);
+ stringOutput = objMapper.writeValueAsString(output);
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN",
+ ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC);
throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
}
logger.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
index 08be73e3fd..15076fa45a 100644
--- 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
@@ -24,29 +24,34 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ConfigurationProperties(prefix="sdnc")
+@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;
- }
+ 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/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index 3ee560f4f4..5910975051 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -23,72 +23,76 @@ package org.onap.so.client.sdnc.beans;
import java.io.Serializable;
import java.time.Duration;
import java.util.UUID;
-
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
-public class SDNCRequest implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 4679678988657593282L;
- private String timeOut = "PT1H";
- private SDNCTopology topology;
- private String CorrelationValue = UUID.randomUUID().toString();
- private String CorrelationName = "SDNCCallback";
- private Object SDNCPayload;
-
-
- public String getTimeOut() {
- return timeOut;
- }
-
- public void setTimeOut(String timeOut) {
- this.timeOut = timeOut;
- }
-
- public SDNCTopology getTopology() {
- return topology;
- }
-
- public void setTopology(SDNCTopology topology) {
- this.topology = topology;
- }
-
- public String getCorrelationValue() {
- return CorrelationValue;
- }
- public void setCorrelationValue(String correlationValue) {
- CorrelationValue = correlationValue;
- }
- public String getCorrelationName() {
- return CorrelationName;
- }
- public void setCorrelationName(String correlationName) {
- CorrelationName = correlationName;
- }
- public Object getSDNCPayload() {
- return SDNCPayload;
- }
- public void setSDNCPayload(Object sDNCPayload) {
- SDNCPayload = sDNCPayload;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof SDNCRequest)) {
- return false;
- }
- SDNCRequest castOther = (SDNCRequest) other;
- return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
- .append(CorrelationName, castOther.CorrelationName).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
- }
+public class SDNCRequest implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4679678988657593282L;
+ private String timeOut = "PT1H";
+ private SDNCTopology topology;
+ private String CorrelationValue = UUID.randomUUID().toString();
+ private String CorrelationName = "SDNCCallback";
+ private Object SDNCPayload;
+
+
+ public String getTimeOut() {
+ return timeOut;
+ }
+
+ public void setTimeOut(String timeOut) {
+ this.timeOut = timeOut;
+ }
+
+ public SDNCTopology getTopology() {
+ return topology;
+ }
+
+ public void setTopology(SDNCTopology topology) {
+ this.topology = topology;
+ }
+
+ public String getCorrelationValue() {
+ return CorrelationValue;
+ }
+
+ public void setCorrelationValue(String correlationValue) {
+ CorrelationValue = correlationValue;
+ }
+
+ public String getCorrelationName() {
+ return CorrelationName;
+ }
+
+ public void setCorrelationName(String correlationName) {
+ CorrelationName = correlationName;
+ }
+
+ public Object getSDNCPayload() {
+ return SDNCPayload;
+ }
+
+ public void setSDNCPayload(Object sDNCPayload) {
+ SDNCPayload = sDNCPayload;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof SDNCRequest)) {
+ return false;
+ }
+ SDNCRequest castOther = (SDNCRequest) other;
+ return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
+ .append(CorrelationName, castOther.CorrelationName).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
+ }
}
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
index 876c7e002f..1718de9fe0 100644
--- 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
@@ -23,33 +23,38 @@ package org.onap.so.client.sdnc.beans;
import org.onap.sdnc.northbound.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;
- }
+ 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
index ba9fedccac..b9b04bc7b7 100644
--- 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
@@ -22,23 +22,23 @@ 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;
- }
+ 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
index a709e80220..fb5f24694b 100644
--- 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
@@ -21,24 +21,21 @@
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;
- }
+
+ 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
index 7b86756afa..6af8c2f9c5 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.net.URI;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput;
@@ -42,27 +41,29 @@ import org.springframework.stereotype.Component;
@Component(value = "sdncGCTopologyOperationRequestMapper")
public class GCTopologyOperationRequestMapper {
- @Autowired
+ @Autowired
private GeneralTopologyObjectMapper generalTopologyObjectMapper;
public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction,
- GenericResourceApiRequestActionEnumeration reqAction,
- ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf, String sdncReqId,URI callbackUri) {
+ GenericResourceApiRequestActionEnumeration reqAction, ServiceInstance serviceInstance,
+ RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf,
+ String sdncReqId, URI callbackUri) {
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
- GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true);
- GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null);
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUri.toString());
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, 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);
@@ -75,21 +76,21 @@ public class GCTopologyOperationRequestMapper {
public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction,
- ServiceInstance serviceInstance,
- RequestContext requestContext,
- Configuration vnrConfiguration, String sdncReqId, URI callbackUri) {
+ ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration,
+ String sdncReqId, URI callbackUri) {
- String msoRequestId = null;
- if (requestContext != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
+ String msoRequestId = null;
+ if (requestContext != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
- .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId,
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUri.toString());
+ GenericResourceApiRequestinformationRequestInformation requestInformation =
+ generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId,
GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
+ GenericResourceApiServiceinformationServiceInformation serviceInformation =
+ new GenericResourceApiServiceinformationServiceInformation();
serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =
new GenericResourceApiConfigurationinformationConfigurationInformation();
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
index 756e5b068e..a9611cbde5 100644
--- 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
@@ -23,7 +23,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation;
@@ -47,157 +46,183 @@ import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class GeneralTopologyObjectMapper {
-
- private static final Logger logger = LoggerFactory.getLogger(GeneralTopologyObjectMapper.class);
- private ObjectMapper mapper = new ObjectMapper();
-
- /*
- * Build GenericResourceApiRequestinformationRequestInformation
- */
- public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(String msoReqId, GenericResourceApiRequestActionEnumeration requestAction){
-
- GenericResourceApiRequestinformationRequestInformation requestInformation = new GenericResourceApiRequestinformationRequestInformation();
- requestInformation.setRequestId(msoReqId);
- 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.setFromPreload(null);
- networkInformation.setNetworkId(network.getNetworkId());
- networkInformation.setNetworkType(network.getNetworkType());
- networkInformation.setNetworkTechnology(network.getNetworkTechnology());
- 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, RequestContext requestContext, boolean includeModelInformation) throws MapperException {
- GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation();
- if (includeModelInformation) {
- if (vfModule.getModelInfoVfModule() == null) {
- throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
- }
- else {
- 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());
- if (requestContext != null && requestContext.getRequestParameters() != null) {
- vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
- }
- else {
- vfModuleInformation.setFromPreload(true);
- }
-
- return vfModuleInformation;
- }
-
-
- public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){
- return buildSdncRequestHeader(svcAction, sdncReqId, null);
- }
-
- public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId, String callbackUrl){
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader();
- sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
- sdncRequestHeader.setSvcRequestId(sdncReqId);
- sdncRequestHeader.setSvcNotificationUrl(callbackUrl);
- return sdncRequestHeader;
- }
+
+ private static final Logger logger = LoggerFactory.getLogger(GeneralTopologyObjectMapper.class);
+ private ObjectMapper mapper = new ObjectMapper();
+
+ /*
+ * Build GenericResourceApiRequestinformationRequestInformation
+ */
+ public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(
+ String msoReqId, GenericResourceApiRequestActionEnumeration requestAction) {
+
+ GenericResourceApiRequestinformationRequestInformation requestInformation =
+ new GenericResourceApiRequestinformationRequestInformation();
+ requestInformation.setRequestId(msoReqId);
+ 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.setFromPreload(null);
+ networkInformation.setNetworkId(network.getNetworkId());
+ networkInformation.setNetworkType(network.getNetworkType());
+ networkInformation.setNetworkTechnology(network.getNetworkTechnology());
+ 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, RequestContext requestContext,
+ boolean includeModelInformation) throws MapperException {
+ GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation =
+ new GenericResourceApiVfmoduleinformationVfModuleInformation();
+ if (includeModelInformation) {
+ if (vfModule.getModelInfoVfModule() == null) {
+ throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
+ } else {
+ 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());
+ if (requestContext != null && requestContext.getRequestParameters() != null) {
+ vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
+ } else {
+ vfModuleInformation.setFromPreload(true);
+ }
+
+ return vfModuleInformation;
+ }
+
+
+ public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction,
+ String sdncReqId) {
+ return buildSdncRequestHeader(svcAction, sdncReqId, null);
+ }
+
+ public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction,
+ String sdncReqId, String callbackUrl) {
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ new GenericResourceApiSdncrequestheaderSdncRequestHeader();
+ sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
+ sdncRequestHeader.setSvcRequestId(sdncReqId);
+ sdncRequestHeader.setSvcNotificationUrl(callbackUrl);
+ return sdncRequestHeader;
+ }
/**
- * Build ConfigurationInformation
+ * Build ConfigurationInformation
+ *
* @param configuration
* @param includeModelInformation
* @return
*/
- public GenericResourceApiConfigurationinformationConfigurationInformation buildConfigurationInformation(Configuration configuration, boolean includeModelInformation) {
- GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = new GenericResourceApiConfigurationinformationConfigurationInformation();
+ 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();
+ if (includeModelInformation) {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation =
+ new GenericResourceApiOnapmodelinformationOnapModelInformation();
onapModelInformation.setModelInvariantUuid(configuration.getModelInfoConfiguration().getModelInvariantId());
onapModelInformation.setModelUuid(configuration.getModelInfoConfiguration().getModelVersionId());
- onapModelInformation.setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId());
+ onapModelInformation
+ .setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId());
configurationInformation.setOnapModelInformation(onapModelInformation);
}
return configurationInformation;
@@ -205,35 +230,38 @@ public class GeneralTopologyObjectMapper {
/**
- * Build GcRequestInformation
+ * Build GcRequestInformation
+ *
* @param vnf
* @param genericResourceApiParam
* @return
*/
- public GenericResourceApiGcrequestinputGcRequestInput buildGcRequestInformation(GenericVnf vnf,GenericResourceApiParam genericResourceApiParam) {
- GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = new GenericResourceApiGcrequestinputGcRequestInput();
+ public GenericResourceApiGcrequestinputGcRequestInput buildGcRequestInformation(GenericVnf vnf,
+ GenericResourceApiParam genericResourceApiParam) {
+ GenericResourceApiGcrequestinputGcRequestInput gcRequestInput =
+ new GenericResourceApiGcrequestinputGcRequestInput();
gcRequestInput.setVnfId(vnf.getVnfId());
- if(genericResourceApiParam != null) {
+ if (genericResourceApiParam != null) {
gcRequestInput.setInputParameters(genericResourceApiParam);
}
- return gcRequestInput;
- }
-
-
+ return gcRequestInput;
+ }
+
+
public String mapUserParamValue(Object value) {
- if (value == null) {
- return null;
- } else {
- if (value instanceof Map || value instanceof Set || value instanceof List) {
- try {
- return mapper.writeValueAsString(value);
- } catch (JsonProcessingException e) {
- logger.error("could not map value to string", e);
- throw new IllegalArgumentException(e);
- }
- } else {
- return value.toString();
- }
- }
+ if (value == null) {
+ return null;
+ } else {
+ if (value instanceof Map || value instanceof Set || value instanceof List) {
+ try {
+ return mapper.writeValueAsString(value);
+ } catch (JsonProcessingException e) {
+ logger.error("could not map value to string", e);
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+ return value.toString();
+ }
+ }
}
}
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
index aef7e9e044..b1c95154c6 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput;
@@ -48,59 +47,68 @@ import org.springframework.stereotype.Component;
*/
@Component
public class NetworkTopologyOperationRequestMapper {
-
- @Autowired
- private GeneralTopologyObjectMapper 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();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
- GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network);
- GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion);
+ @Autowired
+ private GeneralTopologyObjectMapper 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();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, 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);
- req.setRequestInformation(requestInformation);
- req.setSdncRequestHeader(sdncRequestHeader);
- req.setServiceInformation(serviceInformation);
- req.setNetworkInformation(networkInformation);
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
+ networkInputParameters.addParamItem(paramItem);
+ networkRequestInput.setNetworkInputParameters(networkInputParameters);
+ }
+ }
- if (requestContext != null && requestContext.getUserParams() != null) {
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- networkInputParameters.addParamItem(paramItem);
- networkRequestInput.setNetworkInputParameters(networkInputParameters);
- }
- }
+ req.setNetworkRequestInput(networkRequestInput);
+ return req;
+ }
- 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.setCloudOwner(cloudRegion.getCloudOwner());
- 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;
- }
+ /*
+ * Private helper to build GenericResourceApiNetworkrequestinputNetworkRequestInput
+ */
+ private GenericResourceApiNetworkrequestinputNetworkRequestInput buildNetworkRequestInput(L3Network network,
+ ServiceInstance serviceInstance, CloudRegion cloudRegion) {
+ GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput =
+ new GenericResourceApiNetworkrequestinputNetworkRequestInput();
+ networkRequestInput.setTenant(cloudRegion.getTenantId());
+ networkRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
+ 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
index cdb4ab96aa..b5957b3009 100644
--- 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
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -40,45 +39,51 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
-public class ServiceTopologyOperationMapper{
+public class ServiceTopologyOperationMapper {
+
+ @Autowired
+ public GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ public GenericResourceApiServiceOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+
+ String sdncReqId = UUID.randomUUID().toString();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
+ GenericResourceApiServiceinformationServiceInformation servInfo =
+ generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiServicerequestinputServiceRequestInput servReqInfo =
+ new GenericResourceApiServicerequestinputServiceRequestInput();
+
+ servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
- @Autowired
- public GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- public GenericResourceApiServiceOperationInformation reqMapper (SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+ servOpInput.setSdncRequestHeader(sdncRequestHeader);
+ servOpInput.setRequestInformation(reqInfo);
+ servOpInput.setServiceInformation(servInfo);
+ servOpInput.setServiceRequestInput(servReqInfo);
- String sdncReqId = UUID.randomUUID().toString();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
- GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
- GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
-
- servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
-
- servOpInput.setSdncRequestHeader(sdncRequestHeader);
- servOpInput.setRequestInformation(reqInfo);
- servOpInput.setServiceInformation(servInfo);
- servOpInput.setServiceRequestInput(servReqInfo);
-
- if(requestContext != null && requestContext.getUserParams()!=null){
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
- serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
- GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- serviceInputParameters.addParamItem(paramItem );
- serviceRequestInput.serviceInputParameters(serviceInputParameters);
- servOpInput.setServiceRequestInput(serviceRequestInput );
- }
- }
- return servOpInput;
- }
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput =
+ new GenericResourceApiServicerequestinputServiceRequestInput();
+ serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
+ GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(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
index 86c718d165..6627625d62 100644
--- 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
@@ -24,7 +24,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -53,134 +52,146 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class VfModuleTopologyOperationRequestMapper {
- private static final Logger logger = LoggerFactory.getLogger(VfModuleTopologyOperationRequestMapper.class);
-
- @Autowired
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) throws MapperException {
- 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();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
-
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId,
- requestAction);
- GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
- GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
- GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper.buildVfModuleInformation(vfModule, vnf, serviceInstance, requestContext, 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());
- vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
- }
- 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, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- vfModuleInputParameters.addParamItem(paramItem);
- }
- }
-
- if (vfModule.getCloudParams() != null) {
- for (Map.Entry<String, String> entry : vfModule.getCloudParams().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) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
- ErrorCode.UnknownError.getValue(), e.getMessage());
- }
- }
- return objectPath;
- }
+ private static final Logger logger = LoggerFactory.getLogger(VfModuleTopologyOperationRequestMapper.class);
+
+ @Autowired
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ String sdncAssignResponse) throws MapperException {
+ 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();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper
+ .buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
+ GenericResourceApiVnfinformationVnfInformation vnfInformation =
+ generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
+ GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper
+ .buildVfModuleInformation(vfModule, vnf, serviceInstance, requestContext, 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());
+ vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
+ }
+ 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, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
+ vfModuleInputParameters.addParamItem(paramItem);
+ }
+ }
+
+ if (vfModule.getCloudParams() != null) {
+ for (Map.Entry<String, String> entry : vfModule.getCloudParams().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) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
+ ErrorCode.UnknownError.getValue(), 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
index 85e5b85529..f31bff988a 100644
--- 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
@@ -24,7 +24,6 @@ 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.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -52,93 +51,96 @@ import org.springframework.stereotype.Component;
@Component
public class VnfTopologyOperationRequestMapper {
- @Autowired
- private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+ @Autowired
+ private GeneralTopologyObjectMapper 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();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
+ GenericResourceApiServiceinformationServiceInformation serviceInformation =
+ generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiVnfinformationVnfInformation vnfInformation =
+ generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, true);
+ GenericResourceApiVnfrequestinputVnfRequestInput vnfRequestInput =
+ new GenericResourceApiVnfrequestinputVnfRequestInput();
- 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();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper
- .buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
- .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, 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());
+ vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
- vnfRequestInput.setTenant(cloudRegion.getTenantId());
- vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
- vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
-
- if (StringUtils.isNotBlank(vnf.getVnfName())) {
- vnfRequestInput.setVnfName(vnf.getVnfName());
- }
+ if (StringUtils.isNotBlank(vnf.getVnfName())) {
+ vnfRequestInput.setVnfName(vnf.getVnfName());
+ }
- req.setRequestInformation(requestInformation);
- req.setSdncRequestHeader(sdncRequestHeader);
- req.setServiceInformation(serviceInformation);
- req.setVnfInformation(vnfInformation);
+ req.setRequestInformation(requestInformation);
+ req.setSdncRequestHeader(sdncRequestHeader);
+ req.setServiceInformation(serviceInformation);
+ req.setVnfInformation(vnfInformation);
- GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam();
- if (requestContext != null && requestContext.getUserParams() != null) {
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(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>();
+ GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam();
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(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_L3_NETWORK
- .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
- GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds();
- instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId());
- networkInstanceGroupIdList.add(instanceGroupId);
- }
- }
+ for (InstanceGroup instanceGroup : instanceGroups) {
+ if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
+ .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;
- }
+ 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
index 5a48a757bc..f7aad558b2 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.client.sniro;
import java.util.LinkedHashMap;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
@@ -38,82 +37,83 @@ import org.springframework.core.ParameterizedTypeReference;
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 Logger logger = LoggerFactory.getLogger(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{
- logger.trace("Started Sniro Client Post Demands");
- String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
- logger.debug("Post demands url: {}", url);
- logger.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<String, Object>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- validator.validateDemandsResponse(response);
- logger.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 {
- logger.trace("Started Sniro Client Post Release");
- String url = UrnPropertiesReader.getVariable("sniro.conductor.host") + UrnPropertiesReader.getVariable("sniro.conductor.uri");
- logger.debug("Post release url: {}", url);
- logger.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<String, Object>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- SniroValidator v = new SniroValidator();
- v.validateReleaseResponse(response);
- logger.trace("Completed Sniro Client Post Release");
- }
+ private static final Logger logger = LoggerFactory.getLogger(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 {
+ logger.trace("Started Sniro Client Post Demands");
+ String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
+ logger.debug("Post demands url: {}", url);
+ logger.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<String, Object>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(),
+ new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ validator.validateDemandsResponse(response);
+ logger.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 {
+ logger.trace("Started Sniro Client Post Release");
+ String url = UrnPropertiesReader.getVariable("sniro.conductor.host")
+ + UrnPropertiesReader.getVariable("sniro.conductor.uri");
+ logger.debug("Post release url: {}", url);
+ logger.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<String, Object>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(),
+ new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ SniroValidator v = new SniroValidator();
+ v.validateReleaseResponse(response);
+ logger.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
index dcccd319c6..a448082cfe 100644
--- 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
@@ -24,12 +24,9 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -39,101 +36,103 @@ import org.springframework.stereotype.Component;
@Component
public class SniroValidator {
- private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class);
-
- /**
- * Validates the synchronous homing response from sniro manager
- *
- * @throws BadResponseException
- */
- public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
- logger.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")){
- logger.debug("Sniro Managers synchronous response indicates accepted");
- }else{
- String message = jsonResponse.getString("statusMessage");
- if(isNotBlank(message)){
- logger.debug("Sniro Managers response indicates failed: " + message);
- }else{
- logger.debug("Sniro Managers response indicates failed: no status message provided");
- message = "error message not provided";
- }
- throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message);
- }
- }else{
- logger.debug("Sniro Managers synchronous response does not contain: request status");
- throw new BadResponseException("Sniro Managers synchronous response does not contain: request status");
- }
- }else{
- logger.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{
- logger.debug("Validating Sniro Managers asynchronous callback response");
- if(isNotBlank(response)) {
- JSONObject jsonResponse = new JSONObject(response);
- if(!jsonResponse.has("serviceException")){
- logger.debug("Sniro Managers asynchronous response is valid");
- }else{
- String message = jsonResponse.getJSONObject("serviceException").getString("text");
- if(isNotBlank(message)){
- logger.debug("Sniro Managers response contains a service exception: " + message);
- }else{
- logger.debug("Sniro Managers response contains a service exception: no service exception text provided");
- message = "error message not provided";
- }
- throw new BadResponseException("Sniro Managers asynchronous response contains a service exception: " + message);
- }
- }else{
- logger.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<String, Object> response) throws BadResponseException {
- logger.debug("Validating Sniro Conductors response");
- if(!response.isEmpty()){
- String status = (String) response.get("status");
- if(isNotBlank(status)){
- if(status.equals("success")){
- logger.debug("Sniro Conductors synchronous response indicates success");
- }else{
- String message = (String) response.get("message");
- if(isNotBlank(message)){
- logger.debug("Sniro Conductors response indicates failed: " + message);
- }else{
- logger.debug("Sniro Conductors response indicates failed: error message not provided");
- message = "error message not provided";
- }
- throw new BadResponseException("Sniro Conductors synchronous response indicates failed: " + message);
- }
- }else{
- logger.debug("Sniro Managers Conductors response does not contain: status");
- throw new BadResponseException("Sniro Conductors synchronous response does not contain: status");
- }
- }else{
- logger.debug("Sniro Conductors response is empty");
- throw new BadResponseException("Sniro Conductors response is empty");
- }
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class);
+
+ /**
+ * Validates the synchronous homing response from sniro manager
+ *
+ * @throws BadResponseException
+ */
+ public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
+ logger.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")) {
+ logger.debug("Sniro Managers synchronous response indicates accepted");
+ } else {
+ String message = jsonResponse.getString("statusMessage");
+ if (isNotBlank(message)) {
+ logger.debug("Sniro Managers response indicates failed: " + message);
+ } else {
+ logger.debug("Sniro Managers response indicates failed: no status message provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message);
+ }
+ } else {
+ logger.debug("Sniro Managers synchronous response does not contain: request status");
+ throw new BadResponseException("Sniro Managers synchronous response does not contain: request status");
+ }
+ } else {
+ logger.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 {
+ logger.debug("Validating Sniro Managers asynchronous callback response");
+ if (isNotBlank(response)) {
+ JSONObject jsonResponse = new JSONObject(response);
+ if (!jsonResponse.has("serviceException")) {
+ logger.debug("Sniro Managers asynchronous response is valid");
+ } else {
+ String message = jsonResponse.getJSONObject("serviceException").getString("text");
+ if (isNotBlank(message)) {
+ logger.debug("Sniro Managers response contains a service exception: " + message);
+ } else {
+ logger.debug(
+ "Sniro Managers response contains a service exception: no service exception text provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException(
+ "Sniro Managers asynchronous response contains a service exception: " + message);
+ }
+ } else {
+ logger.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<String, Object> response) throws BadResponseException {
+ logger.debug("Validating Sniro Conductors response");
+ if (!response.isEmpty()) {
+ String status = (String) response.get("status");
+ if (isNotBlank(status)) {
+ if (status.equals("success")) {
+ logger.debug("Sniro Conductors synchronous response indicates success");
+ } else {
+ String message = (String) response.get("message");
+ if (isNotBlank(message)) {
+ logger.debug("Sniro Conductors response indicates failed: " + message);
+ } else {
+ logger.debug("Sniro Conductors response indicates failed: error message not provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException(
+ "Sniro Conductors synchronous response indicates failed: " + message);
+ }
+ } else {
+ logger.debug("Sniro Managers Conductors response does not contain: status");
+ throw new BadResponseException("Sniro Conductors synchronous response does not contain: status");
+ }
+ } else {
+ logger.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/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index 3b7e509752..cded23aad2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -22,45 +22,43 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.List;
-
import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Candidate implements Serializable{
+public class Candidate implements Serializable {
- private static final long serialVersionUID = -5474502255533410907L;
+ private static final long serialVersionUID = -5474502255533410907L;
- @JsonProperty("identifierType")
- private CandidateType identifierType;
- @JsonProperty("identifiers")
- private List<String> identifiers;
- @JsonProperty("cloudOwner")
- private String cloudOwner;
+ @JsonProperty("identifierType")
+ private CandidateType identifierType;
+ @JsonProperty("identifiers")
+ private List<String> identifiers;
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
- public CandidateType getIdentifierType(){
- return identifierType;
- }
+ public CandidateType getIdentifierType() {
+ return identifierType;
+ }
- public void setIdentifierType(CandidateType identifierType){
- this.identifierType = identifierType;
- }
+ public void setIdentifierType(CandidateType identifierType) {
+ this.identifierType = identifierType;
+ }
- public List<String> getIdentifiers(){
- return identifiers;
- }
+ public List<String> getIdentifiers() {
+ return identifiers;
+ }
- public void setIdentifiers(List<String> identifiers){
- this.identifiers = identifiers;
- }
+ public void setIdentifiers(List<String> identifiers) {
+ this.identifiers = identifiers;
+ }
- public String getCloudOwner(){
- return cloudOwner;
- }
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
- public void setCloudOwner(String cloudOwner){
- this.cloudOwner = cloudOwner;
- }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
}
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
index 6e60bfa293..9ac8727a0f 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.sniro.beans;
import java.util.Map;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -29,33 +28,35 @@ import org.springframework.context.annotation.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;
- }
+ 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/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
index ed7875f286..19378cdbfa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
@@ -22,63 +22,62 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Demand implements Serializable{
+public class Demand implements Serializable {
- private static final long serialVersionUID = 5676094538091859816L;
+ private static final long serialVersionUID = 5676094538091859816L;
- @JsonProperty("serviceResourceId")
- private String serviceResourceId;
- @JsonProperty("resourceModuleName")
- private String resourceModuleName;
- @JsonProperty("resourceModelInfo")
- private ModelInfo modelInfo;
- @JsonProperty("requiredCandidates")
- private List<Candidate> requiredCandidates;
- @JsonProperty("excludedCandidates")
- private List<Candidate> excludedCandidates;
+ @JsonProperty("serviceResourceId")
+ private String serviceResourceId;
+ @JsonProperty("resourceModuleName")
+ private String resourceModuleName;
+ @JsonProperty("resourceModelInfo")
+ private ModelInfo modelInfo;
+ @JsonProperty("requiredCandidates")
+ private List<Candidate> requiredCandidates;
+ @JsonProperty("excludedCandidates")
+ private List<Candidate> excludedCandidates;
- public List<Candidate> getRequiredCandidates(){
- return requiredCandidates;
- }
+ public List<Candidate> getRequiredCandidates() {
+ return requiredCandidates;
+ }
- public void setRequiredCandidates(List<Candidate> requiredCandidates){
- this.requiredCandidates = requiredCandidates;
- }
+ public void setRequiredCandidates(List<Candidate> requiredCandidates) {
+ this.requiredCandidates = requiredCandidates;
+ }
- public List<Candidate> getExcludedCandidates(){
- return excludedCandidates;
- }
+ public List<Candidate> getExcludedCandidates() {
+ return excludedCandidates;
+ }
- public void setExcludedCandidates(List<Candidate> excludedCandidates){
- this.excludedCandidates = excludedCandidates;
- }
+ public void setExcludedCandidates(List<Candidate> excludedCandidates) {
+ this.excludedCandidates = excludedCandidates;
+ }
- public String getServiceResourceId(){
- return serviceResourceId;
- }
+ public String getServiceResourceId() {
+ return serviceResourceId;
+ }
- public void setServiceResourceId(String serviceResourceId){
- this.serviceResourceId = serviceResourceId;
- }
+ public void setServiceResourceId(String serviceResourceId) {
+ this.serviceResourceId = serviceResourceId;
+ }
- public String getResourceModuleName(){
- return resourceModuleName;
- }
+ public String getResourceModuleName() {
+ return resourceModuleName;
+ }
- public void setResourceModuleName(String resourceModuleName){
- this.resourceModuleName = resourceModuleName;
- }
+ public void setResourceModuleName(String resourceModuleName) {
+ this.resourceModuleName = resourceModuleName;
+ }
- public ModelInfo getModelInfo(){
- return modelInfo;
- }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
- public void setModelInfo(ModelInfo modelInfo){
- this.modelInfo = modelInfo;
- }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
index 209792b4d7..d71b4ec5fc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
@@ -23,23 +23,22 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class LicenseInfo implements Serializable{
+public class LicenseInfo implements Serializable {
- private static final long serialVersionUID = 6878164369491185856L;
+ private static final long serialVersionUID = 6878164369491185856L;
- @JsonProperty("licenseDemands")
- private List<Demand> demands = new ArrayList<Demand>();
+ @JsonProperty("licenseDemands")
+ private List<Demand> demands = new ArrayList<Demand>();
- public List<Demand> getDemands(){
- return demands;
- }
+ public List<Demand> getDemands() {
+ return demands;
+ }
- public void setDemands(List<Demand> demands){
- this.demands = demands;
- }
+ public void setDemands(List<Demand> demands) {
+ this.demands = demands;
+ }
}
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
index 0070f2fe04..70b1a37b5e 100644
--- 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
@@ -21,7 +21,6 @@
package org.onap.so.client.sniro.beans;
import java.util.Map;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -29,30 +28,34 @@ import org.springframework.context.annotation.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;
- }
+ 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/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
index 34d746b8d2..6c1932e344 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
@@ -21,62 +21,56 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-@JsonPropertyOrder({
- "modelName",
- "modelVersionId",
- "modelVersion",
- "modelInvariantId"
-})
+@JsonPropertyOrder({"modelName", "modelVersionId", "modelVersion", "modelInvariantId"})
@JsonRootName("modelInfo")
-public class ModelInfo implements Serializable{
+public class ModelInfo implements Serializable {
- private static final long serialVersionUID = 1488642558601651075L;
+ private static final long serialVersionUID = 1488642558601651075L;
- @JsonProperty("modelInvariantId")
- private String modelInvariantId;
- @JsonProperty("modelVersionId")
- private String modelVersionId;
- @JsonProperty("modelName")
- private String modelName;
- @JsonProperty("modelVersion")
- private String modelVersion;
+ @JsonProperty("modelInvariantId")
+ private String modelInvariantId;
+ @JsonProperty("modelVersionId")
+ private String modelVersionId;
+ @JsonProperty("modelName")
+ private String modelName;
+ @JsonProperty("modelVersion")
+ private String modelVersion;
- public String getModelInvariantId(){
- return modelInvariantId;
- }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
- public void setModelInvariantId(String modelInvariantId){
- this.modelInvariantId = modelInvariantId;
- }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
- public String getModelVersionId(){
- return modelVersionId;
- }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
- public void setModelVersionId(String modelVersionId){
- this.modelVersionId = modelVersionId;
- }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
- public String getModelName(){
- return modelName;
- }
+ public String getModelName() {
+ return modelName;
+ }
- public void setModelName(String modelName){
- this.modelName = modelName;
- }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
- public String getModelVersion(){
- return modelVersion;
- }
+ public String getModelVersion() {
+ return modelVersion;
+ }
- public void setModelVersion(String modelVersion){
- this.modelVersion = modelVersion;
- }
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
index 9ae2c72798..ae13903a22 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
@@ -23,53 +23,48 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.annotation.JsonRootName;
-@JsonPropertyOrder({
- "subscriberInfo",
- "placementDemands",
- "requestParameters"
-})
+@JsonPropertyOrder({"subscriberInfo", "placementDemands", "requestParameters"})
@JsonRootName("placementInfo")
-public class PlacementInfo implements Serializable{
+public class PlacementInfo implements Serializable {
- private static final long serialVersionUID = -964488472247386556L;
+ private static final long serialVersionUID = -964488472247386556L;
- @JsonProperty("subscriberInfo")
- private SubscriberInfo subscriberInfo;
- @JsonProperty("placementDemands")
- private List<Demand> demands = new ArrayList<Demand>();
- @JsonRawValue
- @JsonProperty("requestParameters")
- private String requestParameters;
+ @JsonProperty("subscriberInfo")
+ private SubscriberInfo subscriberInfo;
+ @JsonProperty("placementDemands")
+ private List<Demand> demands = new ArrayList<Demand>();
+ @JsonRawValue
+ @JsonProperty("requestParameters")
+ private String requestParameters;
- public SubscriberInfo getSubscriberInfo(){
- return subscriberInfo;
- }
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
- public void setSubscriberInfo(SubscriberInfo subscriberInfo){
- this.subscriberInfo = subscriberInfo;
- }
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
- public List<Demand> getDemands(){
- return demands;
- }
+ public List<Demand> getDemands() {
+ return demands;
+ }
- public void setDemands(List<Demand> demands){
- this.demands = demands;
- }
+ public void setDemands(List<Demand> demands) {
+ this.demands = demands;
+ }
- public String getRequestParameters(){
- return requestParameters;
- }
+ public String getRequestParameters() {
+ return requestParameters;
+ }
- public void setRequestParameters(String requestParameters){
- this.requestParameters = requestParameters;
- }
+ public void setRequestParameters(String requestParameters) {
+ this.requestParameters = requestParameters;
+ }
}
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
index e92b5d1ca3..fc6aec7d14 100644
--- 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
@@ -21,77 +21,75 @@
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;
- @JsonProperty("callbackUrl")
- String callbackUrl;
- @JsonProperty("sourceId")
- String sourceId = "mso";
- @JsonProperty("requestType")
- String requestType;
- @JsonProperty("timeout")
- long timeout;
-
- 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;
- }
-
- public String getCallbackUrl(){
- return callbackUrl;
- }
-
- public void setCallbackUrl(String callbackUrl){
- this.callbackUrl = callbackUrl;
- }
-
- public String getSourceId(){
- return sourceId;
- }
-
- public void setSourceId(String sourceId){
- this.sourceId = sourceId;
- }
-
- public String getRequestType(){
- return requestType;
- }
-
- public void setRequestType(String requestType){
- this.requestType = requestType;
- }
-
- public long getTimeout(){
- return timeout;
- }
-
- public void setTimeout(long timeout){
- this.timeout = timeout;
- }
+public class RequestInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("transactionId")
+ String transactionId;
+ @JsonProperty("requestId")
+ String requestId;
+ @JsonProperty("callbackUrl")
+ String callbackUrl;
+ @JsonProperty("sourceId")
+ String sourceId = "mso";
+ @JsonProperty("requestType")
+ String requestType;
+ @JsonProperty("timeout")
+ long timeout;
+
+ 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;
+ }
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ public void setSourceId(String sourceId) {
+ this.sourceId = sourceId;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
}
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
index 8441a01072..b5d40a8e80 100644
--- 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
@@ -21,34 +21,33 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Resource implements Serializable{
+public class Resource implements Serializable {
- private static final long serialVersionUID = 5949861520571440421L;
+ private static final long serialVersionUID = 5949861520571440421L;
- @JsonProperty("service-resource-id")
- private String serviceResourceId;
- @JsonProperty("status")
- private String status;
+ @JsonProperty("service-resource-id")
+ private String serviceResourceId;
+ @JsonProperty("status")
+ private String status;
- public String getServiceResourceId(){
- return serviceResourceId;
- }
+ public String getServiceResourceId() {
+ return serviceResourceId;
+ }
- public void setServiceResourceId(String serviceResourceId){
- this.serviceResourceId = serviceResourceId;
- }
+ public void setServiceResourceId(String serviceResourceId) {
+ this.serviceResourceId = serviceResourceId;
+ }
- public String getStatus(){
- return status;
- }
+ public String getStatus() {
+ return status;
+ }
- public void setStatus(String status){
- this.status = 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/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
index f035013cd5..8b6f234c1e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
@@ -21,62 +21,56 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
-@JsonPropertyOrder({
- "modelInfo",
- "serviceRole",
- "serviceInstanceId",
- "serviceName"
-})
+@JsonPropertyOrder({"modelInfo", "serviceRole", "serviceInstanceId", "serviceName"})
@JsonRootName("serviceInfo")
-public class ServiceInfo implements Serializable{
+public class ServiceInfo implements Serializable {
- private static final long serialVersionUID = -6866022419398548585L;
+ private static final long serialVersionUID = -6866022419398548585L;
- @JsonProperty("serviceInstanceId")
- private String serviceInstanceId;
- @JsonProperty("serviceName")
- private String serviceName;
- @JsonProperty("serviceRole")
- private String serviceRole;
- @JsonProperty("modelInfo")
- private ModelInfo modelInfo;
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ @JsonProperty("serviceName")
+ private String serviceName;
+ @JsonProperty("serviceRole")
+ private String serviceRole;
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
- public String getServiceInstanceId(){
- return serviceInstanceId;
- }
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
- public void setServiceInstanceId(String serviceInstanceId){
- this.serviceInstanceId = serviceInstanceId;
- }
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
- public String getServiceName(){
- return serviceName;
- }
+ public String getServiceName() {
+ return serviceName;
+ }
- public void setServiceName(String serviceName){
- this.serviceName = serviceName;
- }
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
- public String getServiceRole(){
- return serviceRole;
- }
+ public String getServiceRole() {
+ return serviceRole;
+ }
- public void setServiceRole(String serviceRole){
- this.serviceRole = serviceRole;
- }
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
- public ModelInfo getModelInfo(){
- return modelInfo;
- }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
- public void setModelInfo(ModelInfo modelInfo){
- this.modelInfo = modelInfo;
- }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
}
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
index 11417d646c..f632424c26 100644
--- 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
@@ -25,7 +25,6 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -35,32 +34,32 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SniroConductorRequest implements Serializable{
+public class SniroConductorRequest implements Serializable {
- private static final long serialVersionUID = 1906052095861777655L;
- private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
+ private static final long serialVersionUID = 1906052095861777655L;
+ private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
- @JsonProperty("release-locks")
- private List<Resource> resources = new ArrayList<Resource>();
+ @JsonProperty("release-locks")
+ private List<Resource> resources = new ArrayList<Resource>();
- public List<Resource> getResources(){
- return resources;
- }
+ 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){
- logger.error("Unable to convert SniroConductorRequest to string", e);
- }
- return json;
- }
+ @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) {
+ logger.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
index c1e376814f..4babbe5c39 100644
--- 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
@@ -23,7 +23,6 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -33,60 +32,67 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SniroManagerRequest implements Serializable{
-
- private static final long serialVersionUID = -1541132882892163132L;
- private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
-
- @JsonProperty("requestInfo")
- private RequestInfo requestInformation;
- @JsonProperty("serviceInfo")
- private ServiceInfo serviceInformation;
- @JsonProperty("placementInfo")
- private PlacementInfo placementInformation;
- @JsonProperty("licenseInfo")
- private LicenseInfo licenseInformation;
-
-
- public RequestInfo getRequestInformation() {
- return requestInformation;
- }
- public void setRequestInformation(RequestInfo requestInformation) {
- this.requestInformation = requestInformation;
- }
- public ServiceInfo getServiceInformation() {
- return serviceInformation;
- }
- public void setServiceInformation(ServiceInfo serviceInformation) {
- this.serviceInformation = serviceInformation;
- }
- public PlacementInfo getPlacementInformation() {
- return placementInformation;
- }
- public void setPlacementInformation(PlacementInfo placementInformation) {
- this.placementInformation = placementInformation;
- }
- public LicenseInfo getLicenseInformation() {
- return licenseInformation;
- }
- public void setLicenseInformation(LicenseInfo 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){
- logger.error("Unable to convert SniroManagerRequest to string", e);
- }
- return json.replaceAll("\\\\", "");
- }
+public class SniroManagerRequest implements Serializable {
+
+ private static final long serialVersionUID = -1541132882892163132L;
+ private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
+
+ @JsonProperty("requestInfo")
+ private RequestInfo requestInformation;
+ @JsonProperty("serviceInfo")
+ private ServiceInfo serviceInformation;
+ @JsonProperty("placementInfo")
+ private PlacementInfo placementInformation;
+ @JsonProperty("licenseInfo")
+ private LicenseInfo licenseInformation;
+
+
+ public RequestInfo getRequestInformation() {
+ return requestInformation;
+ }
+
+ public void setRequestInformation(RequestInfo requestInformation) {
+ this.requestInformation = requestInformation;
+ }
+
+ public ServiceInfo getServiceInformation() {
+ return serviceInformation;
+ }
+
+ public void setServiceInformation(ServiceInfo serviceInformation) {
+ this.serviceInformation = serviceInformation;
+ }
+
+ public PlacementInfo getPlacementInformation() {
+ return placementInformation;
+ }
+
+ public void setPlacementInformation(PlacementInfo placementInformation) {
+ this.placementInformation = placementInformation;
+ }
+
+ public LicenseInfo getLicenseInformation() {
+ return licenseInformation;
+ }
+
+ public void setLicenseInformation(LicenseInfo 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) {
+ logger.error("Unable to convert SniroManagerRequest to string", e);
+ }
+ return json.replaceAll("\\\\", "");
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
index b6b09cbf80..eaf8b6e379 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
@@ -21,46 +21,45 @@
package org.onap.so.client.sniro.beans;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("subscriberInfo")
-public class SubscriberInfo implements Serializable{
+public class SubscriberInfo implements Serializable {
- private static final long serialVersionUID = -6350949051379748872L;
+ private static final long serialVersionUID = -6350949051379748872L;
- @JsonProperty("globalSubscriberId")
- private String globalSubscriberId;
- @JsonProperty("subscriberName")
- private String subscriberName;
- @JsonProperty("subscriberCommonSiteId")
- private String subscriberCommonSiteId;
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+ @JsonProperty("subscriberName")
+ private String subscriberName;
+ @JsonProperty("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
- public String getGlobalSubscriberId(){
- return globalSubscriberId;
- }
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
- public void setGlobalSubscriberId(String globalSubscriberId){
- this.globalSubscriberId = globalSubscriberId;
- }
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
- public String getSubscriberName(){
- return subscriberName;
- }
+ public String getSubscriberName() {
+ return subscriberName;
+ }
- public void setSubscriberName(String subscriberName){
- this.subscriberName = subscriberName;
- }
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
- public String getSubscriberCommonSiteId(){
- return subscriberCommonSiteId;
- }
+ public String getSubscriberCommonSiteId() {
+ return subscriberCommonSiteId;
+ }
- public void setSubscriberCommonSiteId(String subscriberCommonSiteId){
- this.subscriberCommonSiteId = subscriberCommonSiteId;
- }
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
index 519afe6f2d..a78dffb4e0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
@@ -1,155 +1,154 @@
package org.onap.so.client.ticket;
public class ExternalTicket {
- private String requestId;
- private String nfRole;
- private String currentActivity;
- private String description;
- private String subscriptionServiceType;
- private String requestorId;
- private String timeout;
- private String errorSource;
- private String errorCode;
- private String errorMessage;
- private String workStep;
+ private String requestId;
+ private String nfRole;
+ private String currentActivity;
+ private String description;
+ private String subscriptionServiceType;
+ private String requestorId;
+ private String timeout;
+ private String errorSource;
+ private String errorCode;
+ private String errorMessage;
+ private String workStep;
- public String getRequestId() {
- return requestId;
- }
+ public String getRequestId() {
+ return requestId;
+ }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
- public String getNfRole() {
- return nfRole;
- }
+ public String getNfRole() {
+ return nfRole;
+ }
- public void setNfRole(String nfRole) {
- this.nfRole = nfRole;
- }
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
- public String getCurrentActivity() {
- return currentActivity;
- }
+ public String getCurrentActivity() {
+ return currentActivity;
+ }
- public void setCurrentActivity(String currentActivity) {
- this.currentActivity = currentActivity;
- }
+ public void setCurrentActivity(String currentActivity) {
+ this.currentActivity = currentActivity;
+ }
- public String getDescription() {
- return description;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setDescription(String description) {
- this.description = description;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
- public String getSubscriptionServiceType() {
- return subscriptionServiceType;
- }
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
- public void setSubscriptionServiceType(String subscriptionServiceType) {
- this.subscriptionServiceType = subscriptionServiceType;
- }
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
- public String getRequestorId() {
- return requestorId;
- }
+ public String getRequestorId() {
+ return requestorId;
+ }
- public void setRequestorId(String requestorId) {
- this.requestorId = requestorId;
- }
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
- public String getTimeout() {
- return timeout;
- }
+ public String getTimeout() {
+ return timeout;
+ }
- public void setTimeout(String timeout) {
- this.timeout = timeout;
- }
+ public void setTimeout(String timeout) {
+ this.timeout = timeout;
+ }
- public String getErrorSource() {
- return errorSource;
- }
+ public String getErrorSource() {
+ return errorSource;
+ }
- public void setErrorSource(String errorSource) {
- this.errorSource = errorSource;
- }
+ public void setErrorSource(String errorSource) {
+ this.errorSource = errorSource;
+ }
- public String getErrorCode() {
- return errorCode;
- }
+ public String getErrorCode() {
+ return errorCode;
+ }
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
- public String getErrorMessage() {
- return errorMessage;
- }
+ public String getErrorMessage() {
+ return errorMessage;
+ }
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
- public String getWorkStep() {
- return workStep;
- }
+ public String getWorkStep() {
+ return workStep;
+ }
- public void setWorkStep(String workStep) {
- this.workStep = workStep;
- }
+ public void setWorkStep(String workStep) {
+ this.workStep = workStep;
+ }
- public void createTicket() throws Exception {
- //Replace with your ticket creation mechanism if any
- }
-
-
-
+ public void createTicket() throws Exception {
+ // Replace with your ticket creation mechanism if any
+ }
+
+
}