aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml79
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql8
-rw-r--r--asdc-controller/pom.xml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java40
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java71
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java57
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java26
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java72
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java135
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java115
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json31
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy153
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy127
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy391
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy174
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy502
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy128
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy669
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn6
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn175
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn161
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn173
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn321
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn235
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn252
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidator.java114
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/GrpcNettyServer.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidatorTest.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json187
-rw-r--r--common/pom.xml7
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java2
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java6
-rw-r--r--common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java431
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java82
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java63
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java156
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java177
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json193
-rw-r--r--mso-catalog-db/pom.xml1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java88
-rw-r--r--pom.xml8
-rw-r--r--releases/1.9.0.yaml22
-rw-r--r--version.properties2
105 files changed, 6707 insertions, 294 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 25ed7eb86e..bc297f931b 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -1,40 +1,4 @@
----
-project: 'so'
-project_creation_date: '2017-01-30'
-lifecycle_state: 'Incubation'
-project_category: ''
-project_lead: &onap_releng_ptl
- name: 'Seshu Kumar'
- email: 'seshu.kumar.m@huawei.com'
- id: 'seshukm'
- company: 'Huawei'
- timezone: 'India/Bangalore'
-primary_contact: *onap_releng_ptl
-issue_tracking:
- type: 'jira'
- url: 'https://jira.onap.org/projects/SO'
- key: 'SO'
-mailing_list:
- type: 'groups.io'
- url: 'lists.onap.org'
- tag: '<[sub-project_name]>'
-realtime_discussion: ''
-meetings:
- - type: 'zoom'
- agenda: 'https://wiki.onap.org/display/DW/Minutes+Of+Meeting'
- url: 'https://wiki.onap.org/display/DW/Service+Orchestrator+Project'
- server: 'n/a'
- channel: 'n/a'
- repeats: 'weekly'
- time: '13:30 UTC'
-repositories:
- - so
- - so-chef-repo
- - so-docker-config
- - so-libs
- - so-so-config
-committers:
- - <<: *onap_releng_ptl
+
- name: 'Chuanyu Chen'
email: 'chenchuanyu@huawei.com'
company: 'Huawei'
@@ -65,39 +29,76 @@ tsc:
changes:
- type: 'removal'
name: 'Tal Liron'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Heliu Zhong'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Yuanwei Yang'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Christophe Closset'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Claude Noshpitz'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'maopeng zhang'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Bin Hou'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Fu Jinhua'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Jie Feng'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'jackie tian'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'removal'
name: 'Deng Hui'
link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
- type: 'addition'
name: 'Marcus Williams'
+ link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
+ - type: 'addition'
name: 'Sanchita Pathak'
link: 'https://lists.onap.org/pipermail/onap-tsc/2018-May/004802.html'
- type: 'addition'
name: 'Steve Smokowski'
+ link: 'https://lists.onap.org/g/onap-tsc/message/4320'
+ - type: 'addition'
name: 'Subhash Kumar Singh'
+ link: 'https://lists.onap.org/g/onap-tsc/message/4320'
+ - type: 'addition'
name: 'Lukasz Muszkieta'
link: 'https://lists.onap.org/g/onap-tsc/message/4320'
- type: 'removal'
name: 'Rob Daugherty'
+ link: 'https://lists.onap.org/g/onap-tsc/message/4320'
- type: 'addition'
name: 'Max Benjamin'
- link: 'https://lists.onap.org/g/onap-tsc/message/4981?p=,,,20,0,0,0::Created,,committer,20,2,0,31638681'
+ link: 'https://lists.onap.org/g/onap-tsc/message/4320'
- type: 'removal'
name: 'DeWayne Filppi'
+ link: 'https://wiki.onap.org/display/Meetings/TSC+2020-12-03'
+ - type: 'removal'
name: 'Yan Yang'
+ link: 'https://wiki.onap.org/display/Meetings/TSC+2020-12-03'
+ - type: 'removal'
name: 'Marcus Williams'
+ link: 'https://wiki.onap.org/display/Meetings/TSC+2020-12-03'
+ - type: 'removal'
name: 'Sanchita Pathak'
+ link: 'https://wiki.onap.org/display/Meetings/TSC+2020-12-03'
+ - type: 'removal'
name: 'Subhash Kumar Singh'
+ link: 'https://wiki.onap.org/display/Meetings/TSC+2020-12-03'
- type: 'addition'
name: 'Ramesh Parthasarathy'
link: 'https://wiki.onap.org/display/Meetings/TSC+2020-12-03'
- type: 'removal'
- name: 'Max Benjamin'
+ name: 'Max Benjamin'
+ link: 'https://wiki.onap.org/display/DW/2021+TSC+Decisions'
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index afe65284c7..6e65ec48c7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -15,6 +15,7 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'DEFAULT', '*'),
('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'DEFAULT', '*'),
('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'DEFAULT', '*'),
+('Service-Macro-Upgrade', 'upgradeInstance', 'Service', false,true, '7','7', 'DEFAULT', '*'),
('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'DEFAULT', '*'),
('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'DEFAULT', '*'),
('VNF-Macro-Create', 'createInstance', 'Vnf', false,true, '7','7', 'DEFAULT', '*'),
@@ -103,6 +104,7 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
('Service-Macro-Delete', '14', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Service-Macro-Delete', '15', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Service-Macro-Delete', '16', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Upgrade', '1', 'ChangeModelServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
@@ -962,6 +964,12 @@ UPDATE vnf_recipe
SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig';
+DELETE FROM service_recipe where ACTION = 'upgradeInstance';
+INSERT INTO service_recipe (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID)
+VALUES
+('upgradeInstance', '1.0', 'Gr api recipe to upgrade service-instance', '/mso/async/services/WorkflowActionBB', 180, 'd88da85c-d9e8-4f73-b837-3a72a431622b');
+
+
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
('VNFCheckPserversLockedFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
index c5a3701a82..c613f26c30 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
@@ -55,6 +55,14 @@ INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORC
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (20,'activateInstance','1','Custom recipe to activate/deactivate 3gpp service-instance if no custom BPMN flow is found','/mso/async/services/ActivateSliceSubnet',NULL,180,NULL,'2020-08-18 18:40:03','3d30a774-e149-11ea-87d0-0242ac130003');
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (21,'deactivateInstance','1','Custom recipe to activate/deactivate 3gpp service-instance if no custom BPMN flow is found','/mso/async/services/ActivateSliceSubnet',NULL,180,NULL,'2020-08-18 18:40:03','3d30a774-e149-11ea-87d0-0242ac130003');
+-- Recipe for Service Intent
+
+INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('6790ab0e-034f-11eb-adc1-0242ac120002','COMMON_SI_DEFAULT','6790ab0e-034f-11eb-adc1-0242ac120002','1.0','Default service for Service Intent','2021-08-18 17:40:03',NULL);
+
+INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (22,'createInstance','1','Custom recipe to create Service Intent instance if no custom BPMN flow is found','/mso/async/services/CreateServiceIntentInstance',NULL,180,NULL,'2021-08-18 17:40:03','6790ab0e-034f-11eb-adc1-0242ac120002');
+INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (23,'deleteInstance','1','Custom recipe to delete Service Intent instance if no custom BPMN flow is found','/mso/async/services/DeleteServiceIntentInstance',NULL,180,NULL,'2021-08-18 18:40:03','6790ab0e-034f-11eb-adc1-0242ac120002');
+INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (24,'updateInstance','1','Custom recipe to modify Service Intent instance if no custom BPMN flow is found','/mso/async/services/ModifyServiceIntentInstance',NULL,180,NULL,'2021-08-18 18:40:03','6790ab0e-034f-11eb-adc1-0242ac120002');
+
-- Recipe for E2E service update (R2 just support adding/deleting network service)
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (15,'updateInstance','1','Custom recipe to update E2E service-instance if no custom BPMN flow is found','/mso/async/services/UpdateCustomE2EServiceInstance',NULL,180,NULL,'2018-03-05 10:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a');
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (16,'scaleInstance','1','Custom recipe to scale E2E service-instance if no custom BPMN flow is found','/mso/async/services/ScaleCustomE2EServiceInstance',NULL,180,NULL,'2018-05-15 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a');
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index d539e65b13..244d83f7db 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -215,7 +215,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.9</version>
+ <version>1.15</version>
</dependency>
<dependency>
<groupId>org.onap.so</groupId>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index 054cc378ef..c6d92cc9ab 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -60,6 +60,9 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
int sequenceBeforeFlowManipulator;
do {
sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ if (sequenceBeforeFlowManipulator >= flowsToExecute.size()) {
+ break;
+ }
ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
List<PreFlowManipulator> filtered = filterListeners(flowManipulators,
(item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index 30a6e1fe35..641cd35027 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -34,5 +34,7 @@ public enum ResourceKey {
VPN_ID,
VPN_BONDING_LINK_ID,
INSTANCE_GROUP_ID,
- PNF
+ PNF,
+ VNF_INSTANCE_NAME,
+ VF_MODULE_INSTANCE_NAME
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
index 508709e12c..5df7c60f74 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
@@ -40,6 +40,8 @@ public class WorkflowResourceIds implements Serializable {
private String networkCollectionId;
private String configurationId;
private String instanceGroupId;
+ private String vnfInstanceName;
+ private String vfModuleInstanceName;
public WorkflowResourceIds() {
@@ -139,4 +141,20 @@ public class WorkflowResourceIds implements Serializable {
public void setInstanceGroupId(String instanceGroupId) {
this.instanceGroupId = instanceGroupId;
}
+
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+
+ public String getVfModuleInstanceName() {
+ return vfModuleInstanceName;
+ }
+
+ public void setVfModuleInstanceName(String vfModuleInstanceName) {
+ this.vfModuleInstanceName = vfModuleInstanceName;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
index b554d7a9ba..4ad7fbdbd3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
@@ -45,6 +45,14 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
private String namingPolicy;
@JsonProperty("onap-generated-naming")
private Boolean onapGeneratedNaming;
+ @JsonProperty("cds-blueprint-name")
+ private String blueprintName;
+ @JsonProperty("cds-blueprint-version")
+ private String blueprintVersion;
+ @JsonProperty("controller-actor")
+ private String controllerActor;
+ @JsonProperty("skip-post-instantiation-configuration")
+ private Boolean skipPostInstConf = Boolean.TRUE;
public String getDescription() {
@@ -119,4 +127,36 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
public void setOnapGeneratedNaming(Boolean onapGeneratedNaming) {
this.onapGeneratedNaming = onapGeneratedNaming;
}
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+ public String getControllerActor() {
+ return controllerActor;
+ }
+
+ public void setControllerActor(String controllerActor) {
+ this.controllerActor = controllerActor;
+ }
+
+ public Boolean getSkipPostInstConf() {
+ return skipPostInstConf;
+ }
+
+ public void setSkipPostInstConf(Boolean skipPostInstConf) {
+ this.skipPostInstConf = skipPostInstConf;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 83d1f5249f..d39da5ee37 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.javatuples.Pair;
@@ -74,6 +75,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ResourceNotFoundException;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
@@ -258,6 +260,8 @@ public class BBInputSetup implements JavaDelegate {
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId());
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ lookupKeyMap.put(ResourceKey.VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName());
+ lookupKeyMap.put(ResourceKey.VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
}
protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
@@ -1245,7 +1249,8 @@ public class BBInputSetup implements JavaDelegate {
|| requestAction.equalsIgnoreCase("activateInstance")
|| requestAction.equalsIgnoreCase("activateFabricConfiguration")
|| requestAction.equalsIgnoreCase("recreateInstance")
- || requestAction.equalsIgnoreCase("replaceInstance")) {
+ || requestAction.equalsIgnoreCase("replaceInstance")
+ || requestAction.equalsIgnoreCase("upgradeInstance")) {
return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
requestDetails.getCloudConfiguration());
}
@@ -1425,7 +1430,13 @@ public class BBInputSetup implements JavaDelegate {
if (serviceInstanceId != null) {
aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
if (aaiServiceInstance != null) {
- service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ String modelVersionId = aaiServiceInstance.getModelVersionId();
+ if ("upgradeInstance".equalsIgnoreCase(requestAction)) {
+ modelVersionId = requestDetails.getModelInfo().getModelVersionId();
+ }
+
+ service = bbInputSetupUtils.getCatalogServiceByModelUUID(modelVersionId);
+
if (service == null) {
String message = String.format(
"Related service instance model not found in MSO CatalogDB: model-version-id=%s",
@@ -1581,7 +1592,13 @@ public class BBInputSetup implements JavaDelegate {
.setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build();
if (bbName.contains(VNF) || (bbName.contains(CONTROLLER)
&& (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
- vnfs = findVnfsByKey(key, resources, vnfs);
+ String vnfInstanceName = lookupKeyMap.get(ResourceKey.VNF_INSTANCE_NAME);
+ if (StringUtils.isNotBlank(vnfInstanceName)) {
+ vnfs = findVnfsByInstanceName(vnfInstanceName, resources);
+ } else {
+ vnfs = findVnfsByKey(key, resources);
+ }
+
String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
// This stores the vnf id in request db to be retrieved later when
// working on a vf module or volume group
@@ -1611,15 +1628,15 @@ public class BBInputSetup implements JavaDelegate {
.ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance));
} else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER)
&& (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
- Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources);
- if (vnfsAndVfModules != null) {
- vfModules = vnfsAndVfModules.getValue1();
- vnfs = vnfsAndVfModules.getValue0();
+ String vfModuleInstanceName = lookupKeyMap.get(ResourceKey.VF_MODULE_INSTANCE_NAME);
+ if (StringUtils.isNotBlank(vfModuleInstanceName)) {
+ vfModules = getVfModulesByInstanceName(vfModuleInstanceName, resources);
+ } else {
+ vfModules = getVfModulesByKey(key, resources);
}
+
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
- if (vnfs == null) {
- throw new Exception("Could not find Vnf to orchestrate VfModule");
- }
+
parameter.setModelInfo(vfModules.getModelInfo());
if (bbName.contains(VOLUME_GROUP)) {
parameter.setResourceId(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
@@ -1682,25 +1699,45 @@ public class BBInputSetup implements JavaDelegate {
return null;
}
- protected Pair<Vnfs, VfModules> getVfModulesAndItsVnfsByKey(String key, Resources resources) {
+ protected VfModules getVfModulesByInstanceName(String vfModuleInstanceName, Resources resources) {
+ for (Vnfs vnfs : resources.getVnfs()) {
+ for (VfModules vfModules : vnfs.getVfModules()) {
+ if (vfModules.getInstanceName().equals(vfModuleInstanceName)) {
+ return vfModules;
+ }
+ }
+ }
+ throw new ResourceNotFoundException(
+ "Could not find vf-module with instanceName: " + vfModuleInstanceName + " in userparams");
+ }
+
+ protected VfModules getVfModulesByKey(String key, Resources resources) {
for (Vnfs vnfs : resources.getVnfs()) {
for (VfModules vfModules : vnfs.getVfModules()) {
if (vfModules.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) {
- return new Pair<Vnfs, VfModules>(vnfs, vfModules);
+ return vfModules;
}
}
}
- return null;
+ throw new ResourceNotFoundException("Could not find vf-module with key: " + key + " in userparams");
}
- protected Vnfs findVnfsByKey(String key, Resources resources, Vnfs vnfs) {
+ protected Vnfs findVnfsByInstanceName(String instanceName, Resources resources) {
+ for (Vnfs tempVnfs : resources.getVnfs()) {
+ if (tempVnfs.getInstanceName().equals(instanceName)) {
+ return tempVnfs;
+ }
+ }
+ throw new ResourceNotFoundException("Could not find vnf with instanceName: " + instanceName + " in userparams");
+ }
+
+ protected Vnfs findVnfsByKey(String key, Resources resources) {
for (Vnfs tempVnfs : resources.getVnfs()) {
if (tempVnfs.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) {
- vnfs = tempVnfs;
- break;
+ return tempVnfs;
}
}
- return vnfs;
+ throw new ResourceNotFoundException("Could not find vnf with key: " + key + " in userparams");
}
protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java
new file mode 100644
index 0000000000..d8eed9610a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
+
+public class ResourceNotFoundException extends RuntimeException {
+
+ static final long serialVersionUID = -2741357347054072719L;
+
+ public ResourceNotFoundException() {
+ super();
+ }
+
+ public ResourceNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
index 0d79dbb375..f393d2a49d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
@@ -20,6 +20,7 @@
package org.onap.so.client.cds;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
import com.google.gson.JsonObject;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
@@ -51,13 +52,17 @@ public class ConfigureInstanceParamsForPnf {
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
String modelCustomizationUuid) throws PayloadGenerationException {
try {
- Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList = getInstanceParamForPnf(service, modelCustomizationUuid);
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
- .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ if (service.isPresent()) {
+ List<Map<String, String>> instanceParamsList =
+ getInstanceParamForPnf(service.get(), modelCustomizationUuid);
+
+ applyParamsToObject(instanceParamsList, jsonObject);
+ }
} catch (Exception exception) {
- throw new PayloadGenerationException("Couldn't able to resolve instance parameters", exception);
+ throw new PayloadGenerationException("Failed to resolve instance parameters", exception);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
new file mode 100644
index 0000000000..e8c88e00d7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ConfigureInstanceParamsForService {
+
+ @Autowired
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ /**
+ * Read instance parameters for Service and put into JsonObject.
+ *
+ * @param jsonObject - JsonObject which will hold the payload to send to CDS.
+ * @param userParamsFromRequest - User parameters.
+ * @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload.
+ */
+ public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest)
+ throws PayloadGenerationException {
+ try {
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+
+ service.map(Service::getInstanceParams).ifPresent(p -> applyParamsToObject(p, jsonObject));
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Failed to resolve instance parameters", e);
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
index 6f850fa898..b1e632a701 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
@@ -20,8 +20,10 @@
package org.onap.so.client.cds;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
import com.google.gson.JsonObject;
-import org.onap.so.client.cds.ExtractServiceFromUserParameters;
+import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.VfModules;
@@ -47,20 +49,36 @@ public class ConfigureInstanceParamsForVfModule {
* @throws PayloadGenerationException- If it doesn't able to populate instance parameters from SO payload.
*/
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
- String vnfCustomizationUuid, String vfModuleCustomizationUuid) throws PayloadGenerationException {
+ String vnfCustomizationUuid, String vfModuleCustomizationUuid, String vfModuleInstanceName)
+ throws PayloadGenerationException {
try {
- Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList =
- getInstanceParams(service, vnfCustomizationUuid, vfModuleCustomizationUuid);
+ if (service.isPresent()) {
+ List<Map<String, String>> instanceParamsList;
+ if (StringUtils.isNotBlank(vfModuleInstanceName)) {
+ instanceParamsList = getInstanceParamsByInstanceNames(service.get(), vfModuleInstanceName);
+ } else {
+ instanceParamsList =
+ getInstanceParams(service.get(), vnfCustomizationUuid, vfModuleCustomizationUuid);
+ }
- instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
- .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ applyParamsToObject(instanceParamsList, jsonObject);
+ }
} catch (Exception e) {
- throw new PayloadGenerationException("Couldn't able to resolve instance parameters", e);
+ throw new PayloadGenerationException("Failed to resolve instance parameters", e);
}
}
+ private List<Map<String, String>> getInstanceParamsByInstanceNames(Service service, String vfModuleInstanceName)
+ throws PayloadGenerationException {
+ return service.getResources().getVnfs().stream().map(Vnfs::getVfModules).flatMap(List::stream)
+ .filter(vfm -> vfModuleInstanceName.equals(vfm.getInstanceName())).findFirst()
+ .map(VfModules::getInstanceParams).orElseThrow(() -> new PayloadGenerationException(
+ "Could not find vfModule with instanceName: " + vfModuleInstanceName));
+ }
+
private List<Map<String, String>> getInstanceParams(Service service, String vnfCustomizationUuid,
String vfModuleCustomizationUuid) throws PayloadGenerationException {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
index 22c9a7bee4..5d8388b6e0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
@@ -20,6 +20,8 @@
package org.onap.so.client.cds;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
+import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonObject;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
@@ -45,18 +47,32 @@ public class ConfigureInstanceParamsForVnf {
* @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload.
*/
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
- String modelCustomizationUuid) throws PayloadGenerationException {
+ String modelCustomizationUuid, String vnfInstanceName) throws PayloadGenerationException {
try {
- Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList = getInstanceParamForVnf(service, modelCustomizationUuid);
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
- .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ if (service.isPresent()) {
+ List<Map<String, String>> instanceParamsList;
+ if (StringUtils.isNotBlank(vnfInstanceName)) {
+ instanceParamsList = getInstanceParamByVnfInstanceName(service.get(), vnfInstanceName);
+ } else {
+ instanceParamsList = getInstanceParamForVnf(service.get(), modelCustomizationUuid);
+ }
+ applyParamsToObject(instanceParamsList, jsonObject);
+ }
} catch (Exception e) {
- throw new PayloadGenerationException("Couldn't able to resolve instance parameters", e);
+ throw new PayloadGenerationException("Failed to resolve instance parameters", e);
}
}
+ private List<Map<String, String>> getInstanceParamByVnfInstanceName(Service service, String instanceName)
+ throws PayloadGenerationException {
+ return service.getResources().getVnfs().stream().filter(vnf -> instanceName.equals(vnf.getInstanceName()))
+ .findFirst().map(Vnfs::getInstanceParams).orElseThrow(
+ () -> new PayloadGenerationException("Could not find vnf with instanceName: " + instanceName));
+ }
+
private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid)
throws PayloadGenerationException {
Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream()
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
new file mode 100644
index 0000000000..117fd74498
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
+
+public final class ConfigureInstanceParamsUtil {
+
+ public static void applyParamsToObject(List<Map<String, String>> instanceParamsList, JsonObject jsonObject) {
+ instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+ .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
index 43fabd3253..53e1da410e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
@@ -20,6 +20,7 @@
package org.onap.so.client.cds;
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.Optional;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,10 +36,13 @@ public class ExtractServiceFromUserParameters {
@Autowired
private ObjectMapper objectMapper;
- public Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
- Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey(SERVICE_KEY)).findFirst()
- .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
- return getServiceObjectFromServiceMap(serviceMap);
+ public Optional<Service> getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
+ Optional<Map<String, Object>> serviceMap =
+ userParams.stream().filter(key -> key.containsKey(SERVICE_KEY)).findFirst();
+ if (serviceMap.isPresent()) {
+ return Optional.of(getServiceObjectFromServiceMap(serviceMap.get()));
+ }
+ return Optional.empty();
}
private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws PayloadGenerationException {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
index 12c841a2c6..ce784dd5d6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
@@ -21,8 +21,11 @@
package org.onap.so.client.cds;
import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.PayloadGenerationException;
@@ -38,21 +41,22 @@ import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ServiceCDSRequestProvider implements CDSRequestProvider {
- private static final String EMPTY_STRING = "";
private String resolutionKey;
private BuildingBlockExecution execution;
+ private String bluePrintName;
+ private String bluePrintVersion;
@Autowired
- private ExtractPojosForBB extractPojosForBB;
+ private ConfigureInstanceParamsForService configureInstanceParamsForService;
@Override
public String getBlueprintName() {
- return EMPTY_STRING;
+ return bluePrintName;
}
@Override
public String getBlueprintVersion() {
- return EMPTY_STRING;
+ return bluePrintVersion;
}
@Override
@@ -65,17 +69,21 @@ public class ServiceCDSRequestProvider implements CDSRequestProvider {
JsonObject cdsPropertyObject = new JsonObject();
JsonObject serviceObject = new JsonObject();
try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
+ ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getServiceInstance();
+ bluePrintName = serviceInstance.getModelInfoServiceInstance().getBlueprintName();
+ bluePrintVersion = serviceInstance.getModelInfoServiceInstance().getBlueprintVersion();
resolutionKey = serviceInstance.getServiceInstanceName();
- // TODO Need to figure out how to populate blueprint name and version for service.
-
serviceObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId());
serviceObject.addProperty("service-model-uuid",
serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> userParamsFromRequest =
+ buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForService.populateInstanceParams(serviceObject, userParamsFromRequest);
+ }
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObjectForService", e);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
index 478b65c349..06ab84a114 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
@@ -104,9 +104,11 @@ public class VfModuleCDSRequestProvider implements CDSRequestProvider {
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
List<Map<String, Object>> userParamsFromRequest =
buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ String vfModuleInstanceName =
+ execution.getLookupMap().getOrDefault(ResourceKey.VF_MODULE_INSTANCE_NAME, "");
if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest,
- modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule);
+ modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule, vfModuleInstanceName);
}
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObject for VF-Module", e);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
index 6251eb6fad..5f63732458 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
@@ -23,6 +23,7 @@
package org.onap.so.client.cds;
import com.google.gson.JsonObject;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -93,9 +94,10 @@ public class VnfCDSRequestProvider implements CDSRequestProvider {
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
List<Map<String, Object>> userParamsFromRequest =
buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ String vnfInstanceName = execution.getLookupMap().getOrDefault(ResourceKey.VNF_INSTANCE_NAME, "");
if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest,
- modelCustomizationUuid);
+ modelCustomizationUuid, vnfInstanceName);
}
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObjectForVnf", e);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 127253a72e..b561055468 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -46,6 +46,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Assert;
import org.junit.Rule;
@@ -131,6 +132,8 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
@RunWith(MockitoJUnitRunner.class)
public class BBInputSetupTest {
@@ -2116,6 +2119,8 @@ public class BBInputSetupTest {
String volumeGroupId = "volumeGroupId";
String configurationId = "configurationId";
String instanceGroupId = "instancegroupId";
+ String vnfInstanceName = "vnfInstanceName";
+ String vfModuleInstanceName = "vfModuleInstanceName";
expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
expected.put(ResourceKey.NETWORK_ID, networkId);
@@ -2125,6 +2130,8 @@ public class BBInputSetupTest {
expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId);
expected.put(ResourceKey.CONFIGURATION_ID, configurationId);
expected.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
+ expected.put(ResourceKey.VNF_INSTANCE_NAME, vnfInstanceName);
+ expected.put(ResourceKey.VF_MODULE_INSTANCE_NAME, vfModuleInstanceName);
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
@@ -2135,6 +2142,8 @@ public class BBInputSetupTest {
workflowResourceIds.setVolumeGroupId(volumeGroupId);
workflowResourceIds.setConfigurationId(configurationId);
workflowResourceIds.setInstanceGroupId(instanceGroupId);
+ workflowResourceIds.setVnfInstanceName(vnfInstanceName);
+ workflowResourceIds.setVfModuleInstanceName(vfModuleInstanceName);
SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual);
@@ -2142,6 +2151,44 @@ public class BBInputSetupTest {
}
@Test
+ public void testGetVfModulesByInstanceName() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ VfModules expectedVfModule = resources.getVnfs().get(0).getVfModules().get(2);
+ assertEquals(expectedVfModule,
+ SPY_bbInputSetup.getVfModulesByInstanceName("vmxnjr001_AVPN_base_vRE_BV_expansion_002", resources));
+ }
+
+ @Test
+ public void testGetVfModulesByKey() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ VfModules expectedVfModule = resources.getVnfs().get(0).getVfModules().get(0);
+ assertEquals(expectedVfModule,
+ SPY_bbInputSetup.getVfModulesByKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", resources));
+ }
+
+ @Test
+ public void testFindVnfsByInstanceName() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ Vnfs expectedVnf = resources.getVnfs().get(0);
+ assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByInstanceName("vmxnjr001", resources));
+ }
+
+ @Test
+ public void testVnfsByKey() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ Vnfs expectedVnf = resources.getVnfs().get(0);
+ assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByKey("ab153b6e-c364-44c0-bef6-1f2982117f04", resources));
+ }
+
+ @Test
public void testGBBMacroNoUserParamsVrfConfiguration() throws Exception {
String resourceId = "123";
String vnfType = "vnfType";
@@ -2938,6 +2985,31 @@ public class BBInputSetupTest {
}
@Test
+ public void testGetGBBMacroExistingServiceUpgrade() throws Exception {
+ String requestAction = "upgradeInstance";
+ GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
+ GeneralBuildingBlock.class);
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper
+ .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceUpgrade.json"), RequestDetails.class);
+ Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
+ executeBB.setRequestDetails(requestDetails);
+
+ doReturn(new Service()).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId());
+ doReturn(new org.onap.aai.domain.yang.ServiceInstance()).when(SPY_bbInputSetupUtils)
+ .getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
+
+ SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null);
+
+ verify(SPY_bbInputSetupUtils, times(1))
+ .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId());
+ }
+
+ @Test
public void testGetGBBMacroExistingServiceServiceinstancenotFoundInAai() throws Exception {
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
index 06defaa84c..42b29ea669 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
@@ -20,6 +20,7 @@
package org.onap.so.client.cds;
import com.google.gson.JsonParser;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
@@ -82,6 +83,7 @@ public abstract class AbstractVnfCDSRequestProviderTest {
@Before
public void setUp() {
buildingBlockExecution = createBuildingBlockExecution();
+ buildingBlockExecution.setVariable("lookupKeyMap", new HashMap<>());
executeBuildingBlock = new ExecuteBuildingBlock();
}
@@ -142,12 +144,12 @@ public abstract class AbstractVnfCDSRequestProviderTest {
return userParams;
}
- protected Service getUserParams() {
+ protected Optional<Service> getUserParams() {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfList());
service.setResources(resources);
- return service;
+ return Optional.of(service);
}
protected List<Vnfs> createVnfList() {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
index 9baf5dc5bf..be100652c0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
@@ -20,27 +20,28 @@
package org.onap.so.client.cds;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.Resources;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.anyList;
-import static org.mockito.Mockito.doReturn;
-@RunWith(MockitoJUnitRunner.Silent.class)
+@RunWith(MockitoJUnitRunner.class)
public class ConfigureInstanceParamsForVfModuleTest {
@InjectMocks
@@ -49,79 +50,77 @@ public class ConfigureInstanceParamsForVfModuleTest {
@Mock
private ExtractServiceFromUserParameters extractServiceFromUserParameters;
- private static final String TEST_VNF_MODEL_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4";
- private static final String TEST_VF_MODULE_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce2";
- private static final String TEST_INSTANCE_PARAM_VALUE_1 = "vf-module-1-value";
- private static final String TEST_INSTANCE_PARAM_VALUE_2 = "vf-module-2-value";
- private static final String TEST_INSTANCE_PARAM_KEY_1 = "instance-param-1";
- private static final String TEST_INSTANCE_PARAM_KEY_2 = "instance-param-2";
+ private static final String VNF_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VFMODULE_1_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VFMODULE_2_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VFMODULE_1_INSTANCE_NAME = "vfmodule-instance-1";
+ private static final String VFMODULE_2_INSTANCE_NAME = "vfmodule-instance-2";
+ private static final List<Map<String, String>> VFMODULE_1_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "xyz", "param-2", "123"), Map.of("param-3", "CCC"));
+ private static final List<Map<String, String>> VFMODULE_2_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "abc", "param-2", "999"), Map.of("param-3", "AAA"));
+
@Test
- public void testInstanceParamsForVfModule() throws Exception {
- // given
- List<Map<String, Object>> userParamsFromRequest = createRequestParameters();
- JsonObject jsonObject = new JsonObject();
- doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
+ public void testPopulateInstanceParamsByInstanceName() throws Exception {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
- // when
- configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, userParamsFromRequest,
- TEST_VNF_MODEL_CUSTOMIZATION_UUID, TEST_VF_MODULE_CUSTOMIZATION_UUID);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
+ JsonObject jsonObject = new JsonObject();
- // verify
- assertEquals(TEST_INSTANCE_PARAM_VALUE_1, jsonObject.get(TEST_INSTANCE_PARAM_KEY_1).getAsString());
- assertEquals(TEST_INSTANCE_PARAM_VALUE_2, jsonObject.get(TEST_INSTANCE_PARAM_KEY_2).getAsString());
- }
+ configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_CUSTOMIZATION_ID,
+ VFMODULE_2_CUSTOMIZATION_ID, VFMODULE_2_INSTANCE_NAME);
- private List<Map<String, Object>> createRequestParameters() {
- List<Map<String, Object>> userParams = new ArrayList<>();
- Map<String, Object> userParamMap = new HashMap<>();
- userParamMap.put("service", getUserParams());
- userParams.add(userParamMap);
- return userParams;
+ assertEquals("abc", jsonObject.get("param-1").getAsString());
+ assertEquals("999", jsonObject.get("param-2").getAsString());
+ assertEquals("AAA", jsonObject.get("param-3").getAsString());
}
- private Service getUserParams() {
+ @Test
+ public void testPopulateInstanceParamsByCustomizationId() throws Exception {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfs());
service.setResources(resources);
- return service;
- }
-
- private List<Vnfs> createVnfs() {
- Vnfs searchedVnf = createVnf();
- List<Vnfs> vnfList = new ArrayList<>();
- vnfList.add(searchedVnf);
- return vnfList;
- }
-
- private Vnfs createVnf() {
- Vnfs vnf = new Vnfs();
- ModelInfo modelInfoForVnf = new ModelInfo();
- modelInfoForVnf.setModelCustomizationId(TEST_VNF_MODEL_CUSTOMIZATION_UUID);
- vnf.setModelInfo(modelInfoForVnf);
-
- VfModules vfModule = new VfModules();
- ModelInfo modelInfoForVfModule = new ModelInfo();
- modelInfoForVfModule.setModelCustomizationId(TEST_VF_MODULE_CUSTOMIZATION_UUID);
-
- vfModule.setModelInfo(modelInfoForVfModule);
-
- // Set instance parameters.
- List<Map<String, String>> instanceParamsListSearchedVfModule = new ArrayList<>();
- Map<String, String> instanceParams = new HashMap<>();
- instanceParams.put("instance-param-1", TEST_INSTANCE_PARAM_VALUE_1);
- instanceParams.put("instance-param-2", TEST_INSTANCE_PARAM_VALUE_2);
-
- instanceParamsListSearchedVfModule.add(instanceParams);
- vfModule.setInstanceParams(instanceParamsListSearchedVfModule);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
+ JsonObject jsonObject = new JsonObject();
- List<VfModules> vfModules = new ArrayList<>();
- vfModules.add(vfModule);
+ // No instance name is passed
+ configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_CUSTOMIZATION_ID,
+ VFMODULE_1_CUSTOMIZATION_ID, null);
- vnf.setVfModules(vfModules);
+ assertEquals("xyz", jsonObject.get("param-1").getAsString());
+ assertEquals("123", jsonObject.get("param-2").getAsString());
+ assertEquals("CCC", jsonObject.get("param-3").getAsString());
+ }
- return vnf;
+ private List<Vnfs> createVnfs() {
+ Vnfs vnf1 = new Vnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_CUSTOMIZATION_ID);
+ vnf1.setModelInfo(modelInfo);
+
+ VfModules vfModule1 = new VfModules();
+ modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VFMODULE_1_CUSTOMIZATION_ID);
+ vfModule1.setModelInfo(modelInfo);
+ vfModule1.setInstanceName(VFMODULE_1_INSTANCE_NAME);
+ vfModule1.setInstanceParams(VFMODULE_1_INSTANCE_PARAMS);
+
+ VfModules vfModule2 = new VfModules();
+ modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VFMODULE_2_CUSTOMIZATION_ID);
+ vfModule2.setModelInfo(modelInfo);
+ vfModule2.setInstanceName(VFMODULE_2_INSTANCE_NAME);
+ vfModule2.setInstanceParams(VFMODULE_2_INSTANCE_PARAMS);
+
+ vnf1.setVfModules(Arrays.asList(vfModule1, vfModule2));
+
+ return Arrays.asList(vnf1);
}
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
new file mode 100644
index 0000000000..6466da59d0
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigureInstanceParamsForVnfTest {
+
+ @InjectMocks
+ private ConfigureInstanceParamsForVnf configureInstanceParamsForVnf;
+
+ @Mock
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ private static final String VNF_1_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VNF_2_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VNF_1_INSTANCE_NAME = "vnf-instance-1";
+ private static final String VNF_2_INSTANCE_NAME = "vnf-instance-2";
+ private static final List<Map<String, String>> VNF_1_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "xyz", "param-2", "123"), Map.of("param-3", "CCC"));
+ private static final List<Map<String, String>> VNF_2_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "abc", "param-2", "999"), Map.of("param-3", "AAA"));
+
+
+ @Test
+ public void testPopulateInstanceParamsByInstanceName() throws Exception {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
+ JsonObject jsonObject = new JsonObject();
+
+ configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_2_CUSTOMIZATION_ID,
+ VNF_2_INSTANCE_NAME);
+
+ assertEquals("abc", jsonObject.get("param-1").getAsString());
+ assertEquals("999", jsonObject.get("param-2").getAsString());
+ assertEquals("AAA", jsonObject.get("param-3").getAsString());
+ }
+
+ @Test
+ public void testPopulateInstanceParamsByCustomizationId() throws Exception {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
+ JsonObject jsonObject = new JsonObject();
+
+ // No instance name is passed
+ configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_1_CUSTOMIZATION_ID,
+ null);
+
+ assertEquals("xyz", jsonObject.get("param-1").getAsString());
+ assertEquals("123", jsonObject.get("param-2").getAsString());
+ assertEquals("CCC", jsonObject.get("param-3").getAsString());
+ }
+
+ private List<Vnfs> createVnfs() {
+ Vnfs vnf1 = new Vnfs();
+ vnf1.setInstanceName(VNF_1_INSTANCE_NAME);
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_1_CUSTOMIZATION_ID);
+ vnf1.setModelInfo(modelInfo);
+ vnf1.setInstanceParams(VNF_1_INSTANCE_PARAMS);
+
+ Vnfs vnf2 = new Vnfs();
+ modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_2_CUSTOMIZATION_ID);
+ vnf2.setModelInfo(modelInfo);
+ vnf2.setInstanceName(VNF_2_INSTANCE_NAME);
+ vnf2.setInstanceParams(VNF_2_INSTANCE_PARAMS);
+
+ return Arrays.asList(vnf1, vnf2);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java
new file mode 100644
index 0000000000..f7c3e8a192
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java
@@ -0,0 +1,24 @@
+package org.onap.so.client.cds;
+
+import static org.junit.Assert.assertEquals;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+
+public class ConfigureInstanceParamsUtilTest {
+
+ @Test
+ public void testApplyParamsToObject() {
+ List<Map<String, String>> instanceParamsList =
+ List.of(Map.of("test-param-1", "value1", "test-param-2", "value2"), Map.of("test-param-3", "value3"));
+ JsonObject jsonObject = new JsonObject();
+
+ ConfigureInstanceParamsUtil.applyParamsToObject(instanceParamsList, jsonObject);
+
+ assertEquals("value1", jsonObject.get("test-param-1").getAsString());
+ assertEquals("value2", jsonObject.get("test-param-2").getAsString());
+ assertEquals("value3", jsonObject.get("test-param-3").getAsString());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
index 70ce3a1eed..c860d0fc5e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import static org.assertj.core.api.Assertions.assertThat;
@@ -35,13 +36,15 @@ public class ServiceCDSRequestProviderTest extends AbstractVnfCDSRequestProvider
@InjectMocks
private ServiceCDSRequestProvider serviceCDSRequestProvider;
+ @Mock
+ private ConfigureInstanceParamsForService configureInstanceParamsForService;
+
@Test
public void testRequestPayloadForCreateService() throws Exception {
// given
setScopeAndAction(SERVICE_SCOPE, SERVICE_ACTION);
ServiceInstance instance = createServiceInstance();
- doReturn(instance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
- ResourceKey.SERVICE_INSTANCE_ID);
+ buildingBlockExecution.getGeneralBuildingBlock().setServiceInstance(instance);
// when
serviceCDSRequestProvider.setExecutionObject(buildingBlockExecution);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
index f224ebf21e..f5045b1ea0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
@@ -22,18 +22,28 @@ package org.onap.so.client.cds;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.UUID;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;
@@ -68,7 +78,7 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide
ResourceKey.VF_MODULE_ID);
doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
- anyString());
+ anyString(), any());
// when
vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution);
@@ -105,7 +115,7 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide
ResourceKey.VF_MODULE_ID);
doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
- anyString());
+ anyString(), any());
vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution);
String payload = vfModuleCDSRequestProvider.buildRequestPayload(DEPLOY_ACTION).get();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
index 7aafd900d4..e801c2afab 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
@@ -50,8 +50,6 @@ public class VnfCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest
ResourceKey.SERVICE_INSTANCE_ID);
doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
ResourceKey.GENERIC_VNF_ID);
- doNothing().when(configureInstanceParamsForVnf).populateInstanceParams(any(), any(), anyString());
-
// when
vnfCDSRequestProvider.setExecutionObject(buildingBlockExecution);
String payload = vnfCDSRequestProvider.buildRequestPayload(ASSIGN_ACTION).get();
@@ -81,7 +79,6 @@ public class VnfCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest
ResourceKey.SERVICE_INSTANCE_ID);
doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
ResourceKey.GENERIC_VNF_ID);
- doNothing().when(configureInstanceParamsForVnf).populateInstanceParams(any(), any(), any());
// when
vnfCDSRequestProvider.setExecutionObject(buildingBlockExecution);
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json
index 42ae25a7b1..af3b3ffba8 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json
@@ -8,5 +8,6 @@
"service-type": "serviceType",
"service-role": "serviceRole",
"environment-context": "environmentContext",
- "workload-context": "workloadContext"
+ "workload-context": "workloadContext",
+ "skip-post-instantiation-configuration": true
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json
new file mode 100644
index 0000000000..2a721ddd96
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json
@@ -0,0 +1,31 @@
+{
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "Sample Service Upgrade",
+ "modelVersion": "10.0"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "TEST"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "subscriberId"
+ },
+ "requestInfo": {
+ "instanceName": "test_Service",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "xxxxxx"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "test",
+ "aLaCarte": false,
+ "userParams": []
+ }
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 5fd9701880..6fb7b5b5b4 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.6.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:extensionElements>
<camunda:executionListener class="org.onap.so.bpmn.core.plugins.AsyncTaskExecutorListener" event="end" />
@@ -30,7 +30,7 @@
<camunda:in source="rollbackTargetState" target="rollbackTargetState" />
<camunda:out source="rollbackTargetState" target="rollbackTargetState" />
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0duoleg</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" />
@@ -183,7 +183,7 @@
<bpmn:incoming>SequenceFlow_0mqrkxv</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mew9im</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="Call_ExecuteBB" />
+ <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="ExclusiveGateway_10j89d1" />
<bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_UpdateRequestComplete" />
<bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable(&#34;requestAction&#34;), execution)}">
@@ -193,6 +193,7 @@
</bpmn:serviceTask>
<bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
<bpmn:incoming>SequenceFlow_1hsqed1</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1knplug</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1fftixk</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
@@ -211,6 +212,15 @@
<bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0ilo6lo" name="yes" sourceRef="ExclusiveGateway_1dez26n" targetRef="EndEvent_12f15tu" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_10j89d1" default="SequenceFlow_0duoleg">
+ <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0duoleg</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1knplug</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0duoleg" sourceRef="ExclusiveGateway_10j89d1" targetRef="Call_ExecuteBB" />
+ <bpmn:sequenceFlow id="SequenceFlow_1knplug" name="completed = true" sourceRef="ExclusiveGateway_10j89d1" targetRef="ServiceTask_0lbkcyp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -235,11 +245,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_03m7z4y_di" bpmnElement="Call_ExecuteBB">
- <dc:Bounds x="1150" y="356" width="100" height="80" />
+ <dc:Bounds x="1200" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
<di:waypoint x="929" y="396" />
- <di:waypoint x="990" y="396" />
+ <di:waypoint x="960" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -531,11 +541,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0e2p0xs_di" bpmnElement="ServiceTask_0e2p0xs">
- <dc:Bounds x="990" y="356" width="100" height="80" />
+ <dc:Bounds x="960" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint x="1090" y="396" />
- <di:waypoint x="1150" y="396" />
+ <di:waypoint x="1060" y="396" />
+ <di:waypoint x="1105" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -561,17 +571,17 @@
<dc:Bounds x="670" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0lbkcyp_di" bpmnElement="ServiceTask_0lbkcyp">
- <dc:Bounds x="1325" y="356" width="100" height="80" />
+ <dc:Bounds x="1350" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint x="1250" y="396" />
- <di:waypoint x="1325" y="396" />
+ <di:waypoint x="1300" y="396" />
+ <di:waypoint x="1350" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697.5" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
- <di:waypoint x="1425" y="396" />
+ <di:waypoint x="1450" y="396" />
<di:waypoint x="1501" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
@@ -618,6 +628,25 @@
<dc:Bounds x="727" y="173" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_10j89d1_di" bpmnElement="ExclusiveGateway_10j89d1" isMarkerVisible="true">
+ <dc:Bounds x="1105" y="371" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1100" y="428" width="60" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0duoleg_di" bpmnElement="SequenceFlow_0duoleg">
+ <di:waypoint x="1155" y="396" />
+ <di:waypoint x="1200" y="396" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1knplug_di" bpmnElement="SequenceFlow_1knplug">
+ <di:waypoint x="1130" y="371" />
+ <di:waypoint x="1130" y="330" />
+ <di:waypoint x="1400" y="330" />
+ <di:waypoint x="1400" y="356" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1224" y="312" width="83" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
index 78cafa7be5..1e65c1a9dd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
@@ -114,7 +114,7 @@ class AllocateSliceSubnet extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else
{
- execution.setVariable("networkType", networkType.toUpperCase())
+ execution.setVariable("networkType", networkType.toLowerCase())
}
//requestParameters, subscriptionServiceType is 5G
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
index bb6fe212b3..c7302d001c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
@@ -395,6 +395,10 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
e2eInputMap.put("dLThptPerSlice", dLThptPerSlice)
e2eInputMap.put("uLThptPerSlice", uLThptPerSlice)
e2eInputMap.put("maxNumberofConns", maxNumberofConns)
+ //TODO temp solution - service to slice profile mapping
+ e2eInputMap.put("expDataRateDL", dLThptPerSlice)
+ e2eInputMap.put("expDataRateUL", uLThptPerSlice)
+ e2eInputMap.put("maxNumberofPDUSession", maxNumberofConns)
execution.setVariable("e2eInputMap", e2eInputMap)
execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy
new file mode 100644
index 0000000000..303b685a38
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy
@@ -0,0 +1,153 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class CreateServiceIntentInstance extends AbstractServiceTaskProcessor {
+
+ String Prefix = "CreateSiInstance_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ private static final Logger logger = LoggerFactory.getLogger(CreateServiceIntentInstance.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ serviceIntentUtils.setCommonExecutionVars(execution)
+
+ //modelInfo
+ String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
+ if (isBlank(modelInvariantUuid)) {
+ msg = "Input modelInvariantUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ }
+
+ logger.debug("modelInvariantUuid: " + modelInvariantUuid)
+
+ String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
+ if (isBlank(modelUuid)) {
+ msg = "Input modelUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("modelUuid", modelUuid)
+ }
+
+ logger.debug("modelUuid: " + modelUuid)
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+ String siId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug
+ if (isBlank(siId)) {
+ siId = UUID.randomUUID().toString()
+ }
+
+ logger.debug("serviceInstanceID: " + modelUuid)
+ execution.setVariable("serviceInstanceID", siId)
+
+ String sST = jsonUtil.getJsonValue(subnetInstanceReq, "sst")
+ execution.setVariable("sst", sST)
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in CreateServiceIntentInstance.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("serviceInstanceID")
+ logger.debug("Generated new job for Service Instance serviceId:" + modelUuid + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(nsiId) // set nsiId to this field
+ initStatus.setOperationId(jobId) // set jobId to this field
+ initStatus.setResourceTemplateUUID(modelUuid) // set modelUuid to this field
+ initStatus.setOperType("Create")
+ //initStatus.setResourceInstanceID() // set nssiId to this field
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
+ sendWorkflowResponse(execution, 202, allocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
index d00f349690..a1acbb3377 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
@@ -215,13 +215,15 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
requestBody.replaceAll("\\s+", "")
String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
- String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+ String basicAuth = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+ def authHeader = utils.getBasicAuth(basicAuth, msoKey)
+
// String basicAuthValue = utils.encrypt(basicAuth, msoKey)
// String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
// httpClient.addAdditionalHeader("Authorization", encodeString)
- httpClient.addAdditionalHeader("Authorization", basicAuth)
+ httpClient.addAdditionalHeader("Authorization", authHeader)
httpClient.addAdditionalHeader("Accept", "application/json")
Response httpResponse = httpClient.delete(requestBody)
handleNSSMFWFResponse(httpResponse, execution)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy
new file mode 100644
index 0000000000..59cf5ee7fe
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DeleteServiceIntentInstance extends AbstractServiceTaskProcessor {
+ String Prefix = "DCLL_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+
+ private static final Logger logger = LoggerFactory.getLogger(DeleteServiceIntentInstance.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ serviceIntentUtils.setCommonExecutionVars(execution)
+
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in DeAllocateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String siId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = siId
+ String modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(siId)
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(nsiId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(modelUuid)
+ initStatus.setOperType("Delete")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
+ sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
index f3fca050a2..a4d503a86c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
@@ -565,7 +565,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
List<String> snssaiList = execution.getVariable("snssaiList")
String snssai = snssaiList.get(0)
//ANServiceInstance.setEnvironmentContext(snssai)
- ANServiceInstance.setEnvironmentContext("an") //Network Type
+ ANServiceInstance.setEnvironmentContext(execution.getVariable("networkType")) //Network Type
ANServiceInstance.setWorkloadContext("AN") //domain Type
logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
@@ -631,7 +631,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
ANServiceInstance.setServiceRole(serviceRole)
List<String> snssaiList = execution.getVariable("snssaiList")
String snssai = snssaiList.get(0)
- ANServiceInstance.setEnvironmentContext(snssai)
+ //ANServiceInstance.setEnvironmentContext(snssai)
+ ANServiceInstance.setEnvironmentContext(execution.getVariable("networkType"))
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
ANServiceInstance.setModelInvariantId(modelInvariantUuid)
@@ -651,7 +652,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
ANNFServiceInstance.setServiceRole(serviceRole)
snssaiList = execution.getVariable("snssaiList")
snssai = snssaiList.get(0)
- ANNFServiceInstance.setEnvironmentContext(snssai)
+ //ANNFServiceInstance.setEnvironmentContext(snssai)
+ ANNFServiceInstance.setEnvironmentContext(execution.getVariable("networkType"))
ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid"))
ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid"))
ANNFServiceInstance.setWorkloadContext("AN_NF")
@@ -923,7 +925,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject commonHeader = new JsonObject()
JsonObject payload = new JsonObject()
JsonObject payloadInput = new JsonObject()
- commonHeader.addProperty("timeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
+ commonHeader.addProperty("timestamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
commonHeader.addProperty("api-ver", "1.0")
commonHeader.addProperty("originator-id", "testing")
commonHeader.addProperty("request-id", requestId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index e4281045bd..0d64d7811b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -127,6 +127,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String serviceStatus = "deactivated"
String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID
String modelUuid = sliceParams.getNSTInfo().UUID
+ String serviceFunction = sliceParams.serviceProfile.get("resourceSharingLevel")
sliceParams.setSuggestNsiId(sliceInstanceId)
sliceParams.setSuggestNsiName(sliceInstanceName)
@@ -144,6 +145,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
nsi.setModelVersionId(modelUuid)
nsi.setServiceInstanceLocationId(serviceInstanceLocationid)
nsi.setServiceRole(serviceRole)
+ nsi.setServiceFunction(serviceFunction)
String msg
try {
@@ -263,7 +265,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
- String sliceProfileName = "an_" + sliceParams.serviceName
+ String sliceProfileName = "sliceprofile_an_" + sliceParams.serviceName
// create slice profile
ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus)
@@ -401,6 +403,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
allocateAnNssi.nssiId = sliceTaskInfo.suggestNssiId
allocateAnNssi.nssiName = "nssi_an" + execution.getVariable("sliceServiceInstanceName")
+ allocateAnNssi.scriptName = sliceTaskInfo.getScriptName()
NsiInfo nsiInfo = new NsiInfo()
nsiInfo.nsiId = sliceParams.suggestNsiId
nsiInfo.nsiName = sliceParams.suggestNsiName
@@ -458,7 +461,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
- String sliceProfileName = "cn_"+sliceParams.serviceName
+ String sliceProfileName = "sliceprofile_cn_"+sliceParams.serviceName
// create slice profile
ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus)
@@ -544,6 +547,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateCnNssi.nssiName = "nssi_cn" + execution.getVariable("sliceServiceInstanceName")
allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile()
allocateCnNssi.sliceProfile.sliceProfileId = sliceTaskInfo.sliceInstanceId
+ allocateCnNssi.scriptName = sliceTaskInfo.getScriptName()
NsiInfo nsiInfo = new NsiInfo()
nsiInfo.nsiId = sliceParams.suggestNsiId
@@ -602,7 +606,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String serviceInstanceId = UUID.randomUUID().toString()
sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
- String sliceProfileName = "tn_" + sliceParams.serviceName
+ String sliceProfileName = "sliceprofile_tn_" + sliceParams.serviceName
//execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
// create slice profile
@@ -671,6 +675,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
allocateTnNssi.setNssiId(sliceTaskInfo.suggestNssiId)
+ allocateTnNssi.scriptName = sliceTaskInfo.getScriptName()
//todo: AllocateTnNssi
//todo: endPointId -> set into tn
List<TransportSliceNetwork> transportSliceNetworks = new ArrayList<>()
@@ -943,6 +948,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
rspi.setWorkloadContext(sliceTaskInfo.subnetType.subnetType)
rspi.setEnvironmentContext(sliceTaskInfo.sliceProfile.getSNSSAIList())
+ rspi.setServiceFunction(sliceTaskInfo.sliceProfile.getResourceSharingLevel())
//timestamp format YYYY-MM-DD hh:mm:ss
rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
new file mode 100644
index 0000000000..2e0f3cfd66
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
@@ -0,0 +1,391 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
+
+ private static final Logger logger = LoggerFactory.getLogger(DoCloudLeasedLineCreate.class);
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String Prefix = "CLLC_"
+
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+
+ try {
+ execution.setVariable("startTime", System.currentTimeMillis())
+
+ msg = serviceIntentUtils.getExecutionInputParams(execution)
+ logger.debug("Create CLL input parameters: " + msg)
+
+ serviceIntentUtils.setSdncCallbackUrl(execution, true)
+ logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+
+ String cllId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug
+ if (isBlank(cllId)) {
+ cllId = UUID.randomUUID().toString()
+ }
+
+ String operationId = UUID.randomUUID().toString()
+ execution.setVariable("operationId", operationId)
+
+ logger.debug("Generate new CLL ID:" + cllId)
+ cllId = UriUtils.encode(cllId, "UTF-8")
+ execution.setVariable("cllId", cllId)
+
+ String cllName = execution.getVariable("servicename")
+ execution.setVariable("cllName", cllName)
+
+ String sst = execution.getVariable("sst")
+ execution.setVariable("sst", sst)
+
+ String transportNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportNetworks")
+ if (isBlank(transportNetworks)) {
+ msg = "ERROR: preProcessRequest: Input transportNetworks is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("transportNetworks", transportNetworks)
+ }
+ logger.debug("transportNetworks: " + transportNetworks)
+
+ if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
+ "enableSdnc", "enableSdnc"))) {
+ serviceIntentUtils.setEnableSdncConfig(execution)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Finish preProcessRequest")
+ }
+
+ void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String cllId = execution.getVariable("cllId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = new ServiceInstance()
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(cllId))
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ void prepareUpdateJobStatus(DelegateExecution execution,
+ String status,
+ String progress,
+ String statusDescription) {
+ String cllId = execution.getVariable("cllId")
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = cllId
+ String operType = "CREATE"
+
+ ResourceOperationStatus roStatus = serviceIntentUtils.buildRoStatus(modelUuid, cllId,
+ jobId, nsiId, operType, status, progress, statusDescription)
+
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ }
+
+
+ void createServiceInstance(DelegateExecution execution) {
+
+ String serviceRole = "cll"
+ String serviceType = execution.getVariable("serviceType")
+ String cllId = execution.getVariable("cllId")
+ try {
+ org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+ ss.setServiceInstanceId(cllId)
+ String cllName = execution.getVariable("cllName")
+ if (isBlank(cllName)) {
+ logger.error("ERROR: createServiceInstance: cllName is null")
+ cllName = cllId
+ }
+ ss.setServiceInstanceName(cllName)
+ ss.setServiceType(serviceType)
+ String serviceStatus = "created"
+ ss.setOrchestrationStatus(serviceStatus)
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ ss.setModelInvariantId(modelInvariantUuid)
+ ss.setModelVersionId(modelUuid)
+ ss.setEnvironmentContext("cll")
+ ss.setServiceRole(serviceRole)
+
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId))
+ client.create(uri, ss)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCloudLeasedLineCreate.createServiceInstance: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ void createAllottedResource(DelegateExecution execution) {
+ String cllId = execution.getVariable('cllId')
+
+ try {
+ List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks"))
+
+ for (String networkStr : networkStrList) {
+ String networkId = jsonUtil.getJsonValue(networkStr, "id")
+ String allottedResourceId = isBlank(networkId) ? UUID.randomUUID().toString() : networkId
+
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(execution.getVariable("cllId"))
+ .allottedResource(allottedResourceId))
+ execution.setVariable("allottedResourceUri", allottedResourceUri)
+ String modelInvariantId = execution.getVariable("modelInvariantUuid")
+ String modelVersionId = execution.getVariable("modelUuid")
+
+ String slaStr = jsonUtil.getJsonValue(networkStr, "sla")
+ if (slaStr == null || slaStr.isEmpty()) {
+ String msg = "ERROR: createNetworkPolicy: SLA is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+ resource.setId(allottedResourceId)
+ resource.setType("TsciNetwork")
+ resource.setAllottedResourceName("network_" + allottedResourceId)
+ getAAIClient().create(allottedResourceUri, resource)
+
+ createNetworkPolicyForAllocatedResource(execution, cllId, allottedResourceId, slaStr)
+
+ String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
+ createLogicalLinksForAllocatedResource(execution, linkArrayStr, cllId, allottedResourceId)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCloudLeasedLineCreate.createAllottedResource: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void createNetworkPolicy(DelegateExecution execution, String cllId, String networkPolicyId, String slaStr) {
+ try {
+
+
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId(networkPolicyId)
+ networkPolicy.setName("TSCi policy")
+ networkPolicy.setType("SLA")
+ networkPolicy.setNetworkPolicyFqdn(cllId)
+
+ String latencyStr = jsonUtil.getJsonValue(slaStr, "latency")
+ if (latencyStr != null && !latencyStr.isEmpty()) {
+ networkPolicy.setLatency(Integer.parseInt(latencyStr))
+ }
+
+ String bwStr = jsonUtil.getJsonValue(slaStr, "maxBandwidth")
+ if (bwStr != null && !bwStr.isEmpty()) {
+ networkPolicy.setMaxBandwidth(Integer.parseInt(bwStr))
+ } else {
+ logger.debug("ERROR: createNetworkPolicy: maxBandwidth is null")
+ }
+
+ //networkPolicy.setReliability(new Object())
+
+ AAIResourceUri networkPolicyUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
+ getAAIClient().create(networkPolicyUri, networkPolicy)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void createNetworkPolicyForAllocatedResource(DelegateExecution execution,
+ String cllId,
+ String allottedResourceId, String slaStr) {
+ try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId)
+ .allottedResource(allottedResourceId))
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
+ String networkPolicyId = UUID.randomUUID().toString()
+ createNetworkPolicy(execution, cllId, networkPolicyId, slaStr)
+
+ serviceIntentUtils.attachNetworkPolicyToAllottedResource(execution, serviceIntentUtils.AAI_VERSION,
+ allottedResourceUri,
+ networkPolicyId);
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void createLogicalLinksForAllocatedResource(DelegateExecution execution,
+ String linkArrayStr, String cllId,
+ String allottedResourceId) {
+ try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId)
+ .allottedResource(allottedResourceId))
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
+ List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
+
+ for (String linkStr : linkStrList) {
+ String linkId = jsonUtil.getJsonValue(linkStr, "name")
+ if (isBlank(linkId)) {
+ linkId = "cll-" + UUID.randomUUID().toString()
+ }
+ logger.debug("createLogicalLinksForAllocatedResource: linkId=" + linkId)
+
+ String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
+ String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+ String modelInvariantId = execution.getVariable("modelInvariantUuid")
+ String modelVersionId = execution.getVariable("modelUuid")
+
+ org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+ resource.setLinkId(linkId)
+ resource.setLinkName(epA)
+ resource.setLinkName2(epB)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
+
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
+ getAAIClient().create(logicalLinkUri, resource)
+
+ serviceIntentUtils.attachLogicalLinkToAllottedResource(execution, serviceIntentUtils.AAI_VERSION,
+ allottedResourceUri, epA);
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCloudLeasedLineCreate.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void preprocessSdncCreateCllRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ logger.trace("STARTED preProcessSDNCActivateRequest Process")
+ try {
+ String serviceInstanceId = execution.getVariable("cllId")
+
+ String createSDNCRequest = serviceIntentUtils.buildSDNCRequest(execution, serviceInstanceId, "create")
+
+ execution.setVariable("CLL_SDNCRequest", createSDNCRequest)
+ logger.debug("Outgoing SDNCRequest is: \n" + createSDNCRequest)
+
+ } catch (Exception e) {
+ logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002,
+ "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
+ }
+
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ serviceIntentUtils.validateSDNCResponse(execution, response, method)
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy
new file mode 100644
index 0000000000..b7f206cedc
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+
+class DoCloudLeasedLineDelete extends AbstractServiceTaskProcessor {
+ String Prefix = "DCLL_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ private static final Logger logger = LoggerFactory.getLogger(DoCloudLeasedLineDelete.class)
+
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+
+ execution.setVariable("startTime", System.currentTimeMillis())
+ String msg = serviceIntentUtils.getExecutionInputParams(execution)
+ logger.debug("Deallocate CLL input parameters: " + msg)
+
+ execution.setVariable("prefix", Prefix)
+
+ serviceIntentUtils.setSdncCallbackUrl(execution, true)
+ logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+ String cllId = execution.getVariable("serviceInstanceID")
+ execution.setVariable("cllId", cllId)
+
+ String cllName = execution.getVariable("servicename")
+ execution.setVariable("cllName", cllName)
+
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ if (isEmpty(modelUuid)) {
+ modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID"))
+ }
+ def isDebugLogEnabled = true
+ execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+ if (isBlank(additionalPropJsonStr) ||
+ isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution,
+ additionalPropJsonStr,
+ "enableSdnc", "enableSdnc"))) {
+ serviceIntentUtils.setEnableSdncConfig(execution)
+ }
+
+ logger.debug("Finish preProcessRequest")
+ }
+
+ void preprocessSdncDeleteCllRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preprocessSdncDeallocateCllRequest(' +
+ 'execution=' + execution.getId() + ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+ String sdncRequest = serviceIntentUtils.buildSDNCRequest(execution, serviceInstanceId, "delete")
+
+ execution.setVariable("CLL_SDNCRequest", sdncRequest)
+ logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+ } catch (Exception e) {
+ logger.debug("Exception Occurred Processing preprocessSdncDeallocateCllRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preprocessSdncDeallocateCllRequest Process")
+ }
+
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ serviceIntentUtils.validateSDNCResponse(execution, response, method)
+ }
+
+ void deleteServiceInstance(DelegateExecution execution) {
+ try {
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID")))
+ client.delete(uri)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoDeallocateCll.deleteServiceInstance. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ public void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String cllId = execution.getVariable("cllId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = new ServiceInstance()
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(cllId))
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ void prepareUpdateJobStatus(DelegateExecution execution,
+ String status,
+ String progress,
+ String statusDescription) {
+ String cllId = execution.getVariable("cllId")
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+
+ ResourceOperationStatus roStatus = serviceIntentUtils.buildRoStatus(modelUuid, cllId,
+ jobId, nsiId, "DELETE", status, progress, statusDescription)
+
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
new file mode 100644
index 0000000000..5c9877840d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
@@ -0,0 +1,502 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+import static org.apache.commons.lang3.StringUtils.isNotBlank
+
+public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
+ String Prefix = "MCLL_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ private static final Logger logger = LoggerFactory.getLogger(DoCloudLeasedLineModify.class)
+
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+
+ try {
+ execution.setVariable("startTime", System.currentTimeMillis())
+ msg = serviceIntentUtils.getExecutionInputParams(execution)
+ logger.debug("Modify CLL input parameters: " + msg)
+
+ execution.setVariable("prefix", Prefix)
+
+ serviceIntentUtils.setSdncCallbackUrl(execution, true)
+ logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+ if (isBlank(additionalPropJsonStr)) {
+ msg = "ERROR: preProcessRequest: additionalPropJsonStr is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String cllId = execution.getVariable("serviceInstanceID")
+ if (isBlank(cllId)) {
+ msg = "ERROR: cllId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("cllId", cllId)
+
+ String cllName = execution.getVariable("servicename")
+ execution.setVariable("cllName", cllName)
+
+ String operationId = UUID.randomUUID().toString()
+ execution.setVariable("operationId", operationId)
+
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ if (isEmpty(modelUuid)) {
+ modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID"))
+ }
+
+ def isDebugLogEnabled = true
+ execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+
+ serviceIntentUtils.setExecVarFromJsonStr(execution, additionalPropJsonStr,
+ "transportNetworks", "transportNetworks", true)
+ logger.debug("transportNetworks: " + execution.getVariable("transportNetworks"))
+
+ if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
+ "enableSdnc", "enableSdnc"))) {
+ serviceIntentUtils.setEnableSdncConfig(execution)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Finish preProcessRequest")
+ }
+
+
+ void deleteServiceInstance(DelegateExecution execution) {
+ try {
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID")))
+ client.delete(uri)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoDeallocateTnNssi.deleteServiceInstance. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ void getExistingServiceInstance(DelegateExecution execution) {
+ String serviceInstanceId = execution.getVariable("cllId")
+
+ AAIResourcesClient resourceClient = getAAIClient()
+ AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+
+ try {
+ Optional<ServiceInstance> ssOpt = resourceClient.get(ServiceInstance.class, ssServiceuri)
+ if (ssOpt.isPresent()) {
+ ServiceInstance ss = ssOpt.get()
+ AllottedResources ars = serviceIntentUtils.getAllottedResourcesFromAai(execution, serviceInstanceId, true)
+ if (ars != null) {
+ List<AllottedResource> arList = ars.getAllottedResource()
+ List<String> arIdList = new ArrayList<>()
+ Map<String, String> policyMap = new HashMap<>()
+ Map<String, List<String>> logicalLinksMap = new HashMap<>()
+ for (AllottedResource ar : arList) {
+ String arId = ar.getId()
+ arIdList.add(arId)
+ String policyId = serviceIntentUtils.getPolicyIdFromAr(execution, serviceInstanceId, arId, true)
+ policyMap.put(arId, policyId)
+ List<String> logicalLinkList = serviceIntentUtils.getLogicalLinkNamesFromAr(execution,
+ serviceInstanceId, arId, true)
+ logicalLinksMap.put(arId, logicalLinkList)
+ }
+ execution.setVariable("arIdList", arIdList)
+ execution.setVariable("arPolicyMap", policyMap)
+ execution.setVariable("arLogicalLinkMap", logicalLinksMap)
+ } else {
+ logger.error("ERROR: getExistingServiceInstance: getAllottedResources() returned null. ss=" + ss
+ .toString())
+ }
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
+ "associate allotted resource for service :" + serviceInstanceId)
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in getExistingServiceInstance. " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void updateServiceInstanceInAAI(DelegateExecution execution) {
+ getExistingServiceInstance(execution)
+ updateTsciNetworks(execution)
+ }
+
+ void updateServiceInstance(DelegateExecution execution) {
+ String cllId = execution.getVariable("cllId")
+ try {
+ ServiceInstance ss = new ServiceInstance()
+ //ss.setServiceInstanceId(cllId)
+ String serviceStatus = "modified"
+ ss.setOrchestrationStatus(serviceStatus)
+ ss.setEnvironmentContext("tn")
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId))
+ client.update(uri, ss)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoModifyCllInstance.updateServiceInstance. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ String getValidArId(DelegateExecution execution, String arIdStr) {
+ List<String> arIdList = execution.getVariable("arIdList")
+ /*
+ * If arId is not specified by the caller, then we assume the caller
+ * wants to modify the first network (i.e., allotted resource) in the TSCi tree.
+ */
+ String arId = isBlank(arIdStr) ? arIdList.get(0) : arIdStr
+
+ return arId
+ }
+
+ void updateLogicalLinksInAr(DelegateExecution execution, String arId, String linkArrayJsonStr) {
+ try {
+ String serviceInstanceId = execution.getVariable('cllId')
+
+ /*
+ * Each TSCi connection-link in linkArrayJsonStr is considered as an "ADD" new
+ * link to allotted-resource. So, if the link already exists under AR, then do
+ * nothing. Otherwise, create logical-link.
+ */
+ List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayJsonStr)
+ for (String linkStr : linkStrList) {
+ if (logicalLinkExists(execution, arId, linkStr)) {
+ continue
+ }
+
+ createLogicalLinkForAllocatedResource(execution, linkStr, serviceInstanceId, arId)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "Exception in updateLogicalLinksInAr" + ex.getMessage())
+ }
+ }
+
+ void updateLogicalLinksInNetwork(DelegateExecution execution, String networkJsonStr) {
+ try {
+ String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
+ String linkArrayStr = jsonUtil.getJsonValue(networkJsonStr, "connectionLinks")
+ updateLogicalLinksInAr(execution, arId, linkArrayStr)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = String.format("ERROR: updateLogicalLinksInNetwork: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+ void updateTsciNetworks(DelegateExecution execution) {
+ try {
+ List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks"))
+ for (String networkStr : networkStrList) {
+ updateLogicalLinksInNetwork(execution, networkStr)
+ updateNetworkPolicy(execution, networkStr)
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "Exception in updateTsciNetworks" + ex.getMessage())
+ }
+ }
+
+ int getMaxBwFromNetworkJsonStr(DelegateExecution execution, String networkJsonStr) {
+ int maxBw = 0
+ try {
+ if (isBlank(networkJsonStr)) {
+ String msg = "ERROR: getMaxBw: networkJsonStr is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ String slaStr = jsonUtil.getJsonValue(networkJsonStr, "sla")
+ if (isBlank(slaStr)) {
+ String msg = "ERROR: getMaxBw: slaStr is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ String bwStr = jsonUtil.getJsonValue(slaStr, "maxBandwidth")
+ if (isNotBlank(bwStr)) {
+ maxBw = Integer.parseInt(bwStr)
+ } else {
+ logger.error("ERROR: getMaxBw: maxBandwidth is null")
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "Exception in getMaxBw" + ex.getMessage())
+ }
+
+ return maxBw
+ }
+
+ void updatePolicyMaxBandwidthInAAI(DelegateExecution execution, String policyId, int maxBw) {
+ try {
+ NetworkPolicy networkPolicy = new NetworkPolicy()
+ networkPolicy.setMaxBandwidth(maxBw)
+ AAIResourceUri networkPolicyUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(policyId))
+ getAAIClient().update(networkPolicyUri, networkPolicy)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoModifyCllInstance.updatePolicyMaxBandwidthInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void updateNetworkPolicy(DelegateExecution execution, String networkJsonStr) {
+ try {
+ int maxBw = getMaxBwFromNetworkJsonStr(execution, networkJsonStr)
+
+ String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
+ Map<String, String> policyMap = execution.getVariable("arPolicyMap")
+ String policyId = policyMap.get(arId)
+ if (isBlank(policyId)) {
+ String msg = String.format("ERROR: updateNetworkPolicy: policyId not found. arId=%s", arId)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ updatePolicyMaxBandwidthInAAI(execution, policyId, maxBw)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+
+ void createLogicalLinkForAllocatedResource(DelegateExecution execution,
+ String linkJsonStr, String cllId,
+ String allottedResourceId) {
+ try {
+ AAIResourceUri allottedResourceUri = serviceIntentUtils.buildAllottedResourceUri(execution,
+ cllId, allottedResourceId)
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
+ String linkId = jsonUtil.getJsonValue(linkJsonStr, "id")
+ if (isBlank(linkId)) {
+ linkId = "cll-" + UUID.randomUUID().toString()
+ }
+ logger.debug("createLogicalLinkForAllocatedResource: linkId=" + linkId)
+
+ String epA = jsonUtil.getJsonValue(linkJsonStr, "transportEndpointA")
+ String epB = jsonUtil.getJsonValue(linkJsonStr, "transportEndpointB")
+ String modelInvariantId = execution.getVariable("modelInvariantUuid")
+ String modelVersionId = execution.getVariable("modelUuid")
+
+ org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+ resource.setLinkId(linkId)
+ resource.setLinkName(epA)
+ resource.setLinkName2(epB)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
+
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
+ getAAIClient().create(logicalLinkUri, resource)
+
+ serviceIntentUtils.attachLogicalLinkToAllottedResource(execution, serviceIntentUtils.AAI_VERSION,
+ allottedResourceUri, epA);
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoModifyCllInstance.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ void preprocessSdncModifyCllRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preprocessSdncModifyCllRequest(' +
+ 'execution=' + execution.getId() + ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ try {
+ String serviceInstanceId = execution.getVariable("cllId")
+
+ String sdncRequest = serviceIntentUtils.buildSDNCRequest(execution, serviceInstanceId, "update")
+
+ execution.setVariable("CLL_SDNCRequest", sdncRequest)
+ logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ logger.debug("Exception Occurred Processing preprocessSdncModifyCllRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preprocessSdncModifyCllRequest Process")
+ }
+
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ serviceIntentUtils.validateSDNCResponse(execution, response, method)
+ }
+
+
+ void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String cllId = execution.getVariable("cllId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = new ServiceInstance()
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(cllId))
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ void prepareUpdateJobStatus(DelegateExecution execution,
+ String status,
+ String progress,
+ String statusDescription) {
+ String cllId = execution.getVariable("cllId")
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = cllId
+ String operType = "MODIFY"
+
+ ResourceOperationStatus roStatus = serviceIntentUtils.buildRoStatus(modelUuid, cllId,
+ jobId, nsiId, operType, status, progress, statusDescription)
+
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ }
+
+ boolean logicalLinkExists(DelegateExecution execution, String arIdStr, String linkJsonStr) {
+ if (isBlank(arIdStr)) {
+ logger.error("ERROR: logicalLinkExists: arIdStr is empty")
+ return false
+ }
+ if (isBlank(linkJsonStr)) {
+ logger.error("ERROR: logicalLinkExists: linkJsonStr is empty")
+ return false
+ }
+
+ Map<String, List<String>> logicalLinksMap = execution.getVariable("arLogicalLinkMap")
+ if (logicalLinksMap == null) {
+ logger.error("ERROR: logicalLinkExists: logicalLinksMap is null")
+ return false
+ }
+
+ List<String> logicalLinkNameList = logicalLinksMap.get(arIdStr)
+ if (logicalLinksMap == null) {
+ logger.error("ERROR: logicalLinkExists: logicalLinkNameList is null. arIdStr=" + arIdStr)
+ return false
+ }
+
+ String linkName = jsonUtil.getJsonValue(linkJsonStr, "transportEndpointA")
+ if (isBlank(linkName)) {
+ logger.error("ERROR: logicalLinkExists: epA is empty")
+ return false
+ }
+
+ return logicalLinkNameList.contains(linkName)
+ }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
index 8859af25f6..f6be861bde 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
@@ -388,12 +388,12 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
Optional<org.onap.aai.domain.yang.LogicalLink> resource = wrapper01.asBean(org.onap.aai.domain.yang.LogicalLink.class)
if (resource.isPresent()) {
org.onap.aai.domain.yang.LogicalLink logicalLinkInstance = resource.get()
- if(domainType.equalsIgnoreCase("TN-FH"))
+ if(domainType.equalsIgnoreCase("TN_FH"))
{
execution.setVariable("tranportEp_ID_RU",logicalLinkInstance.getLinkName())
execution.setVariable("tranportEp_ID_DUIN",logicalLinkInstance.getLinkName2())
}
- else if(domainType.equalsIgnoreCase("TN-MH"))
+ else if(domainType.equalsIgnoreCase("TN_MH"))
{
execution.setVariable("tranportEp_ID_DUEG",logicalLinkInstance.getLinkName())
execution.setVariable("tranportEp_ID_CUIN",logicalLinkInstance.getLinkName2())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy
new file mode 100644
index 0000000000..df817ed90b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy
@@ -0,0 +1,128 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class ModifyServiceIntentInstance extends AbstractServiceTaskProcessor {
+ String Prefix="MCLL_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+
+ private static final Logger logger = LoggerFactory.getLogger(ModifyServiceIntentInstance.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ serviceIntentUtils.setCommonExecutionVars(execution)
+
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ModifyServiceIntentInstance.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String siId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = siId
+ String modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(siId)
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + "jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(nsiId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(modelUuid)
+ initStatus.setOperType("Modify")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+ logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
+ sendWorkflowResponse(execution, 202, modifySyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
index 7e505d1912..146ceddab4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
@@ -142,7 +142,8 @@ class ModifySliceSubnet extends AbstractServiceTaskProcessor {
ResourceOperationStatus initStatus = new ResourceOperationStatus()
initStatus.setServiceId(nsiId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(modelUuid)
+ //initStatus.setResourceTemplateUUID(modelUuid)
+ initStatus.setResourceInstanceID(nssiId)
initStatus.setOperType("Modify")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
new file mode 100644
index 0000000000..f60bfa1c47
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
@@ -0,0 +1,669 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aai.domain.yang.LogicalLink
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.AAIVersion
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.Relationships
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isNotBlank
+
+class ServiceIntentUtils {
+ static final String AAI_VERSION = AAIVersion.LATEST
+ private static final Logger logger = LoggerFactory.getLogger(ServiceIntentUtils.class);
+
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ MsoUtils msoUtils = new MsoUtils()
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+
+ ServiceIntentUtils() {
+ }
+
+
+ void setCommonExecutionVars(DelegateExecution execution) {
+ setCommonExecutionVars(execution, true)
+ }
+
+ void setCommonExecutionVars(DelegateExecution execution, boolean exceptionOnErr) {
+ def msg
+ try {
+ // get request input
+ String bpmnRequestStr = execution.getVariable("bpmnRequest")
+ logger.debug("Input Request: " + bpmnRequestStr)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("requestId: " + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(bpmnRequestStr, "globalSubscriberId")
+ if (isBlank(globalSubscriberId) && exceptionOnErr) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ String serviceType = jsonUtil.getJsonValue(bpmnRequestStr, "serviceType")
+ if (isBlank(serviceType) && exceptionOnErr) {
+ msg = "Input serviceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("serviceType", serviceType)
+ }
+
+ String servicename = jsonUtil.getJsonValue(bpmnRequestStr, "name")
+ if (isNotBlank(servicename)) {
+ execution.setVariable("servicename", servicename)
+ } else {
+ logger.debug("erviceIntentUtils.setCommonExecutionVars: servicename is NOT set")
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(bpmnRequestStr, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(bpmnRequestStr, "additionalProperties")
+ execution.setVariable("serviceIntentParams", sliceParams)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in ServiceIntentUtils.setCommonExecutionVars: " + ex.getMessage()
+ logger.debug(msg)
+ if (exceptionOnErr) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ }
+
+ void setSdncCallbackUrl(DelegateExecution execution, boolean exceptionOnErr) {
+ setSdncCallbackUrl(execution, "sdncCallbackUrl", exceptionOnErr)
+ }
+
+ void setSdncCallbackUrl(DelegateExecution execution, String variableName, boolean exceptionOnErr) {
+ String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution)
+
+ if (isBlank(sdncCallbackUrl) && exceptionOnErr) {
+ String msg = "mso.workflow.sdncadapter.callback is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable(variableName, sdncCallbackUrl)
+ }
+ }
+
+ String buildSDNCRequest(DelegateExecution execution, String svcInstId, String svcAction) {
+ String reqAction
+ switch (svcAction) {
+ case "create":
+ reqAction = "CreateCloudLeasedLineInstance"
+ break
+ case "delete":
+ reqAction = "DeleteCloudLeasedLineInstance"
+ break
+ case "activate":
+ reqAction = "ActivateCloudLeasedLineInstance"
+ break
+ case "deactivate":
+ reqAction = "DeactivateCloudLeasedLineInstance"
+ break
+ case "update":
+ reqAction = "ModifyCloudLeasedLineInstance"
+ break
+ default:
+ reqAction = svcAction
+ }
+
+ buildSDNCRequest(execution, svcInstId, svcAction, reqAction)
+ }
+
+ String buildSDNCRequest(DelegateExecution execution, String svcInstId, String svcAction, String reqAction) {
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if (uuid == null) {
+ uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
+ }
+
+ def callbackURL = execution.getVariable("sdncCallbackUrl")
+ def requestId = execution.getVariable("msoRequestId")
+ def serviceId = execution.getVariable("sliceServiceInstanceId")
+ def subServiceType = execution.getVariable("subscriptionServiceType")
+ def vnfType = execution.getVariable("serviceType")
+ def vnfName = execution.getVariable("sliceServiceInstanceName")
+ def tenantId = execution.getVariable("sliceServiceInstanceId")
+ def source = execution.getVariable("sliceServiceInstanceId")
+ def vnfId = execution.getVariable("sliceServiceInstanceId")
+ def cloudSiteId = execution.getVariable("sliceServiceInstanceId")
+ def serviceModelInfo = execution.getVariable("serviceModelInfo")
+ def vnfModelInfo = execution.getVariable("serviceModelInfo")
+ def globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+ String vnfNameString = """<vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>"""
+ String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo)
+ String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo)
+
+ String sdncVNFParamsXml = ""
+
+ if (execution.getVariable("vnfParamsExistFlag") == true) {
+ sdncVNFParamsXml = buildSDNCParamsXml(execution)
+ } else {
+ sdncVNFParamsXml = buildDefaultVnfInputParams(vnfId)
+ }
+
+ String sdncRequest =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <request-action>${MsoUtils.xmlEscape(reqAction)}</request-action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
+ <notification-url/>
+ <order-number/>
+ <order-version/>
+ </request-information>
+ <service-information>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <subscription-service-type>${MsoUtils.xmlEscape(subServiceType)}</subscription-service-type>
+ ${serviceEcompModelInformation}
+ <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
+ <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
+ </service-information>
+ <vnf-information>
+ <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
+ <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
+ ${vnfEcompModelInformation}
+ </vnf-information>
+ <vnf-request-input>
+ ${vnfNameString}
+ <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
+ <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
+ ${sdncVNFParamsXml}
+ </vnf-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
+
+ logger.debug("sdncRequest: " + sdncRequest)
+ return sdncRequest
+ }
+
+
+ String buildDefaultVnfInputParams(String vnfName) {
+ String res =
+ """<vnf-input-parameters>
+ <param>
+ <name>${MsoUtils.xmlEscape(vnfName)}</name>
+ </param>
+ </vnf-input-parameters>"""
+
+ return res
+ }
+
+ String buildSDNCParamsXml(DelegateExecution execution) {
+ String params = ""
+ StringBuilder sb = new StringBuilder()
+ Map<String, String> paramsMap = execution.getVariable("TNNSSMF_vnfParamsMap")
+
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String key = entry.getKey();
+ String value = entry.getValue()
+ paramsXml = """<${key}>$value</$key>"""
+ params = sb.append(paramsXml)
+ }
+ return params
+ }
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ validateSDNCResponse(execution, response, method, true)
+ }
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method, boolean exceptionOnErr) {
+ logger.debug("STARTED ValidateSDNCResponse Process")
+
+ String msg
+
+ String prefix = execution.getVariable("prefix")
+ if (isBlank(prefix)) {
+ if (exceptionOnErr) {
+ msg = "validateSDNCResponse: prefix is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ return
+ }
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+ logger.debug("ServiceIntentUtils.validateSDNCResponse: SDNCResponse: " + response)
+ logger.debug("ServiceIntentUtils.validateSDNCResponse: workflowException: " + workflowException)
+
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ String sdncResponse = response
+ if (execution.getVariable(prefix + 'sdncResponseSuccess') == true) {
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ RollbackData rollbackData = execution.getVariable("rollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData()
+ }
+
+ if (method.equals("allocate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestAllocate", "true")
+ } else if (method.equals("deallocate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeallocate", "true")
+ } else if (method.equals("activate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestActivate", "true")
+ } else if (method.equals("deactivate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeactivate", "true")
+ } else if (method.equals("modify")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestModify", "true")
+ }
+ execution.setVariable("rollbackData", rollbackData)
+ } else {
+ if (exceptionOnErr) {
+ msg = "ServiceIntentUtils.validateSDNCResponse: bad Response from SDNC Adapter for " + method + " SDNC Call."
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ }
+
+ logger.debug("COMPLETED ValidateSDNCResponse Process")
+ }
+
+ String getExecutionInputParams(DelegateExecution execution) {
+ String res = "\n msoRequestId=" + execution.getVariable("msoRequestId") +
+ "\n modelInvariantUuid=" + execution.getVariable("modelInvariantUuid") +
+ "\n modelUuid=" + execution.getVariable("modelUuid") +
+ "\n serviceInstanceID=" + execution.getVariable("serviceInstanceID") +
+ "\n operationType=" + execution.getVariable("operationType") +
+ "\n globalSubscriberId=" + execution.getVariable("globalSubscriberId") +
+ "\n dummyServiceId=" + execution.getVariable("dummyServiceId") +
+ "\n nsiId=" + execution.getVariable("nsiId") +
+ "\n serviceType=" + execution.getVariable("serviceType") +
+ "\n subscriptionServiceType=" + execution.getVariable("subscriptionServiceType") +
+ "\n jobId=" + execution.getVariable("jobId") +
+ "\n serviceIntentParams=" + execution.getVariable("serviceIntentParams") +
+ "\n servicename=" + execution.getVariable("servicename")
+
+ return res
+ }
+
+ String getFirstSnssaiFromSliceProfile(String sliceProfileStr) {
+ String snssaiListStr = jsonUtil.getJsonValue(sliceProfileStr, "snssaiList")
+ String snssai = jsonUtil.StringArrayToList(snssaiListStr).get(0)
+
+ return snssai
+ }
+
+ String getFirstPlmnIdFromSliceProfile(String sliceProfileStr) {
+ String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "plmnIdList")
+ String res = jsonUtil.StringArrayToList(plmnListStr).get(0)
+
+ return res
+ }
+
+ void createRelationShipInAAI(DelegateExecution execution, AAIResourceUri uri, Relationship relationship) {
+ logger.debug("createRelationShipInAAI Start")
+ String msg
+ AAIResourcesClient client = new AAIResourcesClient()
+ try {
+ if (!client.exists(uri)) {
+ logger.info("ERROR: createRelationShipInAAI: not exist: uri={}", uri)
+ return
+ }
+ AAIResourceUri from = ((AAIResourceUri) (uri.clone())).relationshipAPI()
+ client.create(from, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("createRelationShipInAAI Exit")
+ }
+
+ void attachLogicalLinkToAllottedResource(DelegateExecution execution, String aaiVersion, AAIResourceUri arUri,
+ String logicalLinkId) {
+
+ String toLink = "aai/${aaiVersion}/network/logical-links/logical-link/${logicalLinkId}"
+
+ Relationship relationship = new Relationship()
+ relationship.setRelatedLink(toLink)
+ relationship.setRelatedTo("logical-link")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+
+ createRelationShipInAAI(execution, arUri, relationship)
+ }
+
+ void attachNetworkPolicyToAllottedResource(DelegateExecution execution, String aaiVersion,
+ AAIResourceUri aaiResourceUri, String networkPolicyId) {
+
+ String toLink = "aai/${aaiVersion}/network/network-policies/network-policy/${networkPolicyId}"
+
+ Relationship relationship = new Relationship()
+ relationship.setRelatedLink(toLink)
+ relationship.setRelatedTo("network-policy")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.Uses")
+
+ createRelationShipInAAI(execution, aaiResourceUri, relationship)
+
+ }
+
+ ResourceOperationStatus buildRoStatus(String nsstId,
+ String nssiId,
+ String jobId,
+ String nsiId,
+ String action,
+ String status,
+ String progress,
+ String statusDescription) {
+ ResourceOperationStatus roStatus = new ResourceOperationStatus()
+ roStatus.setResourceTemplateUUID(nsstId)
+ roStatus.setResourceInstanceID(nssiId)
+ roStatus.setServiceId(nsiId)
+ roStatus.setOperationId(jobId)
+ roStatus.setOperType(action)
+ roStatus.setProgress(progress)
+ roStatus.setStatus(status)
+ roStatus.setStatusDescription(statusDescription)
+
+ return roStatus
+ }
+
+
+ void setEnableSdncConfig(DelegateExecution execution) {
+ String enableSdnc = UrnPropertiesReader.getVariable(
+ "mso.workflow.TnNssmf.enableSDNCNetworkConfig")
+ if (isBlank(enableSdnc)) {
+ logger.debug("mso.workflow.TnNssmf.enableSDNCNetworkConfig is undefined, so use default value (true)")
+ enableSdnc = "true"
+ }
+
+ logger.debug("setEnableSdncConfig: enableSdnc=" + enableSdnc)
+
+ execution.setVariable("enableSdnc", enableSdnc)
+ }
+
+ String setExecVarFromJsonIfExists(DelegateExecution execution,
+ String jsonStr, String jsonKey, String varName) {
+ return setExecVarFromJsonStr(execution, jsonStr, jsonKey, varName, false)
+ }
+
+ String setExecVarFromJsonStr(DelegateExecution execution,
+ String jsonStr, String jsonKey, String varName,
+ boolean exceptionOnErr) {
+ String msg = ""
+ String valueStr = jsonUtil.getJsonValue(jsonStr, jsonKey)
+ if (isBlank(valueStr)) {
+ if (exceptionOnErr) {
+ msg = "cannot find " + jsonKey + " in " + jsonStr
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ } else {
+ execution.setVariable(varName, valueStr)
+ }
+
+ return valueStr
+ }
+
+ ServiceInstance getServiceInstanceFromAai(String serviceInstanceId) {
+ if (isBlank(serviceInstanceId)) {
+ logger.error("ERROR: getServiceInstanceFromAai: serviceInstanceId is blank")
+ return null
+ }
+
+ ServiceInstance nssi = null
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCE
+ .getFragment(serviceInstanceId))
+ Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, uri)
+
+ if (nssiOpt.isPresent()) {
+ nssi = nssiOpt.get()
+ return nssi
+ } else {
+ String msg = String.format("ERROR: getServiceInstanceFromAai: NSSI %s not found in AAI", serviceInstanceId)
+ logger.error(msg)
+ }
+
+ return nssi;
+ }
+
+ String getModelUuidFromServiceInstance(String serviceInstanceId) {
+ ServiceInstance si = getServiceInstanceFromAai(serviceInstanceId)
+ if (si == null) {
+ String msg = String.format("ERROR: getModelUuidFromServiceInstance: getServiceInstanceFromAai() failed. " +
+ "serviceInstanceId=%s", serviceInstanceId)
+ logger.error(msg)
+ return null
+ }
+
+ return si.getModelVersionId()
+ }
+
+ AAIResourceUri buildNetworkPolicyUri(String networkPolicyId) {
+ AAIResourceUri networkPolicyUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
+
+ return networkPolicyUri
+ }
+
+ AAIResourceUri buildAllottedResourceUri(DelegateExecution execution, String serviceInstanceId,
+ String allottedResourceId) {
+
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(serviceInstanceId)
+ .allottedResource(allottedResourceId))
+
+ return allottedResourceUri
+ }
+
+ AAIPluralResourceUri buildAllottedResourcesUri(DelegateExecution execution, String serviceInstanceId) {
+
+ AAIPluralResourceUri arsUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(serviceInstanceId)
+ .allottedResources())
+
+ return arsUri
+ }
+
+ AllottedResources getAllottedResourcesFromAai(DelegateExecution execution, String serviceInstanceId, boolean exceptionOnErr) {
+ AllottedResources res
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIPluralResourceUri arsUri = buildAllottedResourcesUri(execution, serviceInstanceId)
+
+ //AAIResultWrapper wrapperAllotted = client.get(arsUri, NotFoundException.class)
+ //Optional<AllottedResources> allAllotted = wrapperAllotted.asBean(AllottedResources.class)
+ //AllottedResources allottedResources = allAllotted.get()
+
+ Optional<AllottedResources> arsOpt = client.get(AllottedResources.class, arsUri)
+ if (arsOpt.isPresent()) {
+ res = arsOpt.get()
+ return res
+ } else {
+ String msg = String.format("ERROR: getAllottedResourcesFromAai: ars not found. nssiId=%s", serviceInstanceId)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getAllottedResourcesFromAai: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
+
+ String getPolicyIdFromAr(DelegateExecution execution, String serviceInstanceId,
+ String arId, boolean exceptionOnErr) {
+ String res
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIResourceUri arUri = buildAllottedResourceUri(execution, serviceInstanceId, arId)
+ List<AAIResourceUri> policyUriList = getRelationshipUriListInAai(execution, arUri,
+ AAIFluentTypeBuilder.Types.NETWORK_POLICY, exceptionOnErr)
+ for (AAIResourceUri policyUri : policyUriList) {
+ Optional<NetworkPolicy> policyOpt = client.get(NetworkPolicy.class, policyUri)
+ if (policyOpt.isPresent()) {
+ NetworkPolicy policy = policyOpt.get()
+ return policy.getNetworkPolicyId()
+ } else {
+ String msg = String.format("ERROR: getPolicyIdFromAr: arUri=%s", policyUri)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getPolicyIdFromAr: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
+
+
+ List<AAIResourceUri> getRelationshipUriListInAai(DelegateExecution execution,
+ AAIResourceUri uri,
+ Object info,
+ boolean exceptionOnErr) {
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResultWrapper wrapper = client.get(uri);
+ Optional<Relationships> relationships = wrapper.getRelationships()
+ if (relationships.isPresent()) {
+ return relationships.get().getRelatedUris(info)
+ } else {
+ if (exceptionOnErr) {
+ String msg = "ERROR: getRelationshipUriListInAai: No relationship found"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return null
+ }
+
+ List<String> getLogicalLinkNamesFromAr(DelegateExecution execution, String serviceInstanceId,
+ String arId, boolean exceptionOnErr) {
+ List<String> res = new ArrayList<>()
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIResourceUri arUri = buildAllottedResourceUri(execution, serviceInstanceId, arId)
+ List<AAIResourceUri> logicalLinkUriList = getRelationshipUriListInAai(execution, arUri,
+ AAIFluentTypeBuilder.Types.LOGICAL_LINK, exceptionOnErr)
+ for (AAIResourceUri logicalLinkUri : logicalLinkUriList) {
+ Optional<LogicalLink> logicalLinkOpt = client.get(LogicalLink.class, logicalLinkUri)
+ if (logicalLinkOpt.isPresent()) {
+ LogicalLink logicalLink = logicalLinkOpt.get()
+ res.add(logicalLink.getLinkName())
+ } else {
+ String msg = String.format("ERROR: getLogicalLinkNamesFromAr: logicalLinkUri=%s", logicalLinkUri)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getLogicalLinkNamesFromAr: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
index 4012467df9..bfc8ccacb2 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
@@ -55,13 +55,13 @@ nss.sendSyncResponse(execution)</bpmn:script>
<bpmn:sequenceFlow id="Flow_0ayd6dj" sourceRef="Activity_0qlstj2" targetRef="Activity_1usi32q" />
<bpmn:sequenceFlow id="Flow_0m5n6md" sourceRef="Activity_1usi32q" targetRef="Gateway_15a04ct" />
<bpmn:sequenceFlow id="Flow_1fij4ds" name="Is CN ?" sourceRef="Gateway_15a04ct" targetRef="CallDoAllocateCoreNSSI">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "CN"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "cn"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_0g7721r" name="Is TN ?" sourceRef="Gateway_15a04ct" targetRef="CallDoAllocateTransportNSSI">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "tn"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_1kk0exp" name="Is AN ?" sourceRef="Gateway_15a04ct" targetRef="CallDoAllocateAccessNSSI">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "an"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_09b50tn" sourceRef="CallDoAllocateAccessNSSI" targetRef="Event_18u424w" />
<bpmn:callActivity id="CallDoAllocateAccessNSSI" name="Call ANAllocateNSSI" calledElement="DoAllocateAccessNSSI">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn
new file mode 100644
index 0000000000..7e8290d728
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_04bdlh3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="CreateServiceIntentInstance" name="CreateServiceIntentInstance" isExecutable="true">
+ <bpmn:startEvent id="Event_16inlk9" name="Start">
+ <bpmn:outgoing>Flow_0cmaj9d</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="Activity_1hyt0pb" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0cmaj9d</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ou7wr9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new CreateServiceIntentInstance()
+nss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_1usi32q" name="Send Sync Response" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0ayd6dj</bpmn:incoming>
+ <bpmn:outgoing>Flow_0m5n6md</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new CreateServiceIntentInstance()
+nss.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_15a04ct" name="which Intent&#10; service ?">
+ <bpmn:incoming>Flow_0m5n6md</bpmn:incoming>
+ <bpmn:outgoing>Flow_1fij4ds</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0g7721r</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1kk0exp</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="Event_18u424w">
+ <bpmn:incoming>Flow_189zwjw</bpmn:incoming>
+ <bpmn:incoming>Flow_1fij4ds</bpmn:incoming>
+ <bpmn:incoming>Flow_1kk0exp</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="Activity_0qlstj2" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_18cgkru</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ayd6dj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0cmaj9d" sourceRef="Event_16inlk9" targetRef="Activity_1hyt0pb" />
+ <bpmn:sequenceFlow id="Flow_0ayd6dj" sourceRef="Activity_0qlstj2" targetRef="Activity_1usi32q" />
+ <bpmn:sequenceFlow id="Flow_0m5n6md" sourceRef="Activity_1usi32q" targetRef="Gateway_15a04ct" />
+ <bpmn:sequenceFlow id="Flow_1fij4ds" name="Other" sourceRef="Gateway_15a04ct" targetRef="Event_18u424w">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") != "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0g7721r" name="Clould Leased Line" sourceRef="Gateway_15a04ct" targetRef="CallDoCloudLeasedLineCreate">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") == "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1kk0exp" sourceRef="Gateway_15a04ct" targetRef="Event_18u424w">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="Activity_1ydx2rx" name="Init Resource Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0ou7wr9</bpmn:incoming>
+ <bpmn:outgoing>Flow_18cgkru</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new CreateServiceIntentInstance()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0ou7wr9" sourceRef="Activity_1hyt0pb" targetRef="Activity_1ydx2rx" />
+ <bpmn:sequenceFlow id="Flow_18cgkru" sourceRef="Activity_1ydx2rx" targetRef="Activity_0qlstj2" />
+ <bpmn:sequenceFlow id="Flow_189zwjw" sourceRef="CallDoCloudLeasedLineCreate" targetRef="Event_18u424w" />
+ <bpmn:callActivity id="CallDoCloudLeasedLineCreate" name="Call CloudLeasedLineCreate" calledElement="DoCloudLeasedLineCreate">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+ <camunda:in source="modelUuid" target="modelUuid" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="serviceIntentParams" target="serviceIntentParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0g7721r</bpmn:incoming>
+ <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing>
+ </bpmn:callActivity>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateServiceIntentInstance">
+ <bpmndi:BPMNEdge id="Flow_189zwjw_di" bpmnElement="Flow_189zwjw">
+ <di:waypoint x="1080" y="230" />
+ <di:waypoint x="1170" y="230" />
+ <di:waypoint x="1170" y="148" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_18cgkru_di" bpmnElement="Flow_18cgkru">
+ <di:waypoint x="480" y="130" />
+ <di:waypoint x="550" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ou7wr9_di" bpmnElement="Flow_0ou7wr9">
+ <di:waypoint x="320" y="130" />
+ <di:waypoint x="380" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1kk0exp_di" bpmnElement="Flow_1kk0exp">
+ <di:waypoint x="915" y="130" />
+ <di:waypoint x="1152" y="130" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="930" y="125" width="37" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0g7721r_di" bpmnElement="Flow_0g7721r">
+ <di:waypoint x="890" y="155" />
+ <di:waypoint x="890" y="230" />
+ <di:waypoint x="980" y="230" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="897" y="203" width="71" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1fij4ds_di" bpmnElement="Flow_1fij4ds">
+ <di:waypoint x="915" y="130" />
+ <di:waypoint x="1152" y="130" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1021" y="112" width="28" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0m5n6md_di" bpmnElement="Flow_0m5n6md">
+ <di:waypoint x="800" y="130" />
+ <di:waypoint x="865" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ayd6dj_di" bpmnElement="Flow_0ayd6dj">
+ <di:waypoint x="650" y="130" />
+ <di:waypoint x="700" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0cmaj9d_di" bpmnElement="Flow_0cmaj9d">
+ <di:waypoint x="188" y="130" />
+ <di:waypoint x="220" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_16inlk9_di" bpmnElement="Event_16inlk9">
+ <dc:Bounds x="152" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="155" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1hyt0pb_di" bpmnElement="Activity_1hyt0pb">
+ <dc:Bounds x="220" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1usi32q_di" bpmnElement="Activity_1usi32q">
+ <dc:Bounds x="700" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_15a04ct_di" bpmnElement="Gateway_15a04ct" isMarkerVisible="true">
+ <dc:Bounds x="865" y="105" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="861" y="76" width="58" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_18u424w_di" bpmnElement="Event_18u424w">
+ <dc:Bounds x="1152" y="112" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0qlstj2_di" bpmnElement="Activity_0qlstj2">
+ <dc:Bounds x="550" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1ydx2rx_di" bpmnElement="Activity_1ydx2rx">
+ <dc:Bounds x="380" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_00awuik_di" bpmnElement="CallDoCloudLeasedLineCreate">
+ <dc:Bounds x="980" y="190" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn
new file mode 100644
index 0000000000..384f9657d3
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1stoy5y" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DeleteServiceIntentInstance" name="DeallocateSliceSubnet" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="Start">
+ <bpmn:outgoing>Flow_143ck2k</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="Flow_143ck2k" sourceRef="StartEvent_1" targetRef="Activity_0zyhkvj" />
+ <bpmn:scriptTask id="Activity_0zyhkvj" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_143ck2k</bpmn:incoming>
+ <bpmn:outgoing>Flow_0pttfuf</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeleteServiceIntentInstance()
+nss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_0c6o2o7" name="Send Sync Response" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1c1j5i1</bpmn:incoming>
+ <bpmn:outgoing>Flow_1kljyhj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeleteServiceIntentInstance()
+nss.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Activity_1dykbz9" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_04jsg9s</bpmn:incoming>
+ <bpmn:outgoing>Flow_1c1j5i1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0pttfuf" sourceRef="Activity_0zyhkvj" targetRef="Activity_1fj0cge" />
+ <bpmn:sequenceFlow id="Flow_1c1j5i1" sourceRef="Activity_1dykbz9" targetRef="Activity_0c6o2o7" />
+ <bpmn:scriptTask id="Activity_1fj0cge" name="Init Resource Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0pttfuf</bpmn:incoming>
+ <bpmn:outgoing>Flow_04jsg9s</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeleteServiceIntentInstance()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_04jsg9s" sourceRef="Activity_1fj0cge" targetRef="Activity_1dykbz9" />
+ <bpmn:exclusiveGateway id="Gateway_1jagvdq" name="Which Intent service type?">
+ <bpmn:incoming>Flow_1kljyhj</bpmn:incoming>
+ <bpmn:outgoing>Flow_0zwyxxc</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0roz1jy</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:callActivity id="Activity_0li16m1" name="Call CloudLeasedLineDelete" calledElement="DoCloudLeasedLineDelete">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="serviceIntentParams" target="serviceIntentParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0zwyxxc</bpmn:incoming>
+ <bpmn:outgoing>Flow_1l74oic</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="Event_1ecylff">
+ <bpmn:incoming>Flow_1l74oic</bpmn:incoming>
+ <bpmn:incoming>Flow_0roz1jy</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_0zwyxxc" name="Cloud Leased Line" sourceRef="Gateway_1jagvdq" targetRef="Activity_0li16m1">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") == "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0roz1jy" name="Other service type" sourceRef="Gateway_1jagvdq" targetRef="Event_1ecylff">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") != "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1l74oic" sourceRef="Activity_0li16m1" targetRef="Event_1ecylff" />
+ <bpmn:sequenceFlow id="Flow_1kljyhj" sourceRef="Activity_0c6o2o7" targetRef="Gateway_1jagvdq" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteServiceIntentInstance">
+ <bpmndi:BPMNEdge id="Flow_1kljyhj_di" bpmnElement="Flow_1kljyhj">
+ <di:waypoint x="890" y="250" />
+ <di:waypoint x="975" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1l74oic_di" bpmnElement="Flow_1l74oic">
+ <di:waypoint x="1190" y="120" />
+ <di:waypoint x="1280" y="120" />
+ <di:waypoint x="1280" y="232" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0roz1jy_di" bpmnElement="Flow_0roz1jy">
+ <di:waypoint x="1025" y="250" />
+ <di:waypoint x="1262" y="250" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1085" y="232" width="90" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0zwyxxc_di" bpmnElement="Flow_0zwyxxc">
+ <di:waypoint x="1000" y="225" />
+ <di:waypoint x="1000" y="120" />
+ <di:waypoint x="1090" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="996" y="86" width="68" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_04jsg9s_di" bpmnElement="Flow_04jsg9s">
+ <di:waypoint x="520" y="250" />
+ <di:waypoint x="600" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1c1j5i1_di" bpmnElement="Flow_1c1j5i1">
+ <di:waypoint x="700" y="250" />
+ <di:waypoint x="790" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0pttfuf_di" bpmnElement="Flow_0pttfuf">
+ <di:waypoint x="330" y="250" />
+ <di:waypoint x="420" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_143ck2k_di" bpmnElement="Flow_143ck2k">
+ <di:waypoint x="168" y="250" />
+ <di:waypoint x="230" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="132" y="232" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="138" y="275" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1jawdkz_di" bpmnElement="Activity_0zyhkvj">
+ <dc:Bounds x="230" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1n1ajr4_di" bpmnElement="Activity_0c6o2o7">
+ <dc:Bounds x="790" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1dykbz9_di" bpmnElement="Activity_1dykbz9">
+ <dc:Bounds x="600" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1fj0cge_di" bpmnElement="Activity_1fj0cge">
+ <dc:Bounds x="420" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1jagvdq_di" bpmnElement="Gateway_1jagvdq" isMarkerVisible="true">
+ <dc:Bounds x="975" y="225" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="967" y="286" width="65" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0li16m1_di" bpmnElement="Activity_0li16m1">
+ <dc:Bounds x="1090" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1ecylff_di" bpmnElement="Event_1ecylff">
+ <dc:Bounds x="1262" y="232" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn
new file mode 100644
index 0000000000..e042c1a552
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0fme930" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="ModifyServiceIntentInstance" name="ModifyServiceIntentInstance" isExecutable="true">
+ <bpmn:startEvent id="Event_05idy03" name="Start">
+ <bpmn:outgoing>Flow_1t0w8dn</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="Activity_0kd9pxx" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1t0w8dn</bpmn:incoming>
+ <bpmn:outgoing>Flow_0fzchbl</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifyServiceIntentInstance()
+nss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_1dzkfh2" name="Send Sync Response" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1q030ul</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ps6iyc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifyServiceIntentInstance()
+nss.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_1baxf7k" name="Which Intent Service">
+ <bpmn:incoming>Flow_0ps6iyc</bpmn:incoming>
+ <bpmn:outgoing>Flow_15luvlg</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0usuozn</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1dfyoe6</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="Event_103vvkf">
+ <bpmn:incoming>Flow_1b2k523</bpmn:incoming>
+ <bpmn:incoming>Flow_1dfyoe6</bpmn:incoming>
+ <bpmn:incoming>Flow_15luvlg</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="Activity_0ptby3d" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1grhlet</bpmn:incoming>
+ <bpmn:outgoing>Flow_1q030ul</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1t0w8dn" sourceRef="Event_05idy03" targetRef="Activity_0kd9pxx" />
+ <bpmn:sequenceFlow id="Flow_0fzchbl" sourceRef="Activity_0kd9pxx" targetRef="Activity_1s8ojcr" />
+ <bpmn:sequenceFlow id="Flow_1q030ul" sourceRef="Activity_0ptby3d" targetRef="Activity_1dzkfh2" />
+ <bpmn:sequenceFlow id="Flow_0ps6iyc" sourceRef="Activity_1dzkfh2" targetRef="Gateway_1baxf7k" />
+ <bpmn:sequenceFlow id="Flow_15luvlg" sourceRef="Gateway_1baxf7k" targetRef="Event_103vvkf">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0usuozn" name="Cloud Leased Line" sourceRef="Gateway_1baxf7k" targetRef="Activity_0t1g4mp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") == "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="Activity_1s8ojcr" name="Init Resource Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0fzchbl</bpmn:incoming>
+ <bpmn:outgoing>Flow_1grhlet</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifyServiceIntentInstance()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1grhlet" sourceRef="Activity_1s8ojcr" targetRef="Activity_0ptby3d" />
+ <bpmn:callActivity id="Activity_0t1g4mp" name="Call CloudLeasedLineModify" calledElement="DoCloudLeasedLineModify">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="serviceIntentParams" target="serviceIntentParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0usuozn</bpmn:incoming>
+ <bpmn:outgoing>Flow_1b2k523</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_1b2k523" sourceRef="Activity_0t1g4mp" targetRef="Event_103vvkf" />
+ <bpmn:sequenceFlow id="Flow_1dfyoe6" name="Other servcie" sourceRef="Gateway_1baxf7k" targetRef="Event_103vvkf">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") != "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ModifyServiceIntentInstance">
+ <bpmndi:BPMNEdge id="Flow_1dfyoe6_di" bpmnElement="Flow_1dfyoe6">
+ <di:waypoint x="855" y="270" />
+ <di:waypoint x="1092" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="917" y="252" width="66" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1b2k523_di" bpmnElement="Flow_1b2k523">
+ <di:waypoint x="1020" y="140" />
+ <di:waypoint x="1110" y="140" />
+ <di:waypoint x="1110" y="252" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1grhlet_di" bpmnElement="Flow_1grhlet">
+ <di:waypoint x="440" y="270" />
+ <di:waypoint x="490" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0usuozn_di" bpmnElement="Flow_0usuozn">
+ <di:waypoint x="830" y="245" />
+ <di:waypoint x="830" y="140" />
+ <di:waypoint x="920" y="140" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="816" y="113" width="68" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_15luvlg_di" bpmnElement="Flow_15luvlg">
+ <di:waypoint x="855" y="270" />
+ <di:waypoint x="1092" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="852" y="365" width="36" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ps6iyc_di" bpmnElement="Flow_0ps6iyc">
+ <di:waypoint x="740" y="270" />
+ <di:waypoint x="805" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1q030ul_di" bpmnElement="Flow_1q030ul">
+ <di:waypoint x="590" y="270" />
+ <di:waypoint x="640" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0fzchbl_di" bpmnElement="Flow_0fzchbl">
+ <di:waypoint x="310" y="270" />
+ <di:waypoint x="340" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1t0w8dn_di" bpmnElement="Flow_1t0w8dn">
+ <di:waypoint x="188" y="270" />
+ <di:waypoint x="210" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_05idy03_di" bpmnElement="Event_05idy03">
+ <dc:Bounds x="152" y="252" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="295" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0kd9pxx_di" bpmnElement="Activity_0kd9pxx">
+ <dc:Bounds x="210" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1dzkfh2_di" bpmnElement="Activity_1dzkfh2">
+ <dc:Bounds x="640" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1baxf7k_di" bpmnElement="Gateway_1baxf7k" isMarkerVisible="true">
+ <dc:Bounds x="805" y="245" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="799" y="306" width="62" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_103vvkf_di" bpmnElement="Event_103vvkf">
+ <dc:Bounds x="1092" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0ptby3d_di" bpmnElement="Activity_0ptby3d">
+ <dc:Bounds x="490" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1s8ojcr_di" bpmnElement="Activity_1s8ojcr">
+ <dc:Bounds x="340" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0t1g4mp_di" bpmnElement="Activity_0t1g4mp">
+ <dc:Bounds x="920" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn
new file mode 100644
index 0000000000..96ebce2297
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoCloudLeasedLineCreate" name="DoCloudLeasedLineCreate" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Cloud Leased Line Creation Work Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new DoCloudLeasedLineCreate()
+css.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>Flow_06rrcwf</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1xxag1o" name="Prepare Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineCreate()
+runScript.prepareUpdateJobStatus(execution,"INPROGRESS","10","Create Cloud Leased Line started")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineCreate()
+runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Created CLL successfully")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1oouvuh" name="End" />
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" />
+ <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="Activity_14an583" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_1xko5pk" />
+ <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1865m9a</bpmn:incoming>
+ <bpmn:incoming>Flow_15mdc4q</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "created")
+def runScript = new DoCloudLeasedLineCreate()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:serviceTask id="Activity_14an583" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming>
+ <bpmn:outgoing>Flow_1k88aak</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1k88aak" sourceRef="Activity_14an583" targetRef="Activity_1tiyq9t" />
+ <bpmn:serviceTask id="Activity_1xko5pk" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>Flow_06rrcwf</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_06rrcwf" sourceRef="Activity_1xko5pk" targetRef="EndEvent_05h01gx" />
+ <bpmn:scriptTask id="Activity_1tiyq9t" name="create Service Instance in AAI" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1k88aak</bpmn:incoming>
+ <bpmn:outgoing>Flow_0xqfi6l</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.createServiceInstance(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_09pfclp" name="Create Allottedsource in AAI" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0xqfi6l</bpmn:incoming>
+ <bpmn:outgoing>Flow_1wzmy62</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.createAllottedResource(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_1h7dpdn" name="Enable SDNC?">
+ <bpmn:incoming>Flow_1wzmy62</bpmn:incoming>
+ <bpmn:outgoing>Flow_08u0q5g</bpmn:outgoing>
+ <bpmn:outgoing>Flow_15mdc4q</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Activity_01xdxaj" name="PreProcess SDNC Create Cloud Leased Line Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_08u0q5g</bpmn:incoming>
+ <bpmn:outgoing>Flow_1xqkjy9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.preprocessSdncCreateCllRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="Activity_01m0xuh" name="Call SDNC Adapter: Create CLL" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CLL_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="msoRequestId" target="mso-request-id" />
+ <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="sdncAdapterResponse" target="CLL_SDNCAdapterResponse" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1xqkjy9</bpmn:incoming>
+ <bpmn:outgoing>Flow_0vvbiux</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="Activity_01eibkt" name="Postprocess Create CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0vvbiux</bpmn:incoming>
+ <bpmn:outgoing>Flow_1865m9a</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("CLL_SDNCAdapterResponse")
+
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0xqfi6l" sourceRef="Activity_1tiyq9t" targetRef="Activity_09pfclp" />
+ <bpmn:sequenceFlow id="Flow_1wzmy62" sourceRef="Activity_09pfclp" targetRef="Gateway_1h7dpdn" />
+ <bpmn:sequenceFlow id="Flow_1xqkjy9" name="" sourceRef="Activity_01xdxaj" targetRef="Activity_01m0xuh" />
+ <bpmn:sequenceFlow id="Flow_0vvbiux" name="" sourceRef="Activity_01m0xuh" targetRef="Activity_01eibkt" />
+ <bpmn:sequenceFlow id="Flow_08u0q5g" name="YES" sourceRef="Gateway_1h7dpdn" targetRef="Activity_01xdxaj">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1865m9a" sourceRef="Activity_01eibkt" targetRef="ScriptTask_19uxoi8" />
+ <bpmn:sequenceFlow id="Flow_15mdc4q" name="NO" sourceRef="Gateway_1h7dpdn" targetRef="ScriptTask_19uxoi8" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCloudLeasedLineCreate">
+ <bpmndi:BPMNEdge id="Flow_15mdc4q_di" bpmnElement="Flow_15mdc4q">
+ <di:waypoint x="765" y="274" />
+ <di:waypoint x="1110" y="274" />
+ <di:waypoint x="1110" y="480" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="926" y="253" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1865m9a_di" bpmnElement="Flow_1865m9a">
+ <di:waypoint x="960" y="520" />
+ <di:waypoint x="1060" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_08u0q5g_di" bpmnElement="Flow_08u0q5g">
+ <di:waypoint x="740" y="299" />
+ <di:waypoint x="740" y="380" />
+ <di:waypoint x="480" y="380" />
+ <di:waypoint x="480" y="470" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="745" y="332" width="23" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0vvbiux_di" bpmnElement="Flow_0vvbiux">
+ <di:waypoint x="730" y="520" />
+ <di:waypoint x="839" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1xqkjy9_di" bpmnElement="Flow_1xqkjy9">
+ <di:waypoint x="540" y="520" />
+ <di:waypoint x="609" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1wzmy62_di" bpmnElement="Flow_1wzmy62">
+ <di:waypoint x="580" y="274" />
+ <di:waypoint x="715" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0xqfi6l_di" bpmnElement="Flow_0xqfi6l">
+ <di:waypoint x="370" y="274" />
+ <di:waypoint x="480" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_06rrcwf_di" bpmnElement="Flow_06rrcwf">
+ <di:waypoint x="1330" y="690" />
+ <di:waypoint x="1430" y="690" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1k88aak_di" bpmnElement="Flow_1k88aak">
+ <di:waypoint x="750" y="121" />
+ <di:waypoint x="770" y="121" />
+ <di:waypoint x="770" y="198" />
+ <di:waypoint x="320" y="198" />
+ <di:waypoint x="320" y="230" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+ <di:waypoint x="1110" y="560" />
+ <di:waypoint x="1110" y="650" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="1160" y="690" />
+ <di:waypoint x="1230" y="690" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
+ <di:waypoint x="568" y="121" />
+ <di:waypoint x="650" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="385" y="121" />
+ <di:waypoint x="468" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="214" y="121" />
+ <di:waypoint x="285" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="178" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="171" y="146" width="71" height="53" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="285" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="685" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1079" y="1184" />
+ <di:waypoint x="1353" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="751" y="1184" />
+ <di:waypoint x="979" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="715" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1353" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="979" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1430" y="672" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1438" y="715" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
+ <dc:Bounds x="468" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="1060" y="650" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
+ <dc:Bounds x="1562" y="482" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1570" y="525" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+ <dc:Bounds x="1060" y="480" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_14an583_di" bpmnElement="Activity_14an583">
+ <dc:Bounds x="650" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1xko5pk_di" bpmnElement="Activity_1xko5pk">
+ <dc:Bounds x="1230" y="650" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1tiyq9t_di" bpmnElement="Activity_1tiyq9t">
+ <dc:Bounds x="270" y="234" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_09pfclp_di" bpmnElement="Activity_09pfclp">
+ <dc:Bounds x="480" y="234" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1h7dpdn_di" bpmnElement="Gateway_1h7dpdn" isMarkerVisible="true">
+ <dc:Bounds x="715" y="249" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="702" y="233" width="75" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_01xdxaj_di" bpmnElement="Activity_01xdxaj">
+ <dc:Bounds x="419" y="473" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_01m0xuh_di" bpmnElement="Activity_01m0xuh">
+ <dc:Bounds x="609" y="473" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_01eibkt_di" bpmnElement="Activity_01eibkt">
+ <dc:Bounds x="839" y="473" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn
new file mode 100644
index 0000000000..4f84317945
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoCloudLeasedLineDelete" name="DoCloudLeasedLineDelete" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Cloud Leased Line Deletion Work Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Deleted CLL successfully")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" />
+ <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Delete CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0sj0mtu</bpmn:incoming>
+ <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.preprocessSdncDeleteCllRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0cpctye" sourceRef="Activity_1tw8eyy" targetRef="Activity_0p20esb" />
+ <bpmn:callActivity id="Activity_0p20esb" name="Call SDNC Adapter: Delete CLL" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CLL_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="msoRequestId" target="mso-request-id" />
+ <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="sdncAdapterResponse" target="CLL_SDNCAdapterResponse" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0cpctye</bpmn:incoming>
+ <bpmn:outgoing>Flow_0fuabjs</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_0fuabjs" sourceRef="Activity_0p20esb" targetRef="Activity_0phv8e5" />
+ <bpmn:scriptTask id="Activity_0phv8e5" name="Postprocess SDNC Delete CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0fuabjs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("CLL_SDNCAdapterResponse")
+
+def runScript = new DoCloudLeasedLineDelete()
+runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_013rjwc" name="Delete Service Instance (CLL) in AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+ <bpmn:incoming>Flow_0dirb5b</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jygjln</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.deleteServiceInstance(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_013rjwc" />
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_1spi9lo" />
+ <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:serviceTask id="Activity_0rgeefb" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ca4l8d</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0ca4l8d" sourceRef="Activity_0rgeefb" targetRef="EndEvent_05h01gx" />
+ <bpmn:exclusiveGateway id="Gateway_1spi9lo" name="Enable SDNC?">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>Flow_0sj0mtu</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0dirb5b</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_0sj0mtu" name="Yes" sourceRef="Gateway_1spi9lo" targetRef="Activity_1tw8eyy">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0dirb5b" name="No" sourceRef="Gateway_1spi9lo" targetRef="Activity_013rjwc" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCloudLeasedLineDelete">
+ <bpmndi:BPMNEdge id="Flow_0dirb5b_di" bpmnElement="Flow_0dirb5b">
+ <di:waypoint x="480" y="146" />
+ <di:waypoint x="480" y="370" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="483" y="166" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu">
+ <di:waypoint x="505" y="121" />
+ <di:waypoint x="569" y="121" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="103" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d">
+ <di:waypoint x="1030" y="410" />
+ <di:waypoint x="1152" y="410" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln">
+ <di:waypoint x="530" y="410" />
+ <di:waypoint x="660" y="410" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="385" y="121" />
+ <di:waypoint x="455" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+ <di:waypoint x="1130" y="121" />
+ <di:waypoint x="1220" y="121" />
+ <di:waypoint x="1220" y="260" />
+ <di:waypoint x="480" y="260" />
+ <di:waypoint x="480" y="370" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
+ <di:waypoint x="910" y="121" />
+ <di:waypoint x="1009" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
+ <di:waypoint x="690" y="121" />
+ <di:waypoint x="789" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="760" y="410" />
+ <di:waypoint x="930" y="410" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="214" y="121" />
+ <di:waypoint x="285" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="178" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="169" y="146" width="70" height="53" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="685" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1079" y="1184" />
+ <di:waypoint x="1353" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="751" y="1184" />
+ <di:waypoint x="979" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="715" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1353" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="979" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1152" y="392" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1160" y="435" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="660" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+ <dc:Bounds x="569" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
+ <dc:Bounds x="789" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+ <dc:Bounds x="1009" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc">
+ <dc:Bounds x="430" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="285" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb">
+ <dc:Bounds x="930" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true">
+ <dc:Bounds x="455" y="96" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="443" y="73" width="75" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn
new file mode 100644
index 0000000000..1c2ce98f09
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoCloudLeasedLineModify" name="DoCloudLeasedLineModify" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Modify Cloud Leased LIne Work Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>Flow_1akxvak</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineModify()
+runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Modified CLL successfully")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0ziz3ti" />
+ <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0h5rwlh</bpmn:incoming>
+ <bpmn:incoming>Flow_0b3rxne</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "modified")
+def runScript = new DoCloudLeasedLineModify()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:scriptTask id="Activity_0phv8e5" name="Modify CLL instance in AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def runScript = new DoCloudLeasedLineModify()
+runScript.updateServiceInstanceInAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Gateway_1o68a9z" />
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineModify()
+runScript.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_0phv8e5" />
+ <bpmn:scriptTask id="Activity_0h1vr2l" name="PreProcess SDNC Modify CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0cm9i4m</bpmn:incoming>
+ <bpmn:outgoing>Flow_1dvo5ih</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineModify()
+runScript.preprocessSdncModifyCllRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1dvo5ih" sourceRef="Activity_0h1vr2l" targetRef="Activity_14ab476" />
+ <bpmn:callActivity id="Activity_14ab476" name="Call SDNC Adapter: Modify CLL" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CLL_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="msoRequestId" target="mso-request-id" />
+ <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="sdncAdapterResponse" target="CLL_SDNCAdapterResponse" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1dvo5ih</bpmn:incoming>
+ <bpmn:outgoing>Flow_139j3yd</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_139j3yd" sourceRef="Activity_14ab476" targetRef="Activity_1vtz33q" />
+ <bpmn:scriptTask id="Activity_1vtz33q" name="Postprocess SDNC Modify CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_139j3yd</bpmn:incoming>
+ <bpmn:outgoing>Flow_0h5rwlh</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("CLL_SDNCAdapterResponse")
+
+def runScript = new DoCloudLeasedLineModify()
+runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0h5rwlh" sourceRef="Activity_1vtz33q" targetRef="ScriptTask_19uxoi8" />
+ <bpmn:serviceTask id="Activity_0ziz3ti" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>Flow_1akxvak</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1akxvak" sourceRef="Activity_0ziz3ti" targetRef="EndEvent_05h01gx" />
+ <bpmn:exclusiveGateway id="Gateway_1o68a9z" name="Enable SDNC?">
+ <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+ <bpmn:outgoing>Flow_0cm9i4m</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0b3rxne</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_0cm9i4m" name="Yes" sourceRef="Gateway_1o68a9z" targetRef="Activity_0h1vr2l">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0b3rxne" name="No" sourceRef="Gateway_1o68a9z" targetRef="ScriptTask_19uxoi8" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCloudLeasedLineModify">
+ <bpmndi:BPMNEdge id="Flow_0b3rxne_di" bpmnElement="Flow_0b3rxne">
+ <di:waypoint x="690" y="146" />
+ <di:waypoint x="690" y="360" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="698" y="203" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0cm9i4m_di" bpmnElement="Flow_0cm9i4m">
+ <di:waypoint x="715" y="121" />
+ <di:waypoint x="789" y="121" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="743" y="103" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1akxvak_di" bpmnElement="Flow_1akxvak">
+ <di:waypoint x="1230" y="400" />
+ <di:waypoint x="1372" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0h5rwlh_di" bpmnElement="Flow_0h5rwlh">
+ <di:waypoint x="1350" y="121" />
+ <di:waypoint x="1430" y="121" />
+ <di:waypoint x="1430" y="280" />
+ <di:waypoint x="690" y="280" />
+ <di:waypoint x="690" y="360" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_139j3yd_di" bpmnElement="Flow_139j3yd">
+ <di:waypoint x="1110" y="121" />
+ <di:waypoint x="1229" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1dvo5ih_di" bpmnElement="Flow_1dvo5ih">
+ <di:waypoint x="910" y="121" />
+ <di:waypoint x="989" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="390" y="121" />
+ <di:waypoint x="479" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+ <di:waypoint x="600" y="121" />
+ <di:waypoint x="665" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+ <di:waypoint x="740" y="400" />
+ <di:waypoint x="860" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="960" y="400" />
+ <di:waypoint x="1130" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="208" y="121" />
+ <di:waypoint x="290" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="172" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="163" y="146" width="77" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="735" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1129" y="1184" />
+ <di:waypoint x="1403" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="801" y="1184" />
+ <di:waypoint x="1029" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="765" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1403" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="1029" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1372" y="382" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1380" y="425" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="860" y="360" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+ <dc:Bounds x="640" y="360" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+ <dc:Bounds x="479" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="290" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0h1vr2l_di" bpmnElement="Activity_0h1vr2l">
+ <dc:Bounds x="789" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_14ab476_di" bpmnElement="Activity_14ab476">
+ <dc:Bounds x="989" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1vtz33q_di" bpmnElement="Activity_1vtz33q">
+ <dc:Bounds x="1229" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0ziz3ti_di" bpmnElement="Activity_0ziz3ti">
+ <dc:Bounds x="1130" y="360" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1o68a9z_di" bpmnElement="Gateway_1o68a9z" isMarkerVisible="true">
+ <dc:Bounds x="665" y="96" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="653" y="73" width="75" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
index 35c5fe1c14..7aaf558901 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
@@ -26,7 +26,7 @@ import javax.annotation.PostConstruct;
import org.junit.Rule;
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.slf4j.Logger;
@@ -35,7 +35,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
-public class GrpcNettyServer extends BlueprintProcessingServiceImplBase {
+public class GrpcNettyServer extends BluePrintProcessingServiceImplBase {
private static final Logger logger = LoggerFactory.getLogger(GrpcNettyServer.class);
@@ -55,7 +55,7 @@ public class GrpcNettyServer extends BlueprintProcessingServiceImplBase {
@PostConstruct
public void start() throws IOException {
- final BlueprintProcessingServiceImplBase blueprintPrcessorImpl = new BlueprintProcessingServiceImplBase() {
+ final BluePrintProcessingServiceImplBase blueprintPrcessorImpl = new BluePrintProcessingServiceImplBase() {
@Override
public StreamObserver<ExecutionServiceInput> process(
StreamObserver<ExecutionServiceOutput> responseObserver) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
index f3b767a8f1..1da9ad584a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
@@ -157,6 +157,16 @@ public abstract class AbstractControllerExecution<T> {
}
/**
+ * Check whether the controller scope is SERVICE
+ *
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule, service
+ * @return true if the controller scope is service, else return false
+ */
+ protected boolean isServiceResourceScope(final String controllerScope) {
+ return "service".equalsIgnoreCase(controllerScope);
+ }
+
+ /**
* Check whether the controller scope is VNF resource related.
*
* @param controllerScope controller scope, e.g, pnf, vnf, vfModule
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
index 39a695b0b6..92be824691 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
@@ -109,6 +109,8 @@ public class ControllerExecutionBB extends AbstractControllerExecution<BuildingB
PnfResourceCustomization pnfResourceCustomization =
catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
controllerActor = pnfResourceCustomization.getControllerActor();
+ } else if (isServiceResourceScope(controllerScope)) {
+ return controllerActor;
} else if (isVnfResourceScope(controllerScope)) {
VnfResourceCustomization vnfResourceCustomization =
catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
index c56ab3e71d..f2f3b5da08 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
@@ -26,7 +26,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -87,6 +89,11 @@ public class ControllerExecution {
execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId());
execution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
execution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
+ } else if ("service".equalsIgnoreCase(scope)) {
+ GeneralBuildingBlock gbb = execution.getGeneralBuildingBlock();
+ ModelInfoServiceInstance modelInfoServiceInstance =
+ gbb.getServiceInstance().getModelInfoServiceInstance();
+ controllerActor = Optional.ofNullable(modelInfoServiceInstance.getControllerActor()).orElse("CDS");
} else {
GenericVnf genericVnf = getGenericVnf(execution);
String modelUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
index 1fae5ce06c..5442f444ee 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
@@ -46,6 +46,7 @@ public class GenericCDSProcessingBB implements ControllerRunnable<BuildingBlockE
public static final String CDS_ACTOR = "cds";
public static final String VNF_SCOPE = "vnf";
public static final String VF_MODULE_SCOPE = "vfmodule";
+ public static final String SERVICE_SCOPE = "service";
@Autowired
private ExceptionBuilder exceptionBuilder;
@@ -59,8 +60,8 @@ public class GenericCDSProcessingBB implements ControllerRunnable<BuildingBlockE
@Override
public Boolean understand(ControllerContext<BuildingBlockExecution> context) {
String scope = context.getControllerScope();
- return CDS_ACTOR.equalsIgnoreCase(context.getControllerActor())
- && (VNF_SCOPE.equalsIgnoreCase(scope) || VF_MODULE_SCOPE.equalsIgnoreCase(scope));
+ return CDS_ACTOR.equalsIgnoreCase(context.getControllerActor()) && (SERVICE_SCOPE.equalsIgnoreCase(scope)
+ || VNF_SCOPE.equalsIgnoreCase(scope) || VF_MODULE_SCOPE.equalsIgnoreCase(scope));
}
@Override
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 0d2844d08b..2a8852a4bd 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,13 +22,14 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
-public class Resource {
+public class Resource implements Serializable {
+ private static final long serialVersionUID = 4259534487473481127L;
private String resourceId;
private WorkflowType resourceType;
private boolean generated;
@@ -37,6 +38,8 @@ public class Resource {
private String vnfCustomizationId;
private String vfModuleCustomizationId;
private String cvnfModuleCustomizationId;
+ private String instanceName;
+ private String modelInvariantId;
private int processingPriority;
private Resource parent;
private List<Resource> children;
@@ -121,6 +124,23 @@ public class Resource {
this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
}
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+
public int getProcessingPriority() {
return processingPriority == 0 ? (isBaseVfModule() ? Integer.MIN_VALUE + 1 : 0) : processingPriority;
}
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 ce775af476..02508b8867 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
@@ -43,14 +43,18 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.aai.domain.yang.Vnfc;
@@ -351,6 +355,7 @@ public class WorkflowAction {
} else {
updateResourceIdsFromAAITraversal(flowsToExecute, resourceList, aaiResourceIds, serviceInstanceId);
}
+ execution.setVariable("resources", resourceList);
return flowsToExecute;
}
@@ -666,11 +671,12 @@ public class WorkflowAction {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
logger.debug("{}, {}", pair.getValue0(), pair.getValue1());
}
-
+ Map<Resource, String> resourceInstanceIds = new HashMap<>();
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
.forEach(type -> resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
- .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
- retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId)));
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource,
+ retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId,
+ resourceInstanceIds)));
}
private String retrieveAAIResourceId(List<Pair<WorkflowType, String>> aaiResourceIds, WorkflowType resource) {
@@ -687,27 +693,45 @@ public class WorkflowAction {
private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList,
String serviceInstanceId) {
+ Map<Resource, String> resourceInstanceIds = new HashMap<>();
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
.forEach(type -> resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
- .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
- null, resource.getVirtualLinkKey(), serviceInstanceId)));
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource, null,
+ resource.getVirtualLinkKey(), serviceInstanceId, resourceInstanceIds)));
}
protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resourceType,
- String key, String id, String virtualLinkKey, String serviceInstanceId) {
+ Resource resource, String id, String virtualLinkKey, String serviceInstanceId,
+ Map<Resource, String> resourceInstanceIds) {
+ String key = resource.getResourceId();
String resourceId = id;
if (resourceId == null) {
resourceId = UUID.randomUUID().toString();
}
+ resourceInstanceIds.put(resource, resourceId);
+ Set<String> assignedFlows = new LinkedHashSet<>();
for (ExecuteBuildingBlock ebb : flowsToExecute) {
- if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && (ebb.getBuildingBlock()
- .getBpmnFlowName().contains(resourceType.toString())
- || (ebb.getBuildingBlock().getBpmnFlowName().contains(CONTROLLER)
- && ebb.getBuildingBlock().getBpmnScope().equalsIgnoreCase(resourceType.toString())))) {
+ String resourceTypeStr = resourceType.toString();
+ String flowName = ebb.getBuildingBlock().getBpmnFlowName();
+ String scope = StringUtils.defaultString(ebb.getBuildingBlock().getBpmnScope());
+ String action = StringUtils.defaultString(ebb.getBuildingBlock().getBpmnAction());
+
+ if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey())
+ && isFlowAssignable(assignedFlows, ebb, resourceType, flowName + action)
+ && (flowName.contains(resourceTypeStr)
+ || (flowName.contains(CONTROLLER) && resourceTypeStr.equalsIgnoreCase(scope)))) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ Resource parent = resource.getParent();
+ if (parent != null && resourceInstanceIds.containsKey(parent)) {
+ WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, parent.getResourceType(),
+ resourceInstanceIds.get(parent));
+ }
+ WorkflowResourceIdsUtils.setInstanceNameByWorkflowType(workflowResourceIds, resourceType,
+ resource.getInstanceName());
WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, resourceType, resourceId);
ebb.setWorkflowResourceIds(workflowResourceIds);
+ assignedFlows.add(flowName + action);
}
if (virtualLinkKey != null && ebb.getBuildingBlock().isVirtualLink()
&& virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
@@ -719,6 +743,12 @@ public class WorkflowAction {
}
}
+ private boolean isFlowAssignable(Set<String> assignedFlows, ExecuteBuildingBlock ebb, WorkflowType resourceType,
+ String assignedFlowName) {
+ String id = WorkflowResourceIdsUtils.getResourceIdByWorkflowType(ebb.getWorkflowResourceIds(), resourceType);
+ return !assignedFlows.contains(assignedFlowName) && id.isEmpty();
+ }
+
protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) {
return WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
}
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 cd151bafea..b76cf1eb5f 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
@@ -111,13 +111,15 @@ public class WorkflowActionBBTasks {
}
int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
- ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
-
- execution.setVariable("buildingBlock", ebb);
- currentSequence++;
- execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size());
- execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence);
-
+ boolean completed = false;
+ if (currentSequence < flowsToExecute.size()) {
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
+ execution.setVariable("buildingBlock", ebb);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence + 1);
+ } else {
+ completed = true;
+ }
+ execution.setVariable(COMPLETED, completed);
} catch (Exception e) {
workflowAction.buildAndThrowException(execution, "Internal Error occured during selectBB", e);
}
@@ -425,6 +427,9 @@ public class WorkflowActionBBTasks {
final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
logger.debug("Current Sequence: {}", currentSequence);
+ if (currentSequence >= flowsToExecute.size()) {
+ execution.setVariable(COMPLETED, true);
+ }
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
index 38ba0077e2..8c6fb2b38b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
@@ -39,6 +39,7 @@ public final class WorkflowActionConstants {
public static final String CREATE_INSTANCE = "createInstance";
public static final String DEACTIVATE_INSTANCE = "deactivateInstance";
public static final String DELETE_INSTANCE = "deleteInstance";
+ public static final String UPGRADE_INSTANCE = "upgradeInstance";
public static final String FABRIC_CONFIGURATION = "FabricConfiguration";
public static final String NETWORKCOLLECTION = "NetworkCollection";
public static final String RECREATE_INSTANCE = "recreateInstance";
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java
index e4c6d2951f..c000e9475c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java
@@ -61,6 +61,7 @@ import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConst
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.DEACTIVATE_INSTANCE;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.DELETE_INSTANCE;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UNASSIGN_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPGRADE_INSTANCE;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
@@ -136,6 +137,7 @@ public class ServiceEBBLoader {
}
} else if ((ACTIVATE_INSTANCE.equalsIgnoreCase(requestAction)
|| UNASSIGN_INSTANCE.equalsIgnoreCase(requestAction) || DELETE_INSTANCE.equalsIgnoreCase(requestAction)
+ || UPGRADE_INSTANCE.equalsIgnoreCase(requestAction)
|| requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
// SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
// SERVICE-MACRO-DELETE
@@ -193,8 +195,9 @@ public class ServiceEBBLoader {
ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
- Resource serviceResource =
+ var serviceResource =
new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
+ serviceResource.setModelInvariantId(serviceInstanceAAI.getModelInvariantId());
resourceList.add(serviceResource);
traverseServiceInstanceMSOVnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
traverseServiceInstanceMSOPnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
index 1f932743ca..c383b4a73a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
@@ -114,6 +114,7 @@ public class UserParamsServiceTraversal {
Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false,
serviceResource);
vnfResource.setProcessingPriority(vnf.getProcessingPriority());
+ vnfResource.setInstanceName(vnf.getInstanceName());
resourceList.add(vnfResource);
setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf);
}
@@ -170,6 +171,7 @@ public class UserParamsServiceTraversal {
resource.setProcessingPriority(vfModule.getProcessingPriority());
resource.setBaseVfModule(vfModuleCustomization.getVfModule().getIsBase() != null
&& vfModuleCustomization.getVfModule().getIsBase());
+ resource.setInstanceName(vfModule.getInstanceName());
resourceList.add(resource);
return resource;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
index 272c6189b4..ff6c113af3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
@@ -29,8 +29,10 @@ import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -76,11 +78,11 @@ public class SkipCDSBuildingBlockListener implements PreFlowManipulator {
BuildingBlockExecution execution) {
String customizationUUID = currentBB.getBuildingBlock().getKey();
- if (Strings.isEmpty(customizationUUID)) {
- return;
- }
-
- if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF")
+ if ("SERVICE".equalsIgnoreCase(currentBB.getBuildingBlock().getBpmnScope())) {
+ String modelUUID = currentBB.getRequestDetails().getModelInfo().getModelUuid();
+ Service service = catalogDbClient.getServiceByID(modelUUID);
+ currentSequenceSkipCheck(execution, service.getSkipPostInstConf());
+ } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF")
&& containsIgnoreCaseAction(currentBB, vnfActions)) {
List<VnfResourceCustomization> vnfResourceCustomizations =
catalogDbClient.getVnfResourceCustomizationByModelUuid(
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
index d16eac147e..9cabf6665c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
@@ -20,6 +20,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks.utils;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
@@ -63,6 +64,42 @@ public final class WorkflowResourceIdsUtils {
}
}
+ public static void setInstanceNameByWorkflowType(WorkflowResourceIds workflowResourceIds, WorkflowType resourceType,
+ String instanceName) {
+ if (resourceType == WorkflowType.VNF) {
+ workflowResourceIds.setVnfInstanceName(instanceName);
+ } else if (resourceType == WorkflowType.VFMODULE) {
+ workflowResourceIds.setVfModuleInstanceName(instanceName);
+ }
+ }
+
+ public static String getResourceIdByWorkflowType(WorkflowResourceIds workflowResourceIds,
+ WorkflowType resourceType) {
+ switch (resourceType) {
+ case SERVICE:
+ return StringUtils.defaultString(workflowResourceIds.getServiceInstanceId());
+ case VNF:
+ return StringUtils.defaultString(workflowResourceIds.getVnfId());
+ case PNF:
+ return StringUtils.defaultString(workflowResourceIds.getPnfId());
+ case VFMODULE:
+ return StringUtils.defaultString(workflowResourceIds.getVfModuleId());
+ case VOLUMEGROUP:
+ return StringUtils.defaultString(workflowResourceIds.getVolumeGroupId());
+ case NETWORK:
+ return StringUtils.defaultString(workflowResourceIds.getNetworkId());
+ case NETWORKCOLLECTION:
+ return StringUtils.defaultString(workflowResourceIds.getNetworkCollectionId());
+ case CONFIGURATION:
+ return StringUtils.defaultString(workflowResourceIds.getConfigurationId());
+ case INSTANCE_GROUP:
+ return StringUtils.defaultString(workflowResourceIds.getInstanceGroupId());
+ default:
+ return "";
+ }
+ }
+
+
public static WorkflowResourceIds getWorkflowResourceIdsFromExecution(DelegateExecution execution) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
@@ -71,6 +108,8 @@ public final class WorkflowResourceIdsUtils {
workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
+ workflowResourceIds.setVnfInstanceName((String) execution.getVariable("vnfInstanceName"));
+ workflowResourceIds.setVfModuleInstanceName((String) execution.getVariable("vfModuleInstanceName"));
return workflowResourceIds;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidator.java
new file mode 100644
index 0000000000..5e82b4f284
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidator.java
@@ -0,0 +1,114 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks.validators;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreWorkflowValidator;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.stereotype.Component;
+
+@Component
+public class UpgradePreWorkflowValidator implements PreWorkflowValidator {
+
+ private static final String ERR_MSG_INVARIANT_MISMATCH =
+ "Request service modelInvariantId: %s does not match AAI service modelInvariantId: %s";
+ private static final String ERR_MSG_EXISTING_VNFS_NOT_SUPPORTED =
+ "Existing vnfs in AAI are not supported by service model. Unsupported vnfCustomizationIds: %s";
+
+ private final CatalogDbClient catalogDbClient;
+
+ private static final Function<WorkflowType, Predicate<Resource>> resourceType =
+ workflowType -> resource -> resource.getResourceType() == workflowType;
+
+ public UpgradePreWorkflowValidator(CatalogDbClient catalogDbClient) {
+ this.catalogDbClient = catalogDbClient;
+ }
+
+ @Override
+ public boolean shouldRunFor(String requestAction) {
+ return "upgradeInstance".equalsIgnoreCase(requestAction);
+ }
+
+ @Override
+ public Optional<String> validate(BuildingBlockExecution execution) {
+ final String bpmnRequest = execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ List<Resource> resources = execution.getVariable("resources");
+
+ Optional<ServiceInstancesRequest> sir = parseBpmnRequest(bpmnRequest);
+ if (sir.isEmpty()) {
+ return Optional.of("Failed to parse bpmnRequest");
+ }
+ var requestDetails = sir.get().getRequestDetails();
+ String requestModelInvariantId = requestDetails.getModelInfo().getModelInvariantId();
+
+ Optional<String> modelInvariantMismatch = validateInvariantId(resources, requestModelInvariantId);
+ if (modelInvariantMismatch.isPresent()) {
+ return modelInvariantMismatch;
+ }
+
+ List<Resource> aaiVnfResources = getVnfResources(resources);
+ if (aaiVnfResources.isEmpty()) {
+ return Optional.empty();
+ }
+
+ String serviceModelUuid = requestDetails.getModelInfo().getModelUuid();
+ Optional<List<VnfResourceCustomization>> vnfResourceCustomizations =
+ getVnfResourceCustomizations(serviceModelUuid);
+ if (vnfResourceCustomizations.isEmpty()) {
+ return Optional.of(String.format("Service model: %s does not exist in catalog db.", serviceModelUuid));
+ }
+
+ return validateExistingVnfsSupported(aaiVnfResources, vnfResourceCustomizations.get());
+ }
+
+ private Optional<ServiceInstancesRequest> parseBpmnRequest(String bpmnRequest) {
+ try {
+ return Optional.of(new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class));
+ } catch (IOException e) {
+ return Optional.empty();
+ }
+ }
+
+ private Optional<String> validateInvariantId(List<Resource> resources, String requestModelInvariantId) {
+ return resources.stream().filter(resourceType.apply(WorkflowType.SERVICE)).findFirst()
+ .filter(r -> !r.getModelInvariantId().equals(requestModelInvariantId))
+ .map(r -> String.format(ERR_MSG_INVARIANT_MISMATCH, requestModelInvariantId, r.getModelInvariantId()));
+ }
+
+ private Optional<List<VnfResourceCustomization>> getVnfResourceCustomizations(String serviceModelUuid) {
+ return Optional.ofNullable(catalogDbClient.getServiceByModelUUID(serviceModelUuid))
+ .map(Service::getVnfCustomizations);
+ }
+
+ private List<Resource> getVnfResources(List<Resource> resources) {
+ return resources.stream().filter(resourceType.apply(WorkflowType.VNF)).collect(Collectors.toList());
+ }
+
+ private Optional<String> validateExistingVnfsSupported(List<Resource> vnfResources,
+ List<VnfResourceCustomization> vnfResourceCustomizations) {
+ Set<String> modeledVnfCustomizationIds = vnfResourceCustomizations.stream()
+ .map(VnfResourceCustomization::getModelCustomizationUUID).collect(Collectors.toSet());
+
+ String unsupportedVnfCustomizationIds = vnfResources.stream().map(Resource::getVnfCustomizationId)
+ .filter(id -> !modeledVnfCustomizationIds.contains(id)).collect(Collectors.joining(","));
+
+ if (unsupportedVnfCustomizationIds.isEmpty()) {
+ return Optional.empty();
+ }
+ return Optional.of(String.format(ERR_MSG_EXISTING_VNFS_NOT_SUPPORTED, unsupportedVnfCustomizationIds));
+ }
+
+}
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 cc99f178bd..8c1e8f6d62 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
@@ -181,9 +181,27 @@ public class AAIServiceInstanceResources {
.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
+ mapEmptyStringsToNull(aaiServiceInstance);
injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance);
}
+ /*
+ * Per serialization configurations in GraphInventoryCommonObjectMapperPatchProvider, empty strings are mapped to
+ * null and included in the payload. Null values are on the other hand excluded. Passing null values in a PATCH
+ * request to AAI will fail. We need to map empty strings to null before serialization in order to exclude these
+ * values from the payload.
+ */
+ private void mapEmptyStringsToNull(org.onap.aai.domain.yang.ServiceInstance serviceInstance) {
+ if (serviceInstance != null) {
+ if ("".equals(serviceInstance.getServiceType()))
+ serviceInstance.setServiceType(null);
+ if ("".equals(serviceInstance.getServiceRole()))
+ serviceInstance.setServiceRole(null);
+ if ("".equals(serviceInstance.getServiceFunction()))
+ serviceInstance.setServiceFunction(null);
+ }
+ }
+
public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/GrpcNettyServer.java
index a6e29227a0..a0a47a1d16 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/GrpcNettyServer.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/GrpcNettyServer.java
@@ -31,7 +31,7 @@ import javax.annotation.PostConstruct;
import org.junit.Rule;
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.slf4j.Logger;
@@ -40,7 +40,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
-public class GrpcNettyServer extends BlueprintProcessingServiceImplBase {
+public class GrpcNettyServer extends BluePrintProcessingServiceImplBase {
private static final Logger logger = LoggerFactory.getLogger(GrpcNettyServer.class);
@@ -60,7 +60,7 @@ public class GrpcNettyServer extends BlueprintProcessingServiceImplBase {
@PostConstruct
public void start() throws IOException {
- final BlueprintProcessingServiceImplBase blueprintPrcessorImpl = new BlueprintProcessingServiceImplBase() {
+ final BluePrintProcessingServiceImplBase blueprintPrcessorImpl = new BluePrintProcessingServiceImplBase() {
@Override
public StreamObserver<ExecutionServiceInput> process(
StreamObserver<ExecutionServiceOutput> responseObserver) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
index fb15ffa2b3..f22932b988 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
@@ -25,7 +25,9 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -37,6 +39,8 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.Workflow;
+import org.onap.so.db.catalog.client.CatalogDbClient;
@RunWith(MockitoJUnitRunner.class)
public class ServiceLevelTest {
@@ -44,11 +48,15 @@ public class ServiceLevelTest {
private static final String EXECUTION_KEY_PNF_NAME_LIST = "pnfNameList";
private static final String EXECUTION_KEY_PNF_COUNTER = "pnfCounter";
private static final String PARAM_NAME = "param1";
- private static final String SCOPE = "scope1";
private static final String PNF_NAME = "pnfName1";
+ private static final String OPERATION_NAME = ServiceLevelConstants.HEALTH_CHECK_OPERATION;
+ private static final String SCOPE = ServiceLevelConstants.PNF;
+ private static final String WORKFLOW_NAME = "workflowTestName";
@Mock
private ExceptionBuilder exceptionBuilderMock;
+ @Mock
+ private CatalogDbClient catalogDbClientMock;
@InjectMocks
private ServiceLevel testedObject;
@@ -60,6 +68,31 @@ public class ServiceLevelTest {
}
@Test
+ public void fetchWorkflowUsingScope_catalogDBReturnsEmpty() {
+ // given
+ when(catalogDbClientMock.findWorkflowByOperationName(OPERATION_NAME)).thenReturn(Collections.emptyList());
+ // when
+ String workflowResult = testedObject.fetchWorkflowUsingScope(SCOPE, OPERATION_NAME);
+ // then
+ assertThat(workflowResult).isEqualTo("GenericPnfHealthCheck");
+ }
+
+ @Test
+ public void fetchWorkflowUsingScope_catalogDBReturnsNotEmpty() {
+ // given
+ Workflow workflow = new Workflow();
+ workflow.setResourceTarget(SCOPE);
+ workflow.setName(WORKFLOW_NAME);
+ List<Workflow> workflowList = new ArrayList<>();
+ workflowList.add(workflow);
+ when(catalogDbClientMock.findWorkflowByOperationName(OPERATION_NAME)).thenReturn(workflowList);
+ // when
+ String workflowResult = testedObject.fetchWorkflowUsingScope(SCOPE, OPERATION_NAME);
+ // then
+ assertThat(workflowResult).isEqualTo(WORKFLOW_NAME);
+ }
+
+ @Test
public void pnfCounterExecution_success() {
// given
execution.setVariable(EXECUTION_KEY_PNF_NAME_LIST, createPnfNameList());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index 5cd3055b5f..cbb746d514 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -149,7 +149,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.selectBB(execution);
boolean success = (boolean) execution.getVariable("completed");
int currentSequence = (int) execution.getVariable("gCurrentSequence");
- assertTrue(success);
+ assertFalse(success);
assertEquals(1, currentSequence);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index e52d2dfecf..021bac3a7a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -51,8 +51,11 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -118,6 +121,8 @@ public class WorkflowActionTest extends BaseTaskTest {
private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
private static final String MACRO_CREATE_JSON = "Macro/ServiceMacroAssignVnfAndPnf.json";
+ private static final String MACRO_CREATE_SERVICE_MULTIPLE_SAME_MODEL_VNF_VFMODULE =
+ "Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json";
@Mock
protected Environment environment;
@@ -752,6 +757,139 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListServiceMacroCreateWithMultipleSameModelVnfAndVfModules() throws Exception {
+ String gAction = "createInstance";
+ String resource = "Service";
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_SERVICE_MULTIPLE_SAME_MODEL_VNF_VFMODULE);
+ initExecution(gAction, bpmnRequest, false);
+ execution.setVariable("requestUri", "v7/serviceInstances");
+ execution.setVariable("serviceInstanceId", UUID.randomUUID().toString());
+
+ // Service-Macro-Create
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "ControllerExecutionBB",
+ "AssignPnfBB", "WaitForPnfReadyBB", "ControllerExecutionBB", "ControllerExecutionBB", "ActivatePnfBB",
+ "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "ControllerExecutionBB", "ActivateVnfBB",
+ "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
+ orchFlows.get(6).setBpmnAction("config-assign");
+ orchFlows.get(6).setBpmnScope("vnf");
+ orchFlows.get(9).setBpmnAction("config-assign");
+ orchFlows.get(9).setBpmnScope("pnf");
+ orchFlows.get(10).setBpmnAction("config-deploy");
+ orchFlows.get(10).setBpmnScope("pnf");
+ orchFlows.get(18).setBpmnAction("config-deploy");
+ orchFlows.get(18).setBpmnScope("vnf");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ service.setModelUUID("f2444885-3c76-4ddc-8668-7741c0631495");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0");
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModuleCustomization.setVfModule(vfModule);
+
+ VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
+ vfModuleCustomization2.setModelCustomizationUUID("83677d89-428a-407b-b4ec-738e68275d84");
+ vfModuleCustomization2.setHeatEnvironment(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule2.setModuleHeatTemplate(new HeatTemplate());
+ vfModuleCustomization2.setVfModule(vfModule2);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "DEFAULT")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0"))
+ .thenReturn(vfModuleCustomization);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("83677d89-428a-407b-b4ec-738e68275d84"))
+ .thenReturn(vfModuleCustomization2);
+ when(catalogDbClient.getServiceByID("f2444885-3c76-4ddc-8668-7741c0631495")).thenReturn(service);
+
+
+ Resource serviceResource =
+ new Resource(WorkflowType.SERVICE, "f2444885-3c76-4ddc-8668-7741c0631495", false, null);
+ Resource vnfResource1 =
+ new Resource(WorkflowType.VNF, "0d0ba1ee-6b7f-47fe-8266-2967993b2c08", false, serviceResource);
+ vnfResource1.setInstanceName("vnf-instanceName-1");
+ Resource vfmResource1 =
+ new Resource(WorkflowType.VFMODULE, "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", false, vnfResource1);
+ vfmResource1.setInstanceName("demo-network-1");
+ Resource vfmResource2 =
+ new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource1);
+ vfmResource2.setInstanceName("demo-1");
+ Resource vnfResource2 =
+ new Resource(WorkflowType.VNF, "0d0ba1ee-6b7f-47fe-8266-2967993b2c08", false, serviceResource);
+ vnfResource2.setInstanceName("vnf-instanceName-2");
+ Resource vfmResource3 =
+ new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource2);
+ vfmResource3.setInstanceName("demo-2");
+ Resource vfmResource4 =
+ new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource2);
+ vfmResource4.setInstanceName("demo-3");
+
+ when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), any()))
+ .thenReturn(Arrays.asList(serviceResource, vnfResource1, vnfResource2, vfmResource1, vfmResource2,
+ vfmResource3, vfmResource4));
+
+ workflowAction.selectExecutionList(execution);
+
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+
+ Map<String, List<ExecuteBuildingBlock>> flowNamesToEbbList =
+ ebbs.stream().collect(Collectors.groupingBy(e -> e.getBuildingBlock().getBpmnFlowName()));
+
+ assertEquals(1, flowNamesToEbbList.get("AssignServiceInstanceBB").size());
+ assertEquals(2, flowNamesToEbbList.get("AssignVnfBB").size());
+ assertEquals(4, flowNamesToEbbList.get("AssignVfModuleBB").size());
+ assertEquals(4, flowNamesToEbbList.get("ControllerExecutionBB").size());
+ assertEquals(4, flowNamesToEbbList.get("CreateVfModuleBB").size());
+ assertEquals(4, flowNamesToEbbList.get("ActivateVfModuleBB").size());
+ assertEquals(2, flowNamesToEbbList.get("ActivateVnfBB").size());
+ assertEquals(1, flowNamesToEbbList.get("ActivateServiceInstanceBB").size());
+
+ String vnfInstanceId1 = flowNamesToEbbList.get("AssignVnfBB").get(0).getWorkflowResourceIds().getVnfId();
+ String vnfInstanceId2 = flowNamesToEbbList.get("AssignVnfBB").get(1).getWorkflowResourceIds().getVnfId();
+
+ // should be 3 = 1 AssignVfModuleBB + 1 CreateVfModuleBB + 1 ActivateVfModuleBB
+ boolean allEbbsForVfModule1HaveCorrectParentVnfId =
+ 3 == ebbs.stream().map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-network-1".equals(w.getVfModuleInstanceName())
+ && vnfInstanceId1.equals(w.getVnfId()))
+ .count();
+ boolean allEbbsForVfModule2HaveCorrectParentVnfId = 3 == ebbs.stream()
+ .map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-1".equals(w.getVfModuleInstanceName()) && vnfInstanceId1.equals(w.getVnfId()))
+ .count();
+ boolean allEbbsForVfModule3HaveCorrectParentVnfId = 3 == ebbs.stream()
+ .map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-2".equals(w.getVfModuleInstanceName()) && vnfInstanceId2.equals(w.getVnfId()))
+ .count();
+ boolean allEbbsForVfModule4HaveCorrectParentVnfId = 3 == ebbs.stream()
+ .map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-3".equals(w.getVfModuleInstanceName()) && vnfInstanceId2.equals(w.getVnfId()))
+ .count();
+ assertTrue(allEbbsForVfModule1HaveCorrectParentVnfId);
+ assertTrue(allEbbsForVfModule2HaveCorrectParentVnfId);
+ assertTrue(allEbbsForVfModule3HaveCorrectParentVnfId);
+ assertTrue(allEbbsForVfModule4HaveCorrectParentVnfId);
+
+ boolean controllerExecutionBBsforVnf1HaveCorrectVnfId = flowNamesToEbbList.get("ControllerExecutionBB").stream()
+ .filter(e -> vnfInstanceId1.equals(e.getWorkflowResourceIds().getVnfId()))
+ .map(ExecuteBuildingBlock::getBuildingBlock).map(BuildingBlock::getBpmnAction)
+ .collect(Collectors.toSet()).containsAll(Set.of("config-assign", "config-deploy"));
+ assertTrue(controllerExecutionBBsforVnf1HaveCorrectVnfId);
+
+ boolean controllerExecutionBBsforVnf2HaveCorrectVnfId = flowNamesToEbbList.get("ControllerExecutionBB").stream()
+ .filter(e -> vnfInstanceId2.equals(e.getWorkflowResourceIds().getVnfId()))
+ .map(ExecuteBuildingBlock::getBuildingBlock).map(BuildingBlock::getBpmnAction)
+ .collect(Collectors.toSet()).containsAll(Set.of("config-assign", "config-deploy"));
+ assertTrue(controllerExecutionBBsforVnf2HaveCorrectVnfId);
+ }
+
+ @Test
public void selectExecutionListServiceMacroDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index 58fee86ade..cac7f872b3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -53,6 +53,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
@@ -63,6 +64,8 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
private static final String MACRO_ASSIGN_PNF_JSON = "Macro/ServiceMacroAssignPnf.json";
private static final String NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
private static final String MACRO_CREATE_WITHOUT_RESOURCES_JSON = "Macro/ServiceMacroCreateWithoutResources.json";
+ private static final String MACRO_CREATE_SVC_SAME_MODEL_VNF_VFMODULE =
+ "Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json";
private static final String serviceInstanceId = "123";
private DelegateExecution execution;
private CatalogDbClient mockCatalogDbClient;
@@ -80,8 +83,6 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
@Test
public void getResourceListFromUserParams() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_CREATE_WITHOUT_RESOURCES_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
- .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -96,9 +97,62 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
}
@Test
+ public void getResourceListFromUserParamsMultipleSameModelVnfVfModule() throws Exception {
+ initExecution("createInstance", readBpmnRequestFromFile(MACRO_CREATE_SVC_SAME_MODEL_VNF_VFMODULE), false);
+ Mockito.doReturn(getVfModuleCustomization("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", false))
+ .when(mockCatalogDbClient)
+ .getVfModuleCustomizationByModelCuztomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0");
+ Mockito.doReturn(getVfModuleCustomization("83677d89-428a-407b-b4ec-738e68275d84", false))
+ .when(mockCatalogDbClient)
+ .getVfModuleCustomizationByModelCuztomizationUUID("83677d89-428a-407b-b4ec-738e68275d84");
+
+ List<Resource> resources = userParamsServiceTraversal.getResourceListFromUserParams(execution, getUserParams(),
+ serviceInstanceId, requestAction);
+
+ assertEquals(7, resources.size());
+
+ Resource service = resources.get(0);
+ assertTrue(service.getResourceType() == WorkflowType.SERVICE);
+ assertEquals(2, service.getChildren().size());
+
+ Resource vnf1 = service.getChildren().get(0);
+ assertEquals(service, vnf1.getParent());
+ assertEquals("vnf-instanceName-1", vnf1.getInstanceName());
+ assertEquals("0d0ba1ee-6b7f-47fe-8266-2967993b2c08", vnf1.getResourceId());
+ assertEquals(2, vnf1.getChildren().size());
+
+ Resource vnf2 = service.getChildren().get(1);
+ assertEquals(service, vnf2.getParent());
+ assertEquals("vnf-instanceName-2", vnf2.getInstanceName());
+ assertEquals("0d0ba1ee-6b7f-47fe-8266-2967993b2c08", vnf2.getResourceId());
+ assertEquals(2, vnf2.getChildren().size());
+
+ Resource vfmodule1 = vnf1.getChildren().get(0);
+ assertEquals(vnf1, vfmodule1.getParent());
+ assertEquals("demo-network-1", vfmodule1.getInstanceName());
+ assertEquals("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", vfmodule1.getResourceId());
+
+ Resource vfmodule2 = vnf1.getChildren().get(1);
+ assertEquals(vnf1, vfmodule2.getParent());
+ assertEquals("demo-1", vfmodule2.getInstanceName());
+ assertEquals("83677d89-428a-407b-b4ec-738e68275d84", vfmodule2.getResourceId());
+
+ Resource vfmodule3 = vnf2.getChildren().get(0);
+ assertEquals(vnf2, vfmodule3.getParent());
+ assertEquals("demo-2", vfmodule3.getInstanceName());
+ assertEquals("83677d89-428a-407b-b4ec-738e68275d84", vfmodule3.getResourceId());
+
+ Resource vfmodule4 = vnf2.getChildren().get(1);
+ assertEquals(vnf2, vfmodule4.getParent());
+ assertEquals("demo-3", vfmodule4.getInstanceName());
+ assertEquals("83677d89-428a-407b-b4ec-738e68275d84", vfmodule4.getResourceId());
+ }
+
+ @Test
public void getResourceListFromUserParamsForVnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
+ Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true))
+ .when(mockCatalogDbClient)
.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -117,7 +171,8 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
@Test
public void getResourceListFromUserParamsForVnfsWithPriorities() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_CREATE_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
+ Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true))
+ .when(mockCatalogDbClient)
.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -137,8 +192,6 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
@Test
public void getResourceListFromUserParamsForPnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_PNF_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
- .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -156,8 +209,6 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
public void getResourceListFromUserParamsForNetworks() throws Exception {
requestAction = "createInstance";
initExecution(requestAction, readBpmnRequestFromFile(NETWORK_COLLECTION_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
- .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
Mockito.doReturn(getService()).when(mockCatalogDbClient).getServiceByID(anyString());
@@ -230,13 +281,17 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
return service;
}
- private VfModuleCustomization getVfModuleCustomization() {
+ private VfModuleCustomization getVfModuleCustomization(String modelCustomizationUUID, boolean includeVolumeGroup) {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
- vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
+ vfModuleCustomization.setModelCustomizationUUID(modelCustomizationUUID);
VfModule vfModule = new VfModule();
- vfModule.setVolumeHeatTemplate(new HeatTemplate());
- vfModule.setModelName("helm");
+ if (includeVolumeGroup) {
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModule.setModelName("helm");
+ } else {
+ vfModuleCustomization.setHeatEnvironment(new HeatEnvironment());
+ }
vfModule.setModuleHeatTemplate(new HeatTemplate());
vfModuleCustomization.setVfModule(vfModule);
return vfModuleCustomization;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
index fdf4d36c89..b23147e351 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
@@ -37,6 +37,7 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -46,6 +47,7 @@ import org.onap.so.serviceinstancebeans.RequestDetails;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SkipCDSBuildingBlockListenerTest {
+ private static final String SERVICE_SCOPE = "service";
private static final String VNF_SCOPE = "VNF";
private static final String VF_SCOPE = "VFModule";
private static final String PNF_SCOPE = "pnf";
@@ -90,6 +92,18 @@ public class SkipCDSBuildingBlockListenerTest {
}
@Test
+ public void testSkipCDSforService() {
+ setBuildingBlockAndCurrentSequence(SERVICE_SCOPE, "service-config-assign", 0);
+ Service service = new Service();
+ when(catalogDbClient.getServiceByID(TEST_MODELUUID)).thenReturn(service);
+
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(1, actual);
+ }
+
+ @Test
public void testProcessForVNFToSkipCDSBB() {
// given
setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
index 0d68cf362b..996c0c07e1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
@@ -40,7 +40,8 @@ public class WorkflowResourceIdsUtilsTest {
private static final String PNF_ID = "pnfId";
private static final String NETWORK_COLLECTION_ID = "networkCollectionId";
private static final String CONFIGURATION_ID = "configurationId";
-
+ private static final String VNF_INSTANCE_NAME = "vnfInstanceNameId";
+ private static final String VF_MODULE_INSTANCE_NAME = "vfModuleInstanceNameId";
private WorkflowResourceIds workflowResourceIds;
@Before
@@ -57,6 +58,8 @@ public class WorkflowResourceIdsUtilsTest {
execution.setVariable("vnfId", VNF_ID);
execution.setVariable("volumeGroupId", VOLUME_GROUP_ID);
execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID);
+ execution.setVariable("vnfInstanceName", VNF_INSTANCE_NAME);
+ execution.setVariable("vfModuleInstanceName", VF_MODULE_INSTANCE_NAME);
workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
@@ -66,54 +69,84 @@ public class WorkflowResourceIdsUtilsTest {
assertEquals(VNF_ID, workflowResourceIds.getVnfId());
assertEquals(VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ assertEquals(VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName());
+ assertEquals(VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
}
@Test
public void shouldProperlySetServiceInstanceId() {
assertFieldSetProperly(WorkflowType.SERVICE, SERVICE_ID, workflowResourceIds::getServiceInstanceId);
+ assertEquals(SERVICE_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.SERVICE));
}
@Test
public void shouldProperlySetVnfId() {
assertFieldSetProperly(WorkflowType.VNF, VNF_ID, workflowResourceIds::getVnfId);
-
+ assertEquals(VNF_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.VNF));
}
@Test
public void shouldProperlySetPnfId() {
assertFieldSetProperly(WorkflowType.PNF, PNF_ID, workflowResourceIds::getPnfId);
+ assertEquals(PNF_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.PNF));
}
@Test
public void shouldProperlySetVfModuleId() {
assertFieldSetProperly(WorkflowType.VFMODULE, VF_MODULE_ID, workflowResourceIds::getVfModuleId);
+ assertEquals(VF_MODULE_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.VFMODULE));
}
@Test
public void shouldProperlySetVolumeGroupId() {
assertFieldSetProperly(WorkflowType.VOLUMEGROUP, VOLUME_GROUP_ID, workflowResourceIds::getVolumeGroupId);
+ assertEquals(VOLUME_GROUP_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.VOLUMEGROUP));
}
@Test
public void shouldProperlySetNetworkId() {
assertFieldSetProperly(WorkflowType.NETWORK, NETWORK_ID, workflowResourceIds::getNetworkId);
+ assertEquals(NETWORK_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.NETWORK));
}
@Test
public void shouldProperlySetNetworkCollectionId() {
assertFieldSetProperly(WorkflowType.NETWORKCOLLECTION, NETWORK_COLLECTION_ID,
workflowResourceIds::getNetworkCollectionId);
-
+ assertEquals(NETWORK_COLLECTION_ID, WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds,
+ WorkflowType.NETWORKCOLLECTION));
}
@Test
public void shouldProperlySetConfigurationId() {
assertFieldSetProperly(WorkflowType.CONFIGURATION, CONFIGURATION_ID, workflowResourceIds::getConfigurationId);
+ assertEquals(CONFIGURATION_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.CONFIGURATION));
}
@Test
public void shouldProperlySetInstanceGroupId() {
assertFieldSetProperly(WorkflowType.INSTANCE_GROUP, INSTANCE_GROUP_ID, workflowResourceIds::getInstanceGroupId);
+ assertEquals(INSTANCE_GROUP_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.INSTANCE_GROUP));
+ }
+
+ @Test
+ public void shouldPropertySetVnfInstanceName() {
+ assertFieldSetProperlyInstanceName(WorkflowType.VNF, VNF_INSTANCE_NAME,
+ workflowResourceIds::getVnfInstanceName);
+ }
+
+ @Test
+ public void shouldPropertySetVfModuleInstanceName() {
+ assertFieldSetProperlyInstanceName(WorkflowType.VFMODULE, VF_MODULE_INSTANCE_NAME,
+ workflowResourceIds::getVfModuleInstanceName);
}
private void assertFieldSetProperly(WorkflowType workflowType, String expectedId,
@@ -121,4 +154,13 @@ public class WorkflowResourceIdsUtilsTest {
WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId);
assertEquals(expectedId, testedObjectField.get());
}
+
+ private void assertFieldSetProperlyInstanceName(WorkflowType workflowType, String expectedId,
+ Supplier<String> testedObjectField) {
+ WorkflowResourceIdsUtils.setInstanceNameByWorkflowType(workflowResourceIds, workflowType, expectedId);
+ assertEquals(expectedId, testedObjectField.get());
+ }
+
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidatorTest.java
new file mode 100644
index 0000000000..1066ca1317
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/validators/UpgradePreWorkflowValidatorTest.java
@@ -0,0 +1,156 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks.validators;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+public class UpgradePreWorkflowValidatorTest {
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ private UpgradePreWorkflowValidator validator;
+
+ private ObjectMapper objectMapper;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ validator = new UpgradePreWorkflowValidator(catalogDbClient);
+ objectMapper = new ObjectMapper();
+ }
+
+ @Test
+ public void shouldRunFor() {
+ assertTrue(validator.shouldRunFor("upgradeInstance"));
+ assertFalse(validator.shouldRunFor("createInstance"));
+ }
+
+ private BuildingBlockExecution createExecution(ServiceInstancesRequest sir, List<Resource> resourceList)
+ throws JsonProcessingException {
+ BuildingBlockExecution mock = Mockito.mock(BuildingBlockExecution.class);
+ String jsonSir = objectMapper.writer().writeValueAsString(sir);
+ when(mock.getVariable(BBConstants.G_BPMN_REQUEST)).thenReturn(jsonSir);
+ when(mock.getVariable("resources")).thenReturn(resourceList);
+ return mock;
+ }
+
+ @Test
+ public void validateModelInvariantMismatch() throws JsonProcessingException {
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ sir.setRequestDetails(new RequestDetails());
+ sir.getRequestDetails().setModelInfo(new ModelInfo());
+ sir.getRequestDetails().getModelInfo().setModelInvariantId(UUID.randomUUID().toString());
+
+ Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
+ String aaiModelInvariantId = UUID.randomUUID().toString();
+ serviceResource.setModelInvariantId(aaiModelInvariantId);
+
+ BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource));
+
+ Optional<String> message = validator.validate(execution);
+
+ assertTrue(message.isPresent());
+ assertTrue(message.get().startsWith("Request service modelInvariantId"));
+ }
+
+ @Test
+ public void validateNoVnfsInAAI() throws JsonProcessingException {
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ sir.setRequestDetails(new RequestDetails());
+ sir.getRequestDetails().setModelInfo(new ModelInfo());
+ String modelInvariantId = UUID.randomUUID().toString();
+ sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
+
+ Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
+ serviceResource.setModelInvariantId(modelInvariantId);
+
+ BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource));
+
+ Optional<String> message = validator.validate(execution);
+
+ assertThat(message).isEmpty();
+ }
+
+ @Test
+ public void validateAAIVnfsNotSupported() throws JsonProcessingException {
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ sir.setRequestDetails(new RequestDetails());
+ sir.getRequestDetails().setModelInfo(new ModelInfo());
+ sir.getRequestDetails().getModelInfo().setModelUuid(UUID.randomUUID().toString());
+ String modelInvariantId = UUID.randomUUID().toString();
+ sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
+
+ Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
+ serviceResource.setModelInvariantId(modelInvariantId);
+ Resource vnfResource = new Resource(WorkflowType.VNF, "", false, serviceResource);
+ vnfResource.setVnfCustomizationId(UUID.randomUUID().toString());
+
+ Service service = new Service();
+ VnfResourceCustomization vnfCustomization = new VnfResourceCustomization();
+ vnfCustomization.setModelCustomizationUUID(UUID.randomUUID().toString());
+ service.setVnfCustomizations(Arrays.asList(vnfCustomization));
+
+ when(catalogDbClient.getServiceByModelUUID(anyString())).thenReturn(service);
+
+ BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource, vnfResource));
+
+ Optional<String> message = validator.validate(execution);
+
+ assertTrue(message.isPresent());
+ assertTrue(message.get().startsWith("Existing vnfs in AAI are not supported by service model"));
+ }
+
+ @Test
+ public void validateHappyCase() throws JsonProcessingException {
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ sir.setRequestDetails(new RequestDetails());
+ sir.getRequestDetails().setModelInfo(new ModelInfo());
+ sir.getRequestDetails().getModelInfo().setModelUuid(UUID.randomUUID().toString());
+ String modelInvariantId = UUID.randomUUID().toString();
+ sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
+
+ Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
+ serviceResource.setModelInvariantId(modelInvariantId);
+ Resource vnfResource = new Resource(WorkflowType.VNF, "", false, serviceResource);
+ String vnfCustomiationId = UUID.randomUUID().toString();
+ vnfResource.setVnfCustomizationId(vnfCustomiationId);
+
+ Service service = new Service();
+ VnfResourceCustomization vnfCustomization = new VnfResourceCustomization();
+ vnfCustomization.setModelCustomizationUUID(vnfCustomiationId);
+ service.setVnfCustomizations(Arrays.asList(vnfCustomization));
+
+ when(catalogDbClient.getServiceByModelUUID(anyString())).thenReturn(service);
+
+ BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource, vnfResource));
+
+ Optional<String> message = validator.validate(execution);
+
+ assertFalse(message.isPresent());
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json
new file mode 100644
index 0000000000..059754846a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json
@@ -0,0 +1,187 @@
+{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "test-customer"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "instanceName": "test",
+ "productFamilyId": "6ea37d21-1a8d-4cd5-a727-e543191a5bb6",
+ "requestorId": "portal",
+ "source": "source"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "cloudid",
+ "tenantId": "tenantid",
+ "cloudOwner": "cloudowner"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "ubuntu",
+ "userParams": [
+ {
+ "Homing_Solution": "none"
+ },
+ {
+ "service": {
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "744a1610-782e-47cf-bb45-d83319e33e17",
+ "modelInvariantUuid": "fc573bb4-d312-48ab-b81d-8b3313df4d07",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "0d0ba1ee-6b7f-47fe-8266-2967993b2c08",
+ "modelInstanceName": "Ubuntu VF 0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "cloudid",
+ "tenantId": "tenantid",
+ "cloudOwner": "cloudowner"
+ },
+ "platform": {
+ "platformName": "platform"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lob"
+ },
+ "productFamilyId": "6ea37d21-1a8d-4cd5-a727-e543191a5bb6\n",
+ "instanceName": "vnf-instanceName-1",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-0",
+ "modelVersionId": "8fa495ac-d057-4060-b772-868d8e97766e",
+ "modelInvariantUuid": "71dcbf41-9838-4b3d-baa4-4024d22ef0cc",
+ "modelVersion": "1",
+ "modelCustomizationId": "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0"
+ },
+ "instanceName": "demo-network-1",
+ "instanceParams": [
+ {
+ "name": "demo-network-1",
+ "cidr": "10.10.10.0/24"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-1",
+ "modelVersionId": "21954495-830f-48b7-b7b2-030d837789b3",
+ "modelInvariantUuid": "90355af6-55f3-460e-abe6-bec9a27a15e6",
+ "modelVersion": "1",
+ "modelCustomizationId": "83677d89-428a-407b-b4ec-738e68275d84"
+ },
+ "instanceName": "demo-1",
+ "instanceParams": [
+ {
+ "name": "demo-ubuntu-1",
+ "network_mgmt": "vlan101",
+ "network_name": "demo-network-1"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "744a1610-782e-47cf-bb45-d83319e33e17",
+ "modelInvariantUuid": "fc573bb4-d312-48ab-b81d-8b3313df4d07",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "0d0ba1ee-6b7f-47fe-8266-2967993b2c08",
+ "modelInstanceName": "Ubuntu VF 0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "cloudid",
+ "tenantId": "tenantid",
+ "cloudOwner": "cloudowner"
+ },
+ "platform": {
+ "platformName": "platform"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lob"
+ },
+ "productFamilyId": "6ea37d21-1a8d-4cd5-a727-e543191a5bb6\n",
+ "instanceName": "vnf-instanceName-2",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-1",
+ "modelVersionId": "21954495-830f-48b7-b7b2-030d837789b3",
+ "modelInvariantUuid": "90355af6-55f3-460e-abe6-bec9a27a15e6",
+ "modelVersion": "1",
+ "modelCustomizationId": "83677d89-428a-407b-b4ec-738e68275d84"
+ },
+ "instanceName": "demo-2",
+ "instanceParams": [
+ {
+ "name": "demo-ubuntu-2",
+ "network_mgmt": "vlan101",
+ "network_name": "demo-network-1"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-1",
+ "modelVersionId": "21954495-830f-48b7-b7b2-030d837789b3",
+ "modelInvariantUuid": "90355af6-55f3-460e-abe6-bec9a27a15e6",
+ "modelVersion": "1",
+ "modelCustomizationId": "83677d89-428a-407b-b4ec-738e68275d84"
+ },
+ "instanceName": "demo-3",
+ "instanceParams": [
+ {
+ "name": "demo-ubuntu-3",
+ "network_mgmt": "vlan101",
+ "network_name": "demo-network-1"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "f2444885-3c76-4ddc-8668-7741c0631495",
+ "modelInvariantId": "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-UbuntuDemo"
+ },
+ "owningEntity": {
+ "owningEntityId": "33a8b609-1cfe-4d19-8dc2-5b95b921de1e",
+ "owningEntityName": "demo"
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "f2444885-3c76-4ddc-8668-7741c0631495",
+ "modelInvariantId": "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ }
+ }
+} \ No newline at end of file
diff --git a/common/pom.xml b/common/pom.xml
index a6e8a79f56..39a980d7c8 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -14,8 +14,9 @@
<grpc.version>1.25.0</grpc.version>
<protobuf.version>3.10.0</protobuf.version>
<grpc.netty.version>4.1.30.Final</grpc.netty.version>
- <ccsdk.version>1.1.2</ccsdk.version>
+ <ccsdk.version>1.1.5</ccsdk.version>
<spring-cloud-sleuth.version>2.0.2.RELEASE</spring-cloud-sleuth.version>
+ <tomcat-catalina-version>9.0.45</tomcat-catalina-version>
</properties>
<dependencies>
<dependency>
@@ -45,6 +46,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
+ <version>5.2.14.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -79,7 +81,7 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
- <version>9.0.30</version>
+ <version>${tomcat-catalina-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -106,6 +108,7 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
+ <version>5.4.6</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
index 0bd6d64dc3..f06ee49dba 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
@@ -159,8 +159,6 @@ public class SliceProfileAdapter implements Serializable {
List<PerfReqEmbb> perfReqEmbbs = new ArrayList<>();
PerfReqEmbb perfReqEmbb = new PerfReqEmbb();
BeanUtils.copyProperties(this, perfReqEmbb);
- perfReqEmbb.setExpDataRateDL(this.expDataRateDL);
- perfReqEmbb.setExpDataRateUL(this.expDataRateUL);
perfReqEmbbs.add(perfReqEmbb);
perfReq.setPerfReqEmbbList(perfReqEmbbs);
} else if ("ullc".equalsIgnoreCase(sST)) {
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
index a0a5577402..6097f7e3fd 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
@@ -24,8 +24,8 @@ import io.grpc.ManagedChannel;
import io.grpc.stub.StreamObserver;
import java.util.concurrent.CountDownLatch;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc;
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceStub;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.slf4j.Logger;
@@ -50,7 +50,7 @@ class CDSProcessingHandler {
final CountDownLatch finishLatch = new CountDownLatch(1);
- final BlueprintProcessingServiceStub asyncStub = BlueprintProcessingServiceGrpc.newStub(channel);
+ final BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel);
final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() {
@Override
diff --git a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
index b92326cc89..5792c28f5f 100644
--- a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
+++ b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
@@ -41,7 +41,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
@@ -72,7 +72,7 @@ public class CDSProcessingClientTest {
client = new CDSProcessingClient(InProcessChannelBuilder.forName(serverName).directExecutor().build(), handler);
- final BlueprintProcessingServiceImplBase routeChatImpl = new BlueprintProcessingServiceImplBase() {
+ final BluePrintProcessingServiceImplBase routeChatImpl = new BluePrintProcessingServiceImplBase() {
@Override
public StreamObserver<ExecutionServiceInput> process(
StreamObserver<ExecutionServiceOutput> responseObserver) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
index 88c4bc3b04..2a91eaef5a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -26,6 +26,7 @@ public enum Action implements Actions {
updateInstance,
deleteInstance,
configureInstance,
+ upgradeInstance,
replaceInstance,
replaceInstanceRetainAssignments,
activateInstance,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index d69c395f96..031e9eee2a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -65,6 +65,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(NodeHealthcheckHandler.class);
register(ServiceInstances.class);
register(Onap3gppServiceInstances.class);
+ register(ServiceIntentApiHandler.class);
register(TasksHandler.class);
register(CloudOrchestration.class);
register(CloudResourcesOrchestration.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index bcbc7c7ca6..36922a878f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -379,6 +379,24 @@ public class ServiceInstances extends AbstractRestHandler {
}
@POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/upgrade")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Upgrade a Service Instance to newer model", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Transactional
+ public Response upgradeServiceInstance(String request, @PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
+ throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+
+ return serviceInstances(request, Action.upgradeInstance, instanceIdMap, version, requestId,
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
+ @POST
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java
new file mode 100644
index 0000000000..be63c5fb9a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java
@@ -0,0 +1,431 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Huawei Technologies.
+ * ================================================================================
+ * 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.apihandlerinfra;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.apihandler.camundabeans.CamundaResponse;
+import org.onap.so.apihandler.common.CamundaClient;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentCommonRequest;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentCreationRequest;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentDeletionRequest;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentModificationRequest;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.function.Function;
+
+/**
+ * This class serves as the entry point for Service Intent APIs. Unlike User Intent, which describes Intent using
+ * natural languages, Service Intent describes Intent through technology-agnostic and model-driven APIs. The Service
+ * Intent APIs have the following format: {service-Intent-Root}/{operation}, where {operation} may be "create",
+ * "delete", "modify", etc. And the parameters of the Intent service instance are specified in the payloads of the APIs.
+ * <p>
+ * For scalability, these APIs are designed to be generic, and thus support all the service Intent use-cases. i.e., The
+ * actual intent use-case/application, e.g., Cloud Leased Line, is differentiated by the "serviceType" parameter in the
+ * payload, rather than by specific APIs. Thus, this class does not need to grow when we add new Intent use-cases or
+ * applications.
+ * <p>
+ */
+@Component
+@Path("/onap/so/infra/serviceIntent")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/serviceIntent",
+ description = "API Requests for Intent services and " + "applications"))
+public class ServiceIntentApiHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(ServiceIntentApiHandler.class);
+
+ private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+
+ private static final String SAVE_TO_DB = "save instance to db";
+
+ private static final String URI_PREFIX = "/serviceIntent/";
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ @Autowired
+ private RequestHandlerUtils requestHandlerUtils;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @Autowired
+ private CamundaClient camundaClient;
+
+ @Autowired
+ private ResponseHandler responseHandler;
+
+ // @Value("${serviceIntent.config.file}")
+ // private String serviceIntentConfigFile;
+
+ /**
+ * POST Requests for create Service Intent Instance on a version provided
+ *
+ * @throws ApiException
+ */
+
+ @POST
+ @Path("/{version:[vV][1]}/create")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Create a SI Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response createServiceIntentInstance(ServiceIntentCreationRequest request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ return processServiceIntentRequest(request, Action.createInstance, version, requestId, null,
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+ }
+
+ /**
+ * PUT Requests for Service Intent Modification on a version provided
+ *
+ * @throws ApiException
+ */
+
+ @PUT
+ @Path("/{version:[vV][1]}/modify")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Modify a SI Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response modifyServiceIntentInstance(ServiceIntentModificationRequest request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return processServiceIntentRequest(request, Action.updateInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+ }
+
+ /**
+ * DELETE Requests for Service Intent Instance on a specified version
+ *
+ * @throws ApiException
+ */
+
+ @DELETE
+ @Path("/{version:[vV][1]}/delete")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Terminate/Delete a SI Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response deleteServiceIntentInstance(ServiceIntentDeletionRequest request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return processServiceIntentRequest(request, Action.deleteInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+ }
+
+ /**
+ * Process Service Intent request and send request to corresponding workflow
+ *
+ * @param request
+ * @param action
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ private Response processServiceIntentRequest(ServiceIntentCommonRequest request, Action action, String version,
+ String requestId, HashMap<String, String> instanceIdMap, String requestUri) throws ApiException {
+ String defaultServiceModelName = "COMMON_SI_DEFAULT";
+ String requestScope = ModelType.service.name();
+ String apiVersion = version.substring(1);
+ String serviceRequestJson = toString.apply(request);
+
+ String instanceName = null;
+ String modelUuid = null;
+ String serviceInstanceId = null;
+
+ try {
+ if (action == Action.createInstance) {
+ instanceName = ((ServiceIntentCreationRequest) request).getName();
+ modelUuid = ((ServiceIntentCreationRequest) request).getModelUuid();
+ } else if (action == Action.updateInstance) {
+ instanceName = ((ServiceIntentModificationRequest) request).getName();
+ serviceInstanceId = ((ServiceIntentModificationRequest) request).getServiceInstanceID();
+ } else if (action == Action.deleteInstance) {
+ serviceInstanceId = ((ServiceIntentDeletionRequest) request).getServiceInstanceID();
+ }
+ } catch (Exception e) {
+ logger.error("ERROR: processCllServiceRequest: Exception: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "processCllServiceRequest error", ErrorNumbers.SVC_BAD_PARAMETER,
+ null, version);
+ return response;
+ }
+
+ if (serviceRequestJson != null) {
+ InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+ requestScope, serviceRequestJson);
+
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+ instanceName);
+ try {
+ requestsDbClient.save(currentActiveReq);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+
+ RecipeLookupResult recipeLookupResult;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(modelUuid, action, defaultServiceModelName);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with Catalog DB", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No " + "communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does " + "not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String serviceInstanceType = request.getSubscriptionServiceType();
+ RequestClientParameter parameter;
+ try {
+ parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+ .setServiceInstanceId(serviceInstanceId).setServiceType(serviceInstanceType)
+ .setRequestDetails(serviceRequestJson).setApiVersion(version).setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion).build();
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Unable to generate RequestClientParameter object" + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+ } else {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "JsonProcessingException occurred - " + "serviceRequestJson is null",
+ ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+ return response;
+ }
+ }
+
+ /**
+ * Getting recipes from catalogDb
+ *
+ * @param serviceModelUUID the service model version uuid
+ * @param action the action for the service
+ * @param defaultServiceModelName default service name
+ * @return the service recipe result
+ */
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(String serviceModelUUID, Action action,
+ String defaultServiceModelName) {
+
+ RecipeLookupResult recipeLookupResult = getServiceURI(serviceModelUUID, action, defaultServiceModelName);
+
+ if (recipeLookupResult != null) {
+ logger.debug("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: "
+ + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+ } else {
+ logger.debug("No matching recipe record found");
+ }
+ return recipeLookupResult;
+ }
+
+ /**
+ * Getting recipes from catalogDb If Service recipe is not set, use default recipe, if set , use special recipe.
+ *
+ * @param serviceModelUUID the service version uuid
+ * @param action the action of the service.
+ * @param defaultServiceModelName default service name
+ * @return the service recipe result.
+ */
+ private RecipeLookupResult getServiceURI(String serviceModelUUID, Action action, String defaultServiceModelName) {
+
+ Service defaultServiceRecord =
+ catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ // set recipe as default generic recipe
+ ServiceRecipe recipe =
+ catalogDbClient.getFirstByServiceModelUUIDAndAction(defaultServiceRecord.getModelUUID(), action.name());
+ // check the service special recipe
+ if (null != serviceModelUUID && !serviceModelUUID.isEmpty()) {
+ ServiceRecipe serviceSpecialRecipe =
+ catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceModelUUID, action.name());
+ if (null != serviceSpecialRecipe) {
+ // set service special recipe.
+ recipe = serviceSpecialRecipe;
+ }
+ }
+
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout(), recipe.getParamXsd());
+
+ }
+
+ Function<Object, String> toString = serviceRequest -> {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestAsString = null;
+ try {
+ requestAsString = mapper.writeValueAsString(serviceRequest);
+ } catch (JsonProcessingException e) {
+ logger.debug("Exception while converting service request object to String {}", e);
+ }
+ return requestAsString;
+ };
+
+ private InfraActiveRequests createRequestObject(ServiceIntentCommonRequest request, Action action, String requestId,
+ Status status, String requestScope, String requestJson) {
+ InfraActiveRequests aq = new InfraActiveRequests();
+ try {
+ String serviceInstanceName = null;
+ String serviceInstanceId = null;
+ String serviceType = request.getServiceType();
+ if (action.name().equals("createInstance")) {
+ serviceInstanceName = ((ServiceIntentCreationRequest) request).getName();
+ aq.setServiceInstanceName(serviceInstanceName);
+ } else if (action.name().equals("updateInstance")) {
+ serviceInstanceName = ((ServiceIntentModificationRequest) request).getName();
+ serviceInstanceId = ((ServiceIntentModificationRequest) request).getServiceInstanceID();
+ aq.setServiceInstanceName(serviceInstanceName);
+ aq.setServiceInstanceId(serviceInstanceId);
+ } else if (action.name().equals("deleteInstance")) {
+ serviceInstanceId = ((ServiceIntentDeletionRequest) request).getServiceInstanceID();
+ aq.setServiceInstanceId(serviceInstanceId);
+ }
+
+ aq.setRequestId(requestId);
+ aq.setRequestAction(action.toString());
+ aq.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setStartTime(startTimeStamp);
+ aq.setRequestScope(requestScope);
+ aq.setRequestBody(requestJson);
+ aq.setRequestStatus(status.toString());
+ aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ aq.setServiceType(serviceType);
+ } catch (Exception e) {
+ logger.error("Exception when creation record request", e);
+
+ if (!status.equals(Status.FAILED)) {
+ throw e;
+ }
+ }
+ return aq;
+ }
+
+ private Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter parameter,
+ String orchestrationURI, String requestScope) throws ApiException {
+ ResponseEntity<String> response =
+ requestHandlerUtils.postRequest(currentActiveReq, parameter, orchestrationURI);
+ logger.debug("BPEL response : " + response);
+ int bpelStatus = responseHandler.setStatus(response.getStatusCodeValue());
+ String jsonResponse;
+ try {
+ responseHandler.acceptedResponse(response);
+ CamundaResponse camundaResponse = responseHandler.getCamundaResponse(response);
+ String responseBody = camundaResponse.getResponse();
+ if ("Success".equalsIgnoreCase(camundaResponse.getMessage())) {
+ jsonResponse = responseBody;
+ } else {
+ BPMNFailureException bpmnException =
+ new BPMNFailureException.Builder(String.valueOf(bpelStatus) + responseBody, bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build();
+ requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, bpmnException.getMessage());
+ throw bpmnException;
+ }
+ } catch (ApiException e) {
+ requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, e.getMessage());
+ throw e;
+ }
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, parameter.getRequestId(), jsonResponse,
+ parameter.getApiVersion());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java
new file mode 100644
index 0000000000..f27f88c428
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies.
+ * ================================================================================
+ * 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.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Model class for common parameter of Service Intent request
+ */
+public class ServiceIntentCommonRequest {
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("additionalProperties")
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ @JsonProperty("serviceType")
+ private String serviceType;
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentCommonRequest [globalSubscriberId=" + globalSubscriberId + ", subscriptionServiceType="
+ + subscriptionServiceType + ", serviceType=" + serviceType + ", additionalProperties="
+ + additionalProperties + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java
new file mode 100644
index 0000000000..bc711a00dc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies.
+ * ================================================================================
+ * 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.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for Service Intent Creation request
+ */
+public class ServiceIntentCreationRequest extends ServiceIntentCommonRequest {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("modelInvariantUuid")
+ private String modelInvariantUuid;
+
+ @JsonProperty("modelUuid")
+ private String modelUuid;
+
+ @JsonProperty("sst")
+ private String sST;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelUuid() {
+ return modelUuid;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ public String getsST() {
+ return sST;
+ }
+
+ public void setsST(String sST) {
+ this.sST = sST;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentCreationRequest [name=" + name + ", modelInvariantUuid=" + modelInvariantUuid
+ + ", modelUuid=" + modelUuid + ", globalSubscriberId=" + getGlobalSubscriberId()
+ + ", subscriptionServiceType=" + getSubscriptionServiceType() + ", serviceType=" + getServiceType()
+ + ", additionalProperties=" + getAdditionalProperties() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java
new file mode 100644
index 0000000000..c463c7bae4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies.
+ * ================================================================================
+ * 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.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for service intent instance terminate request
+ */
+public class ServiceIntentDeletionRequest extends ServiceIntentCommonRequest {
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentDeletionRequest [serviceInstanceID=" + getServiceInstanceID() + ", globalSubscriberId="
+ + getGlobalSubscriberId() + ", subscriptionServiceType=" + getSubscriptionServiceType()
+ + ", serviceType=" + getServiceType() + ", additionalProperties=" + getAdditionalProperties() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java
new file mode 100644
index 0000000000..17d6dc84ab
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Huawei Technologies.
+ * ================================================================================
+ * 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.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for Service Intent Update request
+ */
+public class ServiceIntentModificationRequest extends ServiceIntentCommonRequest {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentModificationRequest [name=" + name + ", serviceInstanceID=" + getServiceInstanceID()
+ + ", globalSubscriberId=" + getGlobalSubscriberId() + ", subscriptionServiceType="
+ + getSubscriptionServiceType() + ", serviceType=" + getServiceType() + ", additionalProperties="
+ + getAdditionalProperties() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
index 067e8611d0..8646a74a2f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
@@ -22,7 +22,13 @@
package org.onap.so.apihandlerinfra.validation;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.exceptions.ValidationException;
@@ -36,8 +42,6 @@ public class UserParamsValidation implements ValidationRule {
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
Service validate = info.getUserParams();
- Actions action = info.getAction();
-
if (validate.getModelInfo() == null) {
throw new ValidationException("modelInfo in userParams", true);
} else if (validate.getModelInfo().getModelType() == null) {
@@ -49,6 +53,10 @@ public class UserParamsValidation implements ValidationRule {
if (validate.getInstanceName() != null && info.getRequestInfo().getInstanceName() != null) {
instanceNameValidation(info, validate);
}
+
+ Actions action = info.getAction();
+ Map<String, Set<String>> vnfCustomIdToInstanceNames = new HashMap<>();
+ Map<String, Set<String>> vfModuleCustomIdToInstanceNames = new HashMap<>();
for (Vnfs vnf : validate.getResources().getVnfs()) {
if (vnf.getModelInfo() == null) {
throw new ValidationException("modelInfo in userParams vnf resources", true);
@@ -71,19 +79,42 @@ public class UserParamsValidation implements ValidationRule {
if (vnf.getPlatform() != null && vnf.getPlatform().getPlatformName() == null) {
throw new ValidationException("platformName in userParams vnf resources", true);
}
+
+ String vnfCustomizationId = vnf.getModelInfo().getModelCustomizationId();
+ vnfCustomIdToInstanceNames.putIfAbsent(vnfCustomizationId, new HashSet<>());
+ String vnfInstanceName = StringUtils.defaultString(vnf.getInstanceName());
+ Set<String> vnfVisitedInstanceNames = vnfCustomIdToInstanceNames.get(vnfCustomizationId);
+ if (!vnfVisitedInstanceNames.add(vnfInstanceName)) {
+ throw new ValidationException(
+ "instanceName: same instanceName with same modelCustomizationId in userParams vnf resources",
+ true);
+ }
if (vnf.getVfModules().isEmpty()) {
throw new ValidationException("vfModules in userParams vnf resources", true);
}
- for (VfModules vfModules : vnf.getVfModules()) {
- if (vfModules.getModelInfo() == null) {
+
+ for (VfModules vfModule : vnf.getVfModules()) {
+ if (vfModule.getModelInfo() == null) {
throw new ValidationException("modelInfo in userParams vfModules resources", true);
- } else if (vfModules.getModelInfo().getModelCustomizationId() == null) {
+ } else if (vfModule.getModelInfo().getModelCustomizationId() == null) {
throw new ValidationException("modelCustomizationId in userParams vfModule resources", true);
- } else if (vfModules.getModelInfo().getModelVersionId() == null) {
+ } else if (vfModule.getModelInfo().getModelVersionId() == null) {
throw new ValidationException("modelVersionId in userParams vfModule resources", true);
}
+
+ String vfModulecustomizationId = vfModule.getModelInfo().getModelCustomizationId();
+ vfModuleCustomIdToInstanceNames.putIfAbsent(vfModulecustomizationId, new HashSet<>());
+ String vfModuleInstanceName = StringUtils.defaultString(vfModule.getInstanceName());
+ Set<String> vfModuleVisitedInstanceNames = vfModuleCustomIdToInstanceNames.get(vfModulecustomizationId);
+ if (!vfModuleVisitedInstanceNames.add(vfModuleInstanceName)) {
+ throw new ValidationException(
+ "instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources",
+ true);
+ }
}
}
+ validateDuplicateInstanceNames(vnfCustomIdToInstanceNames, "vnf");
+ validateDuplicateInstanceNames(vfModuleCustomIdToInstanceNames, "vfModule");
List<Networks> validateNetworks = new ArrayList<>();
validateNetworks = validate.getResources().getNetworks();
@@ -135,4 +166,24 @@ public class UserParamsValidation implements ValidationRule {
"modelCustomizationId in userParams service");
}
}
+
+ private void validateDuplicateInstanceNames(Map<String, Set<String>> duplicateValidator, String type)
+ throws ValidationException {
+ Set<String> allInstanceNames = new HashSet<>();
+ for (Map.Entry<String, Set<String>> entry : duplicateValidator.entrySet()) {
+ Set<String> instanceNames = entry.getValue();
+ if (instanceNames.size() > 1 && instanceNames.contains(""))
+ throw new ValidationException(String.format(
+ "instanceName: instanceName is missing or empty with same modelCustomizationId in userParams %s resources",
+ type), true);
+
+ for (String instanceName : instanceNames) {
+ if (!instanceName.isBlank() && !allInstanceNames.add(instanceName)) {
+ throw new ValidationException(String.format(
+ "instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams %s resources",
+ type), true);
+ }
+ }
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java
new file mode 100644
index 0000000000..059c2bc057
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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.apihandlerinfra;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+
+public class ServiceIntentApiHandlerTest extends BaseTest {
+
+ private static final String ROOT_URI = "/onap/so/infra/serviceIntent/";
+
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Autowired
+ private Onap3gppServiceInstances objUnderTest;
+
+ @Before
+ public void init() throws JsonProcessingException {
+
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setServiceModelUUID(defaultService.getModelUUID());
+ serviceRecipe.setRecipeTimeout(180);
+ serviceRecipe.setOrchestrationUri("/mso/async/services/commonServiceIntentTest");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(MAPPER.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(MAPPER.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")).willReturn(aResponse()
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
+ Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
+ }
+
+ public String inputStream(String JsonInput) throws IOException {
+ JsonInput = "src/test/resources/ServiceIntentTest" + JsonInput;
+ return new String(Files.readAllBytes(Paths.get(JsonInput)));
+ }
+
+ public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_PARTNER_NAME, "VID");
+ headers.set(REQUESTOR_ID, "xxxxxx");
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath));
+ HttpEntity<String> request = new HttpEntity<>(requestJson, headers);
+
+ return restTemplate.exchange(builder.toUriString(), reqMethod, request, String.class);
+ }
+
+ @Test
+ public void createServiceInstanceTest() throws IOException {
+ String uri = ROOT_URI + "v1/create";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonServiceIntentTest"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("Camunda/BPMN_response.json").withStatus(HttpStatus.SC_ACCEPTED)));
+
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/create-cll-payload.json"), uri, HttpMethod.POST);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void updateServiceInstanceTest() throws IOException {
+ String uri = ROOT_URI + "v1/modify";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonServiceIntentTest"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("Camunda/BPMN_response.json").withStatus(HttpStatus.SC_ACCEPTED)));
+
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/modify-cll-payload.json"), uri, HttpMethod.PUT);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void deleteServiceInstanceTest() throws IOException {
+ String uri = ROOT_URI + "v1/delete";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonServiceIntentTest"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("Camunda/BPMN_response.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/delete-cll-payload.json"), uri, HttpMethod.DELETE);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java
index ba02254ad8..548b957303 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java
@@ -32,6 +32,7 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.serviceinstancebeans.VfModules;
public class UserParamsValidationTest {
@@ -66,6 +67,182 @@ public class UserParamsValidationTest {
}
@Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(0).setInstanceName("UbuntuVNF2");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).setInstanceName("UbuntuVNF2");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(1).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateNullInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(1).setInstanceName(null);
+ info.getUserParams().getResources().getVnfs().get(2).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDifferentInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameDifferentCustomizationIdVnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(0).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdVfModuleInOneVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(2).setInstanceName("lcm-demo-ubuntu-3");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0).setInstanceName("lcm-demo-ubuntu-3");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdVfModuleInOneVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(1).setInstanceName("lcm-demo-ubuntu-2");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule2.setInstanceName(vfModule1.getInstanceName());
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdVfModuleInOneVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(1).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule2.setInstanceName(null);
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateNullInstanceNameSameCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule1.setInstanceName(null);
+ vfModule2.setInstanceName(null);
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateInstanceNameSameCustomizationIdVfModuleInVnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameDifferentCustomizationIdVfModuleInVnfTest()
+ throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ vfModule1.setInstanceName(null);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(2);
+ vfModule2.setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
public void validateInstanceNameExceptionTest() throws IOException, ValidationException {
thrown.expect(ValidationException.class);
thrown.expectMessage("instanceName in requestInfo does not match instanceName in userParams service");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json
index a7d930f756..aa6448e934 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json
index 75e8fb5cd1..c93b49a992 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json
index baf620b668..a81cfd001a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json
index 6c152855ee..148abbc4bb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json
index bc6f8fc610..d8bfcc2d5b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base__BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json
index fd8b7c4e69..1efb0c1243 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json
@@ -75,6 +75,7 @@
"modelVersionId":"4c75f813-fa91-45a4-89d0-790ff5f1ae79",
"modelCustomizationId":"a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
},
+ "instanceName": "vfModule1",
"instanceParams":[
{
"vmx_int_net_len":"24"
@@ -88,6 +89,7 @@
"modelVersionId":"56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
"modelCustomizationId":"72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
},
+ "instanceName": "vfModule2",
"instanceParams":[
{
"availability_zone_0":"mtpocdv-kvm-az01",
@@ -102,6 +104,7 @@
"modelVersionId":"56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
"modelCustomizationId":"72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
},
+ "instanceName": "vfModule3",
"instanceParams":[
{
"availability_zone_0":"mtpocdv-kvm-az01",
@@ -116,6 +119,7 @@
"modelVersionId":"f555558f-d538-4876-8ffa-b102650fad64",
"modelCustomizationId":"da4d4327-fb7d-4311-ac7a-be7ba60cf969"
},
+ "instanceName": "vfModule4",
"instanceParams":[
{
"availability_zone_0":"mtpocdv-kvm-az01",
@@ -132,4 +136,4 @@
]
}
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json
new file mode 100644
index 0000000000..6018392abd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json
@@ -0,0 +1,29 @@
+{
+ "name": "cloud-leased-line-101",
+ "modelInvariantUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "modelUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "globalSubscriberId": "IBNCustomer",
+ "subscriptionServiceType": "IBN",
+ "serviceType": "CLL",
+ "additionalProperties": {
+ "enableSdnc": "false",
+ "serviceInstanceID": "cll-101",
+ "transportNetworks": [
+ {
+ "id": "cll-101-network-001",
+ "sla": {
+ "latency": 2,
+ "maxBandwidth": 3000
+ },
+ "connectionLinks": [
+ {
+ "name": "cll-link-1",
+ "transportEndpointA": "tranportEp_UNI_ID_311_1",
+ "transportEndpointB": "tranportEp_ROOT_ID_512_1"
+ }
+ ]
+ }
+ ]
+ }
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json
new file mode 100644
index 0000000000..f21f4e3cea
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json
@@ -0,0 +1,9 @@
+{
+ "serviceInstanceID": "cll-101",
+ "globalSubscriberId": "IBNCustomer",
+ "subscriptionServiceType": "IBN",
+ "serviceType": "CLL",
+ "additionalProperties": {
+ "enableSdnc": "false"
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json
new file mode 100644
index 0000000000..3611adaf3b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json
@@ -0,0 +1,29 @@
+{
+ "serviceInstanceID": "cll-101",
+ "name": "cloud-leased-line-101",
+ "modelInvariantUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "modelUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "globalSubscriberId": "IBNCustomer",
+ "subscriptionServiceType": "IBN",
+ "serviceType": "CLL",
+ "additionalProperties": {
+ "enableSdnc": "false",
+ "transportNetworks": [
+ {
+ "id": "cll-101-network-001",
+ "sla": {
+ "latency": 2,
+ "maxBandwidth": 8000
+ },
+ "connectionLinks": [
+ {
+ "name": "cll-link-1",
+ "transportEndpointA": "tranportEp_UNI_ID_311_1",
+ "transportEndpointB": "tranportEp_ROOT_ID_512_1"
+ }
+ ]
+ }
+ ]
+ }
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json
new file mode 100644
index 0000000000..19106202a4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json
@@ -0,0 +1,193 @@
+{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "ubuntu-customer"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "instanceName": "ThreeVNFTest",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "portal",
+ "source": "postman"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "ubuntu",
+ "userParams": [
+ {
+ "service": {
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "9306f24c-2b99-46d9-a92c-2236199555bd",
+ "modelInvariantUuid": "5bd13140-11b6-4975-b6ee-e496d9a0cf0d",
+ "modelVersion": "3.0",
+ "modelCustomizationId": "435f34f8-1701-4276-ae39-47ad03bad782",
+ "modelInstanceName": "UbuntuVF 0"
+ },
+ "cloudConfiguration": {
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "UbuntuVNF1",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "Ubuntuvf..base..module-0",
+ "modelVersionId": "c9de87ba-9d2a-44df-94c4-68aad72947e8",
+ "modelInvariantUuid": "51aaa747-68e7-4313-9717-9d32c752bbdf",
+ "modelVersion": "1",
+ "modelCustomizationId": "25409778-c4b0-448c-aa45-89c0a2cc4165"
+ },
+ "instanceName": "lcm-demo-network-1",
+ "instanceParams": [
+ {
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuBVF",
+ "modelVersionId": "0e5c37c2-8c35-4ff8-a538-803a5f44aeb5",
+ "modelInvariantUuid": "cf4ac32e-88b8-4fff-b5fc-9ebe2b7251f8",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "e774a853-4a47-4a88-b5b4-9324f1d7f6a7",
+ "modelInstanceName": "UbuntuBVF 0"
+ },
+ "cloudConfiguration": {
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "UbuntuVNF2",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName2"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "Ubuntubvf..ubuntu-vf-module..module-1",
+ "modelVersionId": "548fa27f-d9d7-498f-9292-4c1ddcf79d2d",
+ "modelInvariantUuid": "7689624d-fdcd-40a5-acf1-93f5ef1a5a59",
+ "modelVersion": "1",
+ "modelCustomizationId": "c8db1431-ffbe-4978-9b28-b310ca2c7d93"
+ },
+ "instanceName": "lcm-demo-ubuntu-1",
+ "instanceParams": [
+ {
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuBVF",
+ "modelVersionId": "0e5c37c2-8c35-4ff8-a538-803a5f44aeb5",
+ "modelInvariantUuid": "cf4ac32e-88b8-4fff-b5fc-9ebe2b7251f8",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "e774a853-4a47-4a88-b5b4-9324f1d7f6a7",
+ "modelInstanceName": "UbuntuBVF 0"
+ },
+ "cloudConfiguration": {
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "UbuntuVNF3",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName3"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "Ubuntubvf..ubuntu-vf-module..module-1",
+ "modelVersionId": "548fa27f-d9d7-498f-9292-4c1ddcf79d2d",
+ "modelInvariantUuid": "7689624d-fdcd-40a5-acf1-93f5ef1a5a59",
+ "modelVersion": "1",
+ "modelCustomizationId": "c8db1431-ffbe-4978-9b28-b310ca2c7d93"
+ },
+ "instanceName": "lcm-demo-ubuntu-2",
+ "instanceParams": [
+ {
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "Ubuntubvf..ubuntu-vf-module..module-1",
+ "modelVersionId": "548fa27f-d9d7-498f-9292-4c1ddcf79d2d",
+ "modelInvariantUuid": "7689624d-fdcd-40a5-acf1-93f5ef1a5a59",
+ "modelVersion": "1",
+ "modelCustomizationId": "c8db1431-ffbe-4978-9b28-b310ca2c7d93"
+ },
+ "instanceName": "lcm-demo-ubuntu-3",
+ "instanceParams": [
+ {
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "Ubuntunosriov..base..module-0",
+ "modelVersionId": "bcc8ef84-b367-40c0-8a5d-ceabdc1785e0",
+ "modelInvariantUuid": "f3927419-9e68-4883-b861-20c8412872d7",
+ "modelVersion": "1",
+ "modelCustomizationId": "ee848516-4e08-4b30-8ed0-d411bb059842"
+ },
+ "instanceName": "ubuntu-demo-mp-network-1",
+ "instanceParams": [
+ {
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "2.0",
+ "modelVersionId": "3a9ff92f-dc19-4f05-930d-d238939d508b",
+ "modelInvariantId": "115405d8-6944-407d-b0ae-6b7155754643",
+ "modelName": "Ubuntu3VNFService",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-test"
+ },
+ "owningEntity": {
+ },
+ "modelInfo": {
+ "modelVersion": "2.0",
+ "modelVersionId": "3a9ff92f-dc19-4f05-930d-d238939d508b",
+ "modelInvariantId": "115405d8-6944-407d-b0ae-6b7155754643",
+ "modelName": "Ubuntu3VNFService",
+ "modelType": "service"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml
index c2bcf9b44f..c4913e6d85 100644
--- a/mso-catalog-db/pom.xml
+++ b/mso-catalog-db/pom.xml
@@ -73,6 +73,7 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
+ <version>3.3.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 91cfb00911..ae6d51c6a2 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -70,6 +70,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
+import org.onap.so.rest.catalog.beans.Vnf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -276,6 +277,8 @@ public class CatalogDbClient {
private final Client<ServiceRecipe> serviceRecipeClient;
+ private final Client<NetworkResource> networkResourceClient;
+
private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient;
private final Client<CloudSite> cloudSiteClient;
@@ -441,7 +444,7 @@ public class CatalogDbClient {
workflowClient = clientFactory.create(Workflow.class);
bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class);
processingFlagsClient = clientFactory.create(ProcessingFlags.class);
-
+ networkResourceClient = clientFactory.create(NetworkResource.class);
}
public CatalogDbClient(String baseUri, String auth) {
@@ -494,6 +497,7 @@ public class CatalogDbClient {
workflowClient = clientFactory.create(Workflow.class);
bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class);
processingFlagsClient = clientFactory.create(ProcessingFlags.class);
+ networkResourceClient = clientFactory.create(NetworkResource.class);
}
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(
@@ -630,7 +634,6 @@ public class CatalogDbClient {
}
-
public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
BuildingBlockDetail buildingBlockDetail =
getSingleResource(buildingBlockDetailClient, getUri(UriBuilder.fromUri(findOneByBuildingBlockName)
@@ -722,7 +725,6 @@ public class CatalogDbClient {
}
-
public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action) {
return this.getSingleResource(networkRecipeClient, UriBuilder.fromUri(findFirstByModelNameAndAction)
.queryParam(MODEL_NAME, modelName).queryParam(ACTION, action).build());
@@ -1042,6 +1044,72 @@ public class CatalogDbClient {
}
}
+ public void deleteServiceRecipe(String recipeId) {
+ this.deleteSingleResource(serviceRecipeClient,
+ UriBuilder.fromUri(endpoint + SERVICE_RECIPE + URI_SEPARATOR + recipeId).build());
+ }
+
+ public void postServiceRecipe(ServiceRecipe recipe) {
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<ServiceRecipe> entity = new HttpEntity<>(recipe, headers);
+ restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/serviceRecipe").build().encode().toString(),
+ HttpMethod.POST, entity, ServiceRecipe.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find ServiceRecipe with Id: " + recipe.getId());
+ }
+ throw e;
+ }
+ }
+
+ public void postVnfRecipe(VnfRecipe recipe) {
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<VnfRecipe> entity = new HttpEntity<>(recipe, headers);
+ restTemplate
+ .exchange(UriComponentsBuilder.fromUriString(endpoint + "/vnfRecipe").build().encode().toString(),
+ HttpMethod.POST, entity, VnfRecipe.class)
+ .getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find VnfRecipe with Id: " + recipe.getId());
+ }
+ throw e;
+ }
+ }
+
+ public void postNetworkRecipe(NetworkRecipe recipe) {
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<NetworkRecipe> entity = new HttpEntity<>(recipe, headers);
+ restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/networkRecipe").build().encode().toString(),
+ HttpMethod.POST, entity, NetworkRecipe.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find NetworkRecipe with Id: " + recipe.getId());
+ }
+ throw e;
+ }
+ }
+
+ public List<ServiceRecipe> getServiceRecipes() {
+ return this.getMultipleResources(serviceRecipeClient,
+ UriBuilder.fromUri(endpoint + SERVICE_RECIPE).queryParam("size", "1000").build());
+ }
+
+ public List<NetworkRecipe> getNetworkRecipes() {
+ return this.getMultipleResources(networkRecipeClient,
+ UriBuilder.fromUri(endpoint + NETWORK_RECIPE).queryParam("size", "1000").build());
+ }
+
+ public List<NetworkResource> getNetworkResources() {
+ return this.getMultipleResources(networkResourceClient,
+ UriBuilder.fromUri(endpoint + "/networkResource").queryParam("size", "1000").build());
+ }
+
public List<org.onap.so.rest.catalog.beans.Service> getServices() {
try {
HttpEntity<?> entity = getHttpEntity();
@@ -1058,6 +1126,20 @@ public class CatalogDbClient {
}
}
+ public List<VnfResource> getVnfResources() {
+ return this.getMultipleResources(vnfResourceClient,
+ UriBuilder.fromUri(endpoint + "/vnfResource").queryParam("size", "1000").build());
+ }
+
+ public List<VnfRecipe> getVnfRecipes() {
+ return this.getMultipleResources(vnfRecipeClient,
+ UriBuilder.fromUri(endpoint + VNF_RECIPE).queryParam("size", "1000").build());
+ }
+
+ private <T> void deleteSingleResource(Client<T> client, URI uri) {
+ client.delete(uri);
+ }
+
public org.onap.so.rest.catalog.beans.Vnf getVnfModelInformation(String serviceModelUUID,
String vnfCustomizationUUID, String depth) {
if (Strings.isNullOrEmpty(serviceModelUUID)) {
diff --git a/pom.xml b/pom.xml
index 49d4b75f59..5fcf2e5191 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
<appc.client.version>1.7.2</appc.client.version>
<bowman.client.version>0.9.0</bowman.client.version>
<aaf.cadi.version>2.1.15</aaf.cadi.version>
- <so-etsi-sol003-adapter-version>1.8.1-SNAPSHOT</so-etsi-sol003-adapter-version>
+ <so-etsi-sol003-adapter-version>1.9.0-SNAPSHOT</so-etsi-sol003-adapter-version>
<onap-logging-version>1.6.9</onap-logging-version>
</properties>
<distributionManagement>
@@ -488,7 +488,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>2.9.8</version>
+ <version>2.12.1</version>
</dependency>
</dependencies>
</plugin>
@@ -884,13 +884,13 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.12</version>
+ <version>1.15</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.5</version>
+ <version>2.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
diff --git a/releases/1.9.0.yaml b/releases/1.9.0.yaml
new file mode 100644
index 0000000000..bf63d55686
--- /dev/null
+++ b/releases/1.9.0.yaml
@@ -0,0 +1,22 @@
+
+---
+distribution_type: 'container'
+container_release_tag: '1.9.0'
+project: 'so'
+log_dir: 'so-maven-docker-stage-master/818/'
+ref: '27c3d83a8b8c70aa923896fd655e739f2b013c3b'
+containers:
+ - name: 'so/catalog-db-adapter'
+ version: '1.9.0-20210813T1422'
+ - name: 'so/request-db-adapter'
+ version: '1.9.0-20210813T1422'
+ - name: 'so/openstack-adapter'
+ version: '1.9.0-20210813T1422'
+ - name: 'so/sdnc-adapter'
+ version: '1.9.0-20210813T1422'
+ - name: 'so/sdc-controller'
+ version: '1.9.0-20210813T1422'
+ - name: 'so/bpmn-infra'
+ version: '1.9.0-20210813T1422'
+ - name: 'so/api-handler-infra'
+ version: '1.9.0-20210813T1422'
diff --git a/version.properties b/version.properties
index 0986d1f027..ece298009d 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=9
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}