diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks')
5 files changed, 129 insertions, 0 deletions
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 b56bd905a6..466b49644f 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 @@ -246,6 +246,7 @@ public class UserParamsServiceTraversal { pnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); pnfResource.setModelVersionId(modelInfo.getModelVersionId()); } + pnfResource.setInstanceName(pnf.getInstanceName()); pnfResource.setProcessingPriority(pnf.getProcessingPriority()); resourceList.add(pnfResource); } 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 9cabf6665c..f3aafde2a2 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 @@ -70,6 +70,8 @@ public final class WorkflowResourceIdsUtils { workflowResourceIds.setVnfInstanceName(instanceName); } else if (resourceType == WorkflowType.VFMODULE) { workflowResourceIds.setVfModuleInstanceName(instanceName); + } else if (resourceType == WorkflowType.PNF) { + workflowResourceIds.setPnfInstanceName(instanceName); } } @@ -110,6 +112,7 @@ public final class WorkflowResourceIdsUtils { workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId")); workflowResourceIds.setVnfInstanceName((String) execution.getVariable("vnfInstanceName")); workflowResourceIds.setVfModuleInstanceName((String) execution.getVariable("vfModuleInstanceName")); + workflowResourceIds.setPnfInstanceName((String) execution.getVariable("pnfInstanceName")); return workflowResourceIds; } 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 cac7f872b3..cf6588e113 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 @@ -66,6 +66,7 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest { 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 MACRO_CREATE_SVC_SAME_MODEL_PNF = "Macro/ServiceMacroCreateMultipleSameModelPnfs.json"; private static final String serviceInstanceId = "123"; private DelegateExecution execution; private CatalogDbClient mockCatalogDbClient; @@ -149,6 +150,30 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest { } @Test + public void getResourceListFromUserParamsMultiplePnfs() throws Exception { + initExecution("createInstance", readBpmnRequestFromFile(MACRO_CREATE_SVC_SAME_MODEL_PNF), false); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + + assertEquals(3, resourceListFromUserParams.size()); + + Resource service = resourceListFromUserParams.get(0); + assertTrue(service.getResourceType() == WorkflowType.SERVICE); + assertEquals(2, service.getChildren().size()); + + Resource pnf1 = service.getChildren().get(0); + assertEquals(service, pnf1.getParent()); + assertEquals("ORAN_SIM1_2106_pnf_01", pnf1.getInstanceName()); + assertEquals("88a3096a-af87-4853-99f6-7256a9ab6c3e", pnf1.getResourceId()); + + Resource pnf2 = service.getChildren().get(1); + assertEquals(service, pnf2.getParent()); + assertEquals("ORAN_SIM1_2106_pnf_02", pnf2.getInstanceName()); + assertEquals("88a3096a-af87-4853-99f6-7256a9ab6c3e", pnf2.getResourceId()); + } + + @Test public void getResourceListFromUserParamsForVnfs() throws Exception { initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false); Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true)) 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 996c0c07e1..f8bd963c49 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 @@ -42,6 +42,7 @@ public class WorkflowResourceIdsUtilsTest { 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 static final String PNF_INSTANCE_NAME = "pnfInstanceNameId"; private WorkflowResourceIds workflowResourceIds; @Before @@ -60,6 +61,7 @@ public class WorkflowResourceIdsUtilsTest { execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID); execution.setVariable("vnfInstanceName", VNF_INSTANCE_NAME); execution.setVariable("vfModuleInstanceName", VF_MODULE_INSTANCE_NAME); + execution.setVariable("pnfInstanceName", PNF_INSTANCE_NAME); workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution); @@ -71,6 +73,7 @@ public class WorkflowResourceIdsUtilsTest { assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId()); assertEquals(VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName()); assertEquals(VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName()); + assertEquals(PNF_INSTANCE_NAME, workflowResourceIds.getPnfInstanceName()); } @Test @@ -149,6 +152,12 @@ public class WorkflowResourceIdsUtilsTest { workflowResourceIds::getVfModuleInstanceName); } + @Test + public void shouldPropertySetPnfInstanceName() { + assertFieldSetProperlyInstanceName(WorkflowType.PNF, PNF_INSTANCE_NAME, + workflowResourceIds::getPnfInstanceName); + } + private void assertFieldSetProperly(WorkflowType workflowType, String expectedId, Supplier<String> testedObjectField) { WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId); diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json new file mode 100644 index 0000000000..4eb6faee64 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json @@ -0,0 +1,91 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c", + "modelType": "service", + "modelName": "service_pnf_2305", + "modelVersion": "2.0", + "modelVersionId": "e199ca4e-08f9-4f10-a15d-b94d50e52a6a", + "modelUuid": "e199ca4e-08f9-4f10-a15d-b94d50e52a6a", + "modelInvariantUuid": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c" + }, + "requestInfo": { + "productFamilyId": "5G", + "source": "VID", + "instanceName": "ORAN_SIM1_2106_1", + "suppressRollback": false, + "requestorId": "NBI" + }, + "subscriberInfo": { + "globalSubscriberId": "5GCustomer" + }, + "requestParameters": { + "subscriptionServiceType": "5G", + "userParams": [{ + "service": { + "modelInfo": { + "modelVersionId": "e199ca4e-08f9-4f10-a15d-b94d50e52a6a", + "modelName": "service_pnf_2305", + "modelType": "service" + }, + "instanceName": "ORAN_SIM1_2106_1", + "instanceParams": [], + "resources": { + "pnfs": [{ + "modelInfo": { + "modelCustomizationName": "pnf_only_2305 0", + "modelCustomizationId": "88a3096a-af87-4853-99f6-7256a9ab6c3e", + "modelInvariantId": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c", + "modelVersionId": "a6a9dc3d-204c-4dbb-862b-46214788b0e5", + "modelName": "service_pnf_2305", + "modelType": "pnf", + "modelVersion": "2.0" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "LOB-5GCustomer" + }, + "productFamilyId": "5G", + "instanceParams": [], + "instanceName": "ORAN_SIM1_2106_pnf_01", + "processingPriority": 1 + }, { + "modelInfo": { + "modelCustomizationName": "pnf_only_2305 0", + "modelCustomizationId": "88a3096a-af87-4853-99f6-7256a9ab6c3e", + "modelInvariantId": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c", + "modelVersionId": "a6a9dc3d-204c-4dbb-862b-46214788b0e5", + "modelName": "service_pnf_2305", + "modelType": "pnf", + "modelVersion": "2.0" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "LOB-5GCustomer" + }, + "productFamilyId": "5G", + "instanceParams": [], + "instanceName": "ORAN_SIM1_2106_pnf_02", + "processingPriority": 2 + }] + } + } + }, { + "Homing_Solution": "none" + }], + "aLaCarte": false, + "usePreload": false + }, + "project": { + "projectName": "basicnw-project" + }, + "owningEntity": { + "owningEntityId": "67f2e84c-734d-4e90-a1e4-d2ffa2e75849", + "owningEntityName": "OE-5GCustomer" + } + } +}
\ No newline at end of file |